From cd986a2a8ee289efebda386b540f580ab1fa1794 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Tue, 27 Jan 2026 16:29:28 +0100 Subject: [PATCH 1/2] nixos/tests/transmission: convert to runTest See https://github.com/NixOS/nixpkgs/issues/386873 --- nixos/tests/all-tests.nix | 2 +- nixos/tests/transmission.nix | 43 ++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 2b538a450c2f..282835431246 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1630,7 +1630,7 @@ in traefik = runTestOn [ "aarch64-linux" "x86_64-linux" ] ./traefik.nix; trafficserver = runTest ./trafficserver.nix; transfer-sh = runTest ./transfer-sh.nix; - transmission_4 = handleTest ./transmission.nix { }; + transmission_4 = runTest ./transmission.nix; trezord = runTest ./trezord.nix; trickster = runTest ./trickster.nix; trilium-server = runTestOn [ "x86_64-linux" ] ./trilium-server.nix; diff --git a/nixos/tests/transmission.nix b/nixos/tests/transmission.nix index 5186098b40cc..406b0df8599d 100644 --- a/nixos/tests/transmission.nix +++ b/nixos/tests/transmission.nix @@ -1,27 +1,28 @@ -import ./make-test-python.nix ( - { pkgs, ... }: - { - name = "transmission"; - meta = with pkgs.lib.maintainers; { - maintainers = [ coconnor ]; +{ pkgs, ... }: +{ + name = "transmission"; + meta = with pkgs.lib.maintainers; { + maintainers = [ coconnor ]; + }; + + nodes.machine = + { ... }: + { + imports = [ ../modules/profiles/minimal.nix ]; + + networking.firewall.allowedTCPPorts = [ 9091 ]; + + security.apparmor.enable = true; + + services.transmission.enable = true; }; - nodes.machine = - { ... }: - { - imports = [ ../modules/profiles/minimal.nix ]; - - networking.firewall.allowedTCPPorts = [ 9091 ]; - - security.apparmor.enable = true; - - services.transmission.enable = true; - }; - - testScript = '' + testScript = + { nodes, ... }: + #python + '' start_all() machine.wait_for_unit("transmission") machine.shutdown() ''; - } -) +} From 314c912811341a90d3f502d87ae3b38954d51486 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Tue, 27 Jan 2026 16:30:21 +0100 Subject: [PATCH 2/2] nixos/transmission: replace activationScript by a systemd unit See https://github.com/NixOS/nixpkgs/issues/475305 --- .../modules/services/torrent/transmission.nix | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/nixos/modules/services/torrent/transmission.nix b/nixos/modules/services/torrent/transmission.nix index 87493ec6ba62..95d0f9e8a486 100644 --- a/nixos/modules/services/torrent/transmission.nix +++ b/nixos/modules/services/torrent/transmission.nix @@ -357,19 +357,29 @@ in # when /home/foo is not owned by cfg.user. # Note also that using an ExecStartPre= wouldn't work either # because BindPaths= needs these directories before. - system.activationScripts.transmission-daemon = '' - install -d -m 700 -o '${cfg.user}' -g '${cfg.group}' '${cfg.home}/${settingsDir}' - '' - + optionalString (cfg.downloadDirPermissions != null) '' - install -d -m '${cfg.downloadDirPermissions}' -o '${cfg.user}' -g '${cfg.group}' '${cfg.settings.download-dir}' + systemd.services.transmission-setup = { + before = [ "transmission.service" ]; + partOf = [ "transmission.service" ]; - ${optionalString cfg.settings.incomplete-dir-enabled '' - install -d -m '${cfg.downloadDirPermissions}' -o '${cfg.user}' -g '${cfg.group}' '${cfg.settings.incomplete-dir}' - ''} - ${optionalString cfg.settings.watch-dir-enabled '' - install -d -m '${cfg.downloadDirPermissions}' -o '${cfg.user}' -g '${cfg.group}' '${cfg.settings.watch-dir}' - ''} - ''; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + + script = '' + install -d -m 700 -o '${cfg.user}' -g '${cfg.group}' '${cfg.home}/${settingsDir}' + '' + + optionalString (cfg.downloadDirPermissions != null) '' + install -d -m '${cfg.downloadDirPermissions}' -o '${cfg.user}' -g '${cfg.group}' '${cfg.settings.download-dir}' + + ${optionalString cfg.settings.incomplete-dir-enabled '' + install -d -m '${cfg.downloadDirPermissions}' -o '${cfg.user}' -g '${cfg.group}' '${cfg.settings.incomplete-dir}' + ''} + ${optionalString cfg.settings.watch-dir-enabled '' + install -d -m '${cfg.downloadDirPermissions}' -o '${cfg.user}' -g '${cfg.group}' '${cfg.settings.watch-dir}' + ''} + ''; + }; systemd.services.transmission = { description = "Transmission BitTorrent Service"; @@ -392,7 +402,7 @@ in set -eu${lib.optionalString (cfg.settings.message-level >= 3) "x"} ${pkgs.jq}/bin/jq --slurp add ${settingsFile} '${cfg.credentialsFile}' | install -D -m 600 -o '${cfg.user}' -g '${cfg.group}' /dev/stdin \ - '${cfg.home}/${settingsDir}/settings.json' + '${cfg.home}/${settingsDir}/settings.json' '' ) ];