diff --git a/tests/configs/default.nix b/tests/configs/default.nix new file mode 100644 index 0000000..5cdc45b --- /dev/null +++ b/tests/configs/default.nix @@ -0,0 +1,15 @@ +let + sources = import ../../npins; +in +{ pkgs ? import sources.nixos-unstable { } }: + +let + wmLib = (import ../../. { }).lib; + build = modules: wmLib.build { + inherit pkgs modules; + }; +in +{ + fastfetch = build [ ./wrapper-fastfetch.nix ]; + neofetch = build [ ./wrapper-neofetch.nix ]; +} diff --git a/tests/configs/wrapper-fastfetch.nix b/tests/configs/wrapper-fastfetch.nix new file mode 100644 index 0000000..262c54a --- /dev/null +++ b/tests/configs/wrapper-fastfetch.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: + +{ + wrappers.fastfetch = { + arg0 = lib.getExe' pkgs.fastfetch "fastfetch"; + appendArgs = [ "--logo" "Guix" ]; + env.NO_COLOR = "1"; + xdg.desktopEntry.enable = true; + }; + + build.extraPassthru.tests = { + actuallyBuilt = let + wrapper = config.build.toplevel; + in pkgs.runCommand "wrapper-manager-fastfetch-actually-built" { } '' + [ -e "${wrapper}/share/applications/fastfetch.desktop" ] && [ -x "${wrapper}/bin/${config.wrappers.fastfetch.executableName}" ] && touch $out + ''; + }; +} diff --git a/tests/configs/wrapper-neofetch.nix b/tests/configs/wrapper-neofetch.nix new file mode 100644 index 0000000..6db34f8 --- /dev/null +++ b/tests/configs/wrapper-neofetch.nix @@ -0,0 +1,21 @@ +{ config, lib, pkgs, yourMomName, ... }: + +{ + wrappers.neofetch = { + arg0 = lib.getExe' pkgs.neofetch "neofetch"; + executableName = yourMomName; + appendArgs = [ + "--ascii_distro" "guix" + "--title_fqdn" "off" + "--os_arch" "off" + ]; + }; + + build.extraPassthru.tests = { + actuallyBuilt = let + wrapper = config.build.toplevel; + in pkgs.runCommand "wrapper-manager-neofetch-actually-built" { } '' + [ -x "${wrapper}/bin/${config.wrappers.fastfetch.executableName}" ] && touch $out + ''; + }; +} diff --git a/tests/lib/env/default.nix b/tests/lib/env/default.nix index ea92dc2..44dfb19 100644 --- a/tests/lib/env/default.nix +++ b/tests/lib/env/default.nix @@ -1,12 +1,16 @@ { pkgs, lib, self }: +let + neofetchWrapper = ../../configs/wrapper-neofetch.nix; + fastfetchWrapper = ../../configs/wrapper-fastfetch.nix; +in lib.runTests { testsEvaluateSampleConfiguration = { expr = let sampleConf = self.env.eval { inherit pkgs; - modules = [ ./wrapper-neofetch.nix ]; + modules = [ neofetchWrapper ]; specialArgs.yourMomName = "Joe Mama"; }; in @@ -19,7 +23,7 @@ lib.runTests { let sampleConf = self.env.eval { inherit pkgs; - modules = [ ./wrapper-fastfetch.nix ]; + modules = [ fastfetchWrapper ]; specialArgs.yourMomName = "Joe Mama"; }; in @@ -32,7 +36,7 @@ lib.runTests { let sampleConf = self.env.build { inherit pkgs; - modules = [ ./wrapper-neofetch.nix ]; + modules = [ neofetchWrapper ]; specialArgs.yourMomName = "Joe Mama"; }; in @@ -45,7 +49,7 @@ lib.runTests { let sampleConf = self.env.build { inherit pkgs; - modules = [ ./wrapper-fastfetch.nix ]; + modules = [ fastfetchWrapper ]; specialArgs.yourMomName = "Joe Mama"; }; in diff --git a/tests/lib/env/wrapper-fastfetch.nix b/tests/lib/env/wrapper-fastfetch.nix deleted file mode 100644 index b9e71a0..0000000 --- a/tests/lib/env/wrapper-fastfetch.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ lib, pkgs, ... }: - -{ - wrappers.fastfetch = { - arg0 = lib.getExe' pkgs.fastfetch "fastfetch"; - appendArgs = [ "--logo" "Guix" ]; - env.NO_COLOR = "1"; - xdg.desktopEntry.enable = true; - }; -} diff --git a/tests/lib/env/wrapper-neofetch.nix b/tests/lib/env/wrapper-neofetch.nix deleted file mode 100644 index 9986e41..0000000 --- a/tests/lib/env/wrapper-neofetch.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ lib, pkgs, yourMomName, ... }: - -{ - wrappers.neofetch = { - arg0 = lib.getExe' pkgs.neofetch "neofetch"; - executableName = yourMomName; - appendArgs = [ - "--ascii_distro" "guix" - "--title_fqdn" "off" - "--os_arch" "off" - ]; - }; -}