46 lines
1.3 KiB
Nix
46 lines
1.3 KiB
Nix
{
|
|
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;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|