refactor: moved nixos modules to dendrite pattern
This commit is contained in:
parent
df8dd110ad
commit
0ea11e0236
219 changed files with 4802 additions and 4820 deletions
10
modules/nixos/programs/qbittorent/default.nix
Normal file
10
modules/nixos/programs/qbittorent/default.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{config, ...}: let
|
||||
mod = config.flake.nixosModules;
|
||||
in {
|
||||
flake.nixosModules.qbittorent = {
|
||||
imports = [
|
||||
mod.qbittorent-service
|
||||
mod.qbittorent-storage
|
||||
];
|
||||
};
|
||||
}
|
||||
20
modules/nixos/programs/qbittorent/qbittorent.nix
Normal file
20
modules/nixos/programs/qbittorent/qbittorent.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{...}: {
|
||||
flake.nixosModules.qbittorent-service = {
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
options.services.qbittorrent = {
|
||||
mediaDir = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = lib.mdDoc ''
|
||||
The directory to create to store qbittorrent media.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.services.qbittorrent.enable {
|
||||
# Main qbittorrent configuration goes here if needed
|
||||
};
|
||||
};
|
||||
}
|
||||
48
modules/nixos/programs/qbittorent/storage.nix
Normal file
48
modules/nixos/programs/qbittorent/storage.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{...}: {
|
||||
flake.nixosModules.qbittorent-storage = {
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
qbittorent_profile_directory = "/var/lib/qBittorrent/";
|
||||
in {
|
||||
options.services.qbittorrent.impermanence.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = config.services.qbittorrent.enable && config.storage.impermanence.enable;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.services.qbittorrent.enable {
|
||||
storage.datasets.replicate = {
|
||||
"system/root" = {
|
||||
directories."${qbittorent_profile_directory}" = lib.mkIf config.services.qbittorrent.impermanence.enable {
|
||||
owner.name = "qbittorrent";
|
||||
group.name = "qbittorrent";
|
||||
};
|
||||
};
|
||||
"system/media" = {
|
||||
mount = "/persist/replicate/system/media";
|
||||
|
||||
directories."${config.services.qbittorrent.mediaDir}" = lib.mkIf config.services.qbittorrent.impermanence.enable {
|
||||
owner.name = "qbittorrent";
|
||||
group.name = "qbittorrent";
|
||||
owner.permissions = {
|
||||
read = true;
|
||||
write = true;
|
||||
execute = true;
|
||||
};
|
||||
group.permissions = {
|
||||
read = true;
|
||||
write = true;
|
||||
execute = true;
|
||||
};
|
||||
other.permissions = {
|
||||
read = true;
|
||||
write = false;
|
||||
execute = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue