Merge pull request #205895 from jakubgs/transmission/add-package-opt

transmission: add package option
This commit is contained in:
Jörg Thalheim 2022-12-14 21:55:08 +00:00 committed by GitHub
commit 92b32a8a7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -174,6 +174,8 @@ in
};
};
package = mkPackageOption pkgs "transmission" {};
downloadDirPermissions = mkOption {
type = with types; nullOr str;
default = null;
@ -287,7 +289,7 @@ in
install -D -m 600 -o '${cfg.user}' -g '${cfg.group}' /dev/stdin \
'${cfg.home}/${settingsDir}/settings.json'
'')];
ExecStart="${pkgs.transmission}/bin/transmission-daemon -f -g ${cfg.home}/${settingsDir} ${escapeShellArgs cfg.extraFlags}";
ExecStart="${cfg.package}/bin/transmission-daemon -f -g ${cfg.home}/${settingsDir} ${escapeShellArgs cfg.extraFlags}";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
User = cfg.user;
Group = cfg.group;
@ -385,7 +387,7 @@ in
};
# It's useful to have transmission in path, e.g. for remote control
environment.systemPackages = [ pkgs.transmission ];
environment.systemPackages = [ cfg.package ];
users.users = optionalAttrs (cfg.user == "transmission") ({
transmission = {
@ -457,7 +459,7 @@ in
];
security.apparmor.policies."bin.transmission-daemon".profile = ''
include "${pkgs.transmission.apparmor}/bin.transmission-daemon"
include "${cfg.package.apparmor}/bin.transmission-daemon"
'';
security.apparmor.includes."local/bin.transmission-daemon" = ''
r ${config.systemd.services.transmission.environment.CURL_CA_BUNDLE},