wrapper-manager-fds/tests: init for library set

This commit is contained in:
Gabriel Arazas 2024-07-01 22:27:03 +08:00
parent a994a0cbac
commit aed2769f77
5 changed files with 68 additions and 0 deletions

9
tests/default.nix Normal file
View File

@ -0,0 +1,9 @@
{ branch ? "nixos-stable" }:
let
sources = import ../npins;
pkgs = import sources.${branch} { };
in
{
lib = import ./lib { inherit pkgs; };
}

12
tests/lib/default.nix Normal file
View File

@ -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;
}

29
tests/lib/env/default.nix vendored Normal file
View File

@ -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;
};
}

7
tests/lib/env/wrapper-fastfetch.nix vendored Normal file
View File

@ -0,0 +1,7 @@
{ lib, pkgs, ... }:
{
arg0 = lib.getExe' pkgs.fastfetch "fastfetch";
appendArgs = [ "--logo" "Guix" ];
env.NO_COLOR = "1";
}

11
tests/lib/env/wrapper-neofetch.nix vendored Normal file
View File

@ -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"
];
}