mirror of
https://github.com/foo-dogsquared/nix-module-wrapper-manager-fds.git
synced 2025-01-31 04:58:17 +00:00
wrapper-manager-fds/tests: add tests for actually checking the configurations
This commit is contained in:
parent
5714c1b8c6
commit
12686f3bad
15
tests/configs/default.nix
Normal file
15
tests/configs/default.nix
Normal 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 ];
|
||||||
|
}
|
18
tests/configs/wrapper-fastfetch.nix
Normal file
18
tests/configs/wrapper-fastfetch.nix
Normal 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
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
21
tests/configs/wrapper-neofetch.nix
Normal file
21
tests/configs/wrapper-neofetch.nix
Normal 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
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
12
tests/lib/env/default.nix
vendored
12
tests/lib/env/default.nix
vendored
@ -1,12 +1,16 @@
|
|||||||
{ pkgs, lib, self }:
|
{ pkgs, lib, self }:
|
||||||
|
|
||||||
|
let
|
||||||
|
neofetchWrapper = ../../configs/wrapper-neofetch.nix;
|
||||||
|
fastfetchWrapper = ../../configs/wrapper-fastfetch.nix;
|
||||||
|
in
|
||||||
lib.runTests {
|
lib.runTests {
|
||||||
testsEvaluateSampleConfiguration = {
|
testsEvaluateSampleConfiguration = {
|
||||||
expr =
|
expr =
|
||||||
let
|
let
|
||||||
sampleConf = self.env.eval {
|
sampleConf = self.env.eval {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
modules = [ ./wrapper-neofetch.nix ];
|
modules = [ neofetchWrapper ];
|
||||||
specialArgs.yourMomName = "Joe Mama";
|
specialArgs.yourMomName = "Joe Mama";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
@ -19,7 +23,7 @@ lib.runTests {
|
|||||||
let
|
let
|
||||||
sampleConf = self.env.eval {
|
sampleConf = self.env.eval {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
modules = [ ./wrapper-fastfetch.nix ];
|
modules = [ fastfetchWrapper ];
|
||||||
specialArgs.yourMomName = "Joe Mama";
|
specialArgs.yourMomName = "Joe Mama";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
@ -32,7 +36,7 @@ lib.runTests {
|
|||||||
let
|
let
|
||||||
sampleConf = self.env.build {
|
sampleConf = self.env.build {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
modules = [ ./wrapper-neofetch.nix ];
|
modules = [ neofetchWrapper ];
|
||||||
specialArgs.yourMomName = "Joe Mama";
|
specialArgs.yourMomName = "Joe Mama";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
@ -45,7 +49,7 @@ lib.runTests {
|
|||||||
let
|
let
|
||||||
sampleConf = self.env.build {
|
sampleConf = self.env.build {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
modules = [ ./wrapper-fastfetch.nix ];
|
modules = [ fastfetchWrapper ];
|
||||||
specialArgs.yourMomName = "Joe Mama";
|
specialArgs.yourMomName = "Joe Mama";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
10
tests/lib/env/wrapper-fastfetch.nix
vendored
10
tests/lib/env/wrapper-fastfetch.nix
vendored
@ -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;
|
|
||||||
};
|
|
||||||
}
|
|
13
tests/lib/env/wrapper-neofetch.nix
vendored
13
tests/lib/env/wrapper-neofetch.nix
vendored
@ -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"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user