wrapper-manager-fds/tests: add tests for actually checking the configurations

This commit is contained in:
Gabriel Arazas 2024-07-27 20:17:48 +08:00
parent 5714c1b8c6
commit 12686f3bad
6 changed files with 62 additions and 27 deletions

15
tests/configs/default.nix Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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