diff --git a/tests/default.nix b/tests/default.nix new file mode 100644 index 0000000..539c82d --- /dev/null +++ b/tests/default.nix @@ -0,0 +1,9 @@ +{ branch ? "nixos-stable" }: + +let + sources = import ../npins; + pkgs = import sources.${branch} { }; +in +{ + lib = import ./lib { inherit pkgs; }; +} diff --git a/tests/lib/default.nix b/tests/lib/default.nix new file mode 100644 index 0000000..e775297 --- /dev/null +++ b/tests/lib/default.nix @@ -0,0 +1,12 @@ +{ pkgs }: + +let + lib = import ../../lib { inherit pkgs; }; + callLib = file: import file { + inherit (pkgs) lib; inherit pkgs; + self = lib; + }; +in +{ + env = callLib ./env; +} diff --git a/tests/lib/env/default.nix b/tests/lib/env/default.nix new file mode 100644 index 0000000..b2da63d --- /dev/null +++ b/tests/lib/env/default.nix @@ -0,0 +1,29 @@ +{ pkgs, lib, self }: + +lib.runTests { + testsBuildSampleConfiguration = { + expr = + let + sampleConf = self.env.build { + inherit pkgs; + modules = [ ./wrapper-neofetch.nix ]; + specialArgs.yourMomName = "Joe Mama"; + }; + in + lib.isDerivation sampleConf.config.build.toplevel; + expected = true; + }; + + testsBuildSampleConfiguration2 = { + expr = + let + sampleConf = self.env.build { + inherit pkgs; + modules = [ ./wrapper-fastfetch.nix ]; + specialArgs.yourMomName = "Joe Mama"; + }; + in + lib.isDerivation sampleConf.config.build.toplevel; + expected = true; + }; +} diff --git a/tests/lib/env/wrapper-fastfetch.nix b/tests/lib/env/wrapper-fastfetch.nix new file mode 100644 index 0000000..c7af5ab --- /dev/null +++ b/tests/lib/env/wrapper-fastfetch.nix @@ -0,0 +1,7 @@ +{ lib, pkgs, ... }: + +{ + arg0 = lib.getExe' pkgs.fastfetch "fastfetch"; + appendArgs = [ "--logo" "Guix" ]; + env.NO_COLOR = "1"; +} diff --git a/tests/lib/env/wrapper-neofetch.nix b/tests/lib/env/wrapper-neofetch.nix new file mode 100644 index 0000000..5092d04 --- /dev/null +++ b/tests/lib/env/wrapper-neofetch.nix @@ -0,0 +1,11 @@ +{ lib, pkgs, yourMomName, ... }: + +{ + arg0 = lib.getExe' pkgs.neofetch "neofetch"; + executableName = yourMomName; + appendArgs = [ + "--ascii_distro" "guix" + "--title_fqdn" "off" + "--os_arch" "off" + ]; +}