From 98bf8de65dc1ed12c6443b18f6f24d36e9c438d6 Mon Sep 17 00:00:00 2001 From: Tomodachi94 Date: Sat, 10 Aug 2024 14:13:51 -0700 Subject: [PATCH] volnoti: use cfg.package instead of pkgs --- modules/services/volnoti.nix | 2 +- tests/default.nix | 1 + tests/modules/services/volnoti/default.nix | 1 + .../services/volnoti/package-option.nix | 31 +++++++++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 tests/modules/services/volnoti/default.nix create mode 100644 tests/modules/services/volnoti/package-option.nix diff --git a/modules/services/volnoti.nix b/modules/services/volnoti.nix index 7d4e725f0..47b45aab4 100644 --- a/modules/services/volnoti.nix +++ b/modules/services/volnoti.nix @@ -37,7 +37,7 @@ in { Install = { WantedBy = [ "graphical-session.target" ]; }; - Service = { ExecStart = "${pkgs.volnoti}/bin/volnoti -v -n"; }; + Service = { ExecStart = "${lib.getExe cfg.package} -v -n"; }; }; }; } diff --git a/tests/default.nix b/tests/default.nix index 8fac3280a..7ddddc166 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -287,6 +287,7 @@ in import nmtSrc { ./modules/services/trayscale ./modules/services/twmn ./modules/services/udiskie + ./modules/services/volnoti ./modules/services/window-managers/bspwm ./modules/services/window-managers/herbstluftwm ./modules/services/window-managers/hyprland diff --git a/tests/modules/services/volnoti/default.nix b/tests/modules/services/volnoti/default.nix new file mode 100644 index 000000000..d4621e62f --- /dev/null +++ b/tests/modules/services/volnoti/default.nix @@ -0,0 +1 @@ +{ volnoti-package-option = ./package-option.nix; } diff --git a/tests/modules/services/volnoti/package-option.nix b/tests/modules/services/volnoti/package-option.nix new file mode 100644 index 000000000..ab403cdb2 --- /dev/null +++ b/tests/modules/services/volnoti/package-option.nix @@ -0,0 +1,31 @@ +{ config, ... }: + +{ + services.volnoti = { + enable = true; + package = config.lib.test.mkStubPackage { + name = "volnoti"; + outPath = "@volnoti@"; + }; + }; + + test.stubs.volnoti = { }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/volnoti.service + assertFileExists $serviceFile + assertFileContent $serviceFile \ + ${ + builtins.toFile "expected-volnoti.service" '' + [Install] + WantedBy=graphical-session.target + + [Service] + ExecStart=@volnoti@/bin/volnoti -v -n + + [Unit] + Description=volnoti + '' + } + ''; +}