1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

tests: add option test.stubs

This option provides a more convenient way to overlay dummy packages.
It also adds a function `config.lib.test.mkStubPackage` that can,
e.g., be used for `package` options.
This commit is contained in:
Robert Helgesson 2021-09-26 11:08:45 +02:00
parent b0651cc217
commit cb09a968e9
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
159 changed files with 753 additions and 981 deletions

View file

@ -26,10 +26,13 @@ let
# unnecessary rebuilds of the tests.
manual.manpages.enable = false;
imports = [ ./asserts.nix ];
imports = [ ./asserts.nix ./stubs.nix ];
}
];
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
isLinux = pkgs.stdenv.hostPlatform.isLinux;
in
import nmt {
@ -89,12 +92,11 @@ import nmt {
./modules/programs/zplug
./modules/programs/zsh
./modules/xresources
] ++ lib.optionals pkgs.stdenv.hostPlatform.isDarwin [
] ++ lib.optionals isDarwin [
./modules/targets-darwin
] ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
] ++ lib.optionals isLinux [
./modules/config/i18n
./modules/i18n/input-method
./modules/misc/debug
./modules/misc/gtk
./modules/misc/numlock
./modules/misc/pam
@ -103,7 +105,6 @@ import nmt {
./modules/misc/xsession
./modules/programs/abook
./modules/programs/autorandr
./modules/programs/firefox
./modules/programs/foot
./modules/programs/getmail
./modules/programs/gnome-terminal
@ -142,5 +143,8 @@ import nmt {
./modules/targets-linux
] ++ lib.optionals enableBig [
./modules/programs/emacs
] ++ lib.optionals (enableBig && isLinux) [
./modules/misc/debug
./modules/programs/firefox
]);
}

View file

@ -1,8 +1,8 @@
{ config, pkgs, ... }:
{
config = {
nixpkgs.overlays = [ (import ./fcitx5-overlay.nix) ];
imports = [ ./fcitx5-stubs.nix ];
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [ fcitx5-chinese-addons ];
@ -11,5 +11,4 @@
nmt.script = ''
assertFileExists home-files/.config/systemd/user/fcitx5-daemon.service
'';
};
}

View file

@ -1,22 +0,0 @@
final: prev:
let
dummy = prev.runCommandLocal "dummy-package" { } "mkdir $out";
in {
fcitx5 = prev.runCommandLocal "fcitx5" { version = "0"; } ''
mkdir -p $out/bin $out/share/applications $out/etc/xdg/autostart
touch $out/bin/fcitx5 \
$out/share/applications/org.fcitx.Fcitx5.desktop \
$out/etc/xdg/autostart/org.fcitx.Fcitx5.desktop
chmod +x $out/bin/fcitx5
'';
fcitx5-configtool = dummy;
fcitx5-lua = dummy;
fcitx5-qt = dummy;
fcitx5-gtk = dummy;
fcitx5-with-addons =
prev.fcitx5-with-addons.override { inherit (final) fcitx5-qt; };
fcitx5-chinese-addons = dummy;
}

View file

@ -0,0 +1,27 @@
{
test.stubs = {
fcitx5 = {
version = "0";
outPath = null;
buildScript = ''
mkdir -p $out/bin $out/share/applications $out/etc/xdg/autostart
touch $out/bin/fcitx5 \
$out/share/applications/org.fcitx.Fcitx5.desktop \
$out/etc/xdg/autostart/org.fcitx.Fcitx5.desktop
chmod +x $out/bin/fcitx5
'';
};
fcitx5-configtool = { outPath = null; };
fcitx5-lua = { outPath = null; };
fcitx5-qt = { outPath = null; };
fcitx5-gtk = { outPath = null; };
fcitx5-chinese-addons = { outPath = null; };
};
nixpkgs.overlays = [
(self: super: {
fcitx5-with-addons =
super.fcitx5-with-addons.override { inherit (self) fcitx5-qt; };
})
];
}

View file

@ -9,6 +9,8 @@ with lib;
gtk2.extraConfig = "gtk-can-change-accels = 1";
};
test.stubs.dconf = { };
nmt.script = ''
assertFileExists home-files/.gtkrc-2.0
assertFileContent home-files/.gtkrc-2.0 ${

View file

@ -7,6 +7,8 @@ with lib;
gtk.enable = true;
gtk.gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
test.stubs.dconf = { };
nmt.script = ''
assertFileExists home-files/.config/gtk-2.0/gtkrc
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \

View file

@ -6,9 +6,7 @@ with lib;
config = {
xsession.numlock.enable = true;
nixpkgs.overlays = [
(self: super: { numlockx = pkgs.writeScriptBin "dummy-numlockx" ""; })
];
test.stubs.numlockx = { };
nmt.script = ''
serviceFile=home-files/.config/systemd/user/numlockx.service

View file

@ -7,15 +7,11 @@
platformTheme = "gnome";
style = {
name = "adwaita";
package = pkgs.dummyTheme;
package = config.lib.test.mkStubPackage { };
};
};
nixpkgs.overlays = [
(self: super: {
dummyTheme = pkgs.runCommandLocal "theme" { } "mkdir $out";
})
];
test.stubs.qgnomeplatform = { };
nmt.script = ''
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \

View file

@ -6,8 +6,7 @@ with lib;
config = {
programs.abook.enable = true;
nixpkgs.overlays =
[ (self: super: { abook = pkgs.writeScriptBin "dummy-abook" ""; }) ];
test.stubs.abook = { };
nmt.script = ''
assertPathNotExists home-files/.config/abook/abookrc

View file

@ -28,8 +28,7 @@ with lib;
'';
};
nixpkgs.overlays =
[ (self: super: { abook = pkgs.writeScriptBin "dummy-abook" ""; }) ];
test.stubs.abook = { };
nmt.script = ''
assertFileExists home-files/.config/abook/abookrc

View file

@ -6,9 +6,7 @@ with lib;
config = {
programs.alacritty.enable = true;
nixpkgs.overlays = [
(self: super: { alacritty = pkgs.writeScriptBin "dummy-alacritty" ""; })
];
test.stubs.alacritty = { };
nmt.script = ''
assertPathNotExists home-files/.config/alacritty

View file

@ -6,7 +6,7 @@ with lib;
config = {
programs.alacritty = {
enable = true;
package = pkgs.writeScriptBin "dummy-alacritty" "";
package = config.lib.test.mkStubPackage { };
settings = {
window.dimensions = {

View file

@ -6,7 +6,7 @@ with lib;
config = {
programs.alacritty = {
enable = true;
package = pkgs.writeScriptBin "dummy-alacritty" "";
package = config.lib.test.mkStubPackage { };
settings = {
window.dimensions = {

View file

@ -23,8 +23,7 @@ with lib;
programs.alot = { enable = true; };
nixpkgs.overlays =
[ (self: super: { alot = pkgs.writeScriptBin "dummy-alot" ""; }) ];
test.stubs.alot = { };
nmt.script = ''
assertFileExists home-files/.config/alot/config

View file

@ -20,8 +20,7 @@ with lib;
'';
};
nixpkgs.overlays =
[ (self: super: { aria2 = pkgs.writeScriptBin "dummy-aria2" ""; }) ];
test.stubs.aria2 = { };
nmt.script = ''
assertFileContent \

View file

@ -6,6 +6,10 @@ with lib;
config = {
programs.autojump.enable = true;
test.stubs.autojump = {
buildScript = "mkdir -p $out/bin; touch $out/bin/autojump";
};
nmt.script = ''
assertFileExists home-path/bin/autojump
'';

View file

@ -28,6 +28,8 @@
};
};
test.stubs.autorandr = { };
nmt.script = ''
config=home-files/.config/autorandr/default/config
setup=home-files/.config/autorandr/default/setup

View file

@ -17,6 +17,8 @@
};
};
test.stubs.autorandr = { };
nmt.script = ''
config=home-files/.config/autorandr/default/config

View file

@ -18,8 +18,7 @@ with lib;
'';
};
nixpkgs.overlays =
[ (self: super: { bat = pkgs.writeScriptBin "dummy" ""; }) ];
test.stubs.bat = { };
nmt.script = ''
assertFileExists home-files/.config/bat/config

View file

@ -6,7 +6,7 @@ with lib;
config = {
programs.bottom = {
enable = true;
package = pkgs.writeScriptBin "dummy" "";
package = config.lib.test.mkStubPackage { };
};
nmt.script = ''

View file

@ -6,7 +6,7 @@ with lib;
config = {
programs.bottom = {
enable = true;
package = pkgs.writeShellScriptBin "dummy" "";
package = config.lib.test.mkStubPackage { };
settings = {
flags = {

View file

@ -9,8 +9,7 @@ with lib;
modal = true;
};
nixpkgs.overlays =
[ (self: super: { broot = pkgs.writeScriptBin "dummy" ""; }) ];
test.stubs.broot = { };
nmt.script = ''
assertFileExists home-files/.config/broot/conf.toml

View file

@ -17,8 +17,7 @@
prev_img = [ "h" "Left" ];
};
nixpkgs.overlays =
[ (self: super: { feh = pkgs.writeScriptBin "dummy-feh" ""; }) ];
test.stubs.feh = { };
nmt.script = ''
assertFileContent \

View file

@ -4,8 +4,7 @@
config = {
programs.feh.enable = true;
nixpkgs.overlays =
[ (self: super: { feh = pkgs.writeScriptBin "dummy-feh" ""; }) ];
test.stubs.feh = { };
nmt.script = ''
assertPathNotExists home-files/.config/feh/buttons

View file

@ -34,8 +34,7 @@ in {
xdg.dataFile."fish/home-manager_generated_completions".source =
lib.mkForce (builtins.toFile "empty" "");
nixpkgs.overlays =
[ (self: super: { fish = pkgs.writeScriptBin "dummy" ""; }) ];
test.stubs.fish = { };
nmt = {
description =

View file

@ -14,8 +14,7 @@ with lib;
xdg.dataFile."fish/home-manager_generated_completions".source =
lib.mkForce (builtins.toFile "empty" "");
nixpkgs.overlays =
[ (self: super: { fish = pkgs.writeScriptBin "dummy" ""; }) ];
test.stubs.fish = { };
nmt = {
description =

View file

@ -50,8 +50,7 @@ in {
xdg.dataFile."fish/home-manager_generated_completions".source =
lib.mkForce (builtins.toFile "empty" "");
nixpkgs.overlays =
[ (self: super: { fish = pkgs.writeScriptBin "dummy" ""; }) ];
test.stubs.fish = { };
nmt = {
description =

View file

@ -6,8 +6,7 @@ with lib;
config = {
programs.foot.enable = true;
nixpkgs.overlays =
[ (self: super: { foot = pkgs.writeScriptBin "dummy-foot" ""; }) ];
test.stubs.foot = { };
nmt.script = ''
assertPathNotExists home-files/.config/foot

View file

@ -6,7 +6,7 @@ with lib;
config = {
programs.foot = {
enable = true;
package = pkgs.writeShellScriptBin "dummy-foot" "";
package = config.lib.test.mkStubPackage { };
settings = {
main = {

View file

@ -1,11 +1,9 @@
{ config, lib, pkgs, ... }:
let
package = pkgs.writeShellScriptBin "dummy-foot" "" // { outPath = "@foot@"; };
in {
{
config = {
programs.foot = {
inherit package;
package = config.lib.test.mkStubPackage { outPath = "@foot@"; };
enable = true;
server.enable = true;
};

View file

@ -8,8 +8,7 @@
editor = "vim";
};
nixpkgs.overlays =
[ (self: super: { gh = pkgs.writeScriptBin "dummy-gh" ""; }) ];
test.stubs.gh = { };
nmt.script = ''
assertFileExists home-files/.config/gh/config.yml

View file

@ -79,14 +79,10 @@ in {
}
];
nixpkgs.overlays = [
(self: super: {
git-lfs = pkgs.writeScriptBin "dummy-git-lfs" "";
delta = pkgs.writeScriptBin "dummy-delta" "" // {
outPath = "@delta@";
test.stubs = {
git-lfs = { };
delta = { };
};
})
];
nmt.script = ''
assertFileExists home-files/.config/git/config

View file

@ -4,13 +4,6 @@ with lib;
{
config = {
nixpkgs.overlays = [
(self: super: {
gnome.gnome-terminal =
pkgs.writeScriptBin "dummy-gnome3-gnome-terminal" "";
})
];
programs.gnome-terminal = {
enable = true;
profile = {
@ -55,6 +48,14 @@ with lib;
showMenubar = false;
};
nixpkgs.overlays = [
(self: super: {
gnome.gnome-terminal = config.lib.test.mkStubPackage { };
})
];
test.stubs.dconf = { };
nmt.script = ''
dconfIni=$(grep -oPm 1 '/nix/store/[a-z0-9]*?-hm-dconf.ini' $TESTED/activate)
assertFileContent $dconfIni ${./gnome-terminal-1.conf}

View file

@ -5,7 +5,6 @@ with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ];
config = {
accounts.email.accounts = {
"hm@example.com" = {
himalaya = {
@ -24,8 +23,7 @@ with lib;
settings = { downloads-dir = "/data/download"; };
};
nixpkgs.overlays =
[ (self: super: { himalaya = pkgs.writeScriptBin "dummy-alot" ""; }) ];
test.stubs.himalaya = { };
nmt.script = ''
assertFileExists home-files/.config/himalaya/config.toml
@ -33,6 +31,5 @@ with lib;
./himalaya-expected.toml
}
'';
};
}

View file

@ -6,8 +6,7 @@ with lib;
config = {
programs.htop.enable = true;
nixpkgs.overlays =
[ (self: super: { htop = pkgs.writeScriptBin "dummy" ""; }) ];
test.stubs.htop = { };
nmt.script = ''
assertPathNotExists home-files/.config/htop

View file

@ -36,8 +36,7 @@ with lib;
(text "Systemd")
]);
nixpkgs.overlays =
[ (self: super: { htop = pkgs.writeScriptBin "dummy" ""; }) ];
test.stubs.htop = { };
nmt.script = ''
htoprc=home-files/.config/htop/htoprc

View file

@ -7,8 +7,7 @@ with lib;
programs.htop.enable = true;
programs.htop.settings = { color_scheme = 6; };
nixpkgs.overlays =
[ (self: super: { htop = pkgs.writeScriptBin "dummy" ""; }) ];
test.stubs.htop = { };
# Test that the 'fields' key is written in addition to the customized
# settings or htop won't read the options.

View file

@ -92,11 +92,7 @@ with lib;
};
};
nixpkgs.overlays = [
(self: super: {
i3status-rust = pkgs.writeScriptBin "dummy-i3status-rust" "";
})
];
test.stubs.i3status-rust = { };
nmt.script = ''
assertFileExists home-files/.config/i3status-rust/config-custom.toml

View file

@ -6,11 +6,7 @@ with lib;
config = {
programs.i3status-rust = { enable = true; };
nixpkgs.overlays = [
(self: super: {
i3status-rust = pkgs.writeScriptBin "dummy-i3status-rust" "";
})
];
test.stubs.i3status-rust = { };
nmt.script = ''
assertFileExists home-files/.config/i3status-rust/config-default.toml

View file

@ -102,11 +102,7 @@ with lib;
};
};
nixpkgs.overlays = [
(self: super: {
i3status-rust = pkgs.writeScriptBin "dummy-i3status-rust" "";
})
];
test.stubs.i3status-rust = { };
nmt.script = ''
assertFileExists home-files/.config/i3status-rust/config-extra-settings.toml

View file

@ -52,11 +52,7 @@ with lib;
};
nixpkgs.overlays = [
(self: super: {
i3status-rust = pkgs.writeScriptBin "dummy-i3status-rust" "";
})
];
test.stubs.i3status-rust = { };
nmt.script = ''
assertFileExists home-files/.config/i3status-rust/config-top.toml

View file

@ -32,9 +32,7 @@ with lib;
};
};
nixpkgs.overlays = [
(self: super: { i3status = pkgs.writeScriptBin "dummy-i3status" ""; })
];
test.stubs.i3status = { };
nmt.script = ''
assertFileContent \

View file

@ -9,9 +9,7 @@ with lib;
enableDefault = true;
};
nixpkgs.overlays = [
(self: super: { i3status = pkgs.writeScriptBin "dummy-i3status" ""; })
];
test.stubs.i3status = { };
nmt.script = ''
assertFileContent \

View file

@ -19,13 +19,12 @@ with lib;
};
};
test.stubs.irsii = { };
nmt.script = ''
assertFileContent \
home-files/.irssi/config \
${./example-settings-expected.config}
'';
nixpkgs.overlays =
[ (self: super: { irsii = pkgs.writeScriptBin "dummy-irsii" ""; }) ];
};
}

View file

@ -30,8 +30,7 @@ with lib;
environment = { LS_COLORS = "1"; };
};
nixpkgs.overlays =
[ (self: super: { kitty = pkgs.writeScriptBin "dummy-kitty" ""; }) ];
test.stubs.kitty = { };
nmt.script = ''
assertFileExists home-files/.config/kitty/kitty.conf

View file

@ -75,8 +75,7 @@ in {
};
};
nixpkgs.overlays =
[ (self: super: { lf = pkgs.writeScriptBin "dummy-lf" ""; }) ];
test.stubs.lf = { };
nmt.script = ''
assertFileExists home-files/.config/lf/lfrc

View file

@ -7,8 +7,7 @@ in {
config = {
programs.lf = { enable = true; };
nixpkgs.overlays =
[ (self: super: { lf = pkgs.writeScriptBin "dummy-lf" ""; }) ];
test.stubs.lf = { };
nmt.script = ''
assertFileExists home-files/.config/lf/lfrc

View file

@ -32,8 +32,7 @@ in {
previewer = { source = pvScript; };
};
nixpkgs.overlays =
[ (self: super: { lf = pkgs.writeScriptBin "dummy-lf" ""; }) ];
test.stubs.lf = { };
nmt.script = ''
assertFileExists home-files/.config/lf/lfrc

View file

@ -7,7 +7,7 @@ with lib;
config = {
programs.lieer.enable = true;
programs.lieer.package = pkgs.writeScriptBin "dummy-gmailieer" "";
programs.lieer.package = config.lib.test.mkStubPackage { };
accounts.email.accounts."hm@example.com" = {
flavor = "gmail.com";

View file

@ -4,7 +4,7 @@
config = {
programs.mangohud = {
enable = true;
package = pkgs.writeScriptBin "dummy-mangohud" "";
package = config.lib.test.mkStubPackage { };
settings = {
output_folder = /home/user/Documents/mangohud;
fps_limit = [ 30 60 ];

View file

@ -29,9 +29,7 @@
defaultProfiles = [ "gpu-hq" ];
};
nixpkgs.overlays = [
(self: super: { mpvDummy = pkgs.runCommandLocal "mpv" { } "mkdir $out"; })
];
test.stubs.mpvDummy = { };
nmt.script = ''
assertFileContent \

View file

@ -22,7 +22,7 @@
touch $out/bin/{,u}mpv $out/Applications/mpv.app/Contents/MacOS/mpv
chmod 755 $out/bin/{,u}mpv $out/Applications/mpv.app/Contents/MacOS/mpv
'';
mpvDummy = pkgs.runCommandLocal "mpv" { } "mkdir $out";
mpvDummy = config.lib.test.mkStubPackage { };
mpvScript =
pkgs.runCommandLocal "mpvScript" { scriptName = "something"; }
"mkdir $out";

View file

@ -7,12 +7,10 @@
services.mpd.enable = true;
services.mpd.musicDirectory = "/home/user/music";
nixpkgs.overlays = [
(self: super: {
ncmpcpp = pkgs.writeScriptBin "dummy-ncmpcpp" "";
mpd = pkgs.writeScriptBin "dummy-mpd" "";
})
];
test.stubs = {
ncmpcpp = { };
mpd = { };
};
nmt.script = ''
assertFileContent \

View file

@ -4,8 +4,7 @@
config = {
programs.ncmpcpp.enable = true;
nixpkgs.overlays =
[ (self: super: { ncmpcpp = pkgs.writeScriptBin "dummy-ncmpcpp" ""; }) ];
test.stubs.ncmpcpp = { };
nmt.script = ''
assertPathNotExists home-files/.config/ncmpcpp/config

View file

@ -44,8 +44,7 @@
];
};
nixpkgs.overlays =
[ (self: super: { ncmpcpp = pkgs.writeScriptBin "dummy-ncmpcpp" ""; }) ];
test.stubs.ncmpcpp = { };
nmt.script = ''
assertFileContent \

View file

@ -19,8 +19,7 @@ in {
automaticPreferences.".default" = autopref;
};
nixpkgs.overlays =
[ (self: super: { ne = pkgs.writeScriptBin "dummy-ne" ""; }) ];
test.stubs.ne = { };
nmt = {
description =

View file

@ -53,8 +53,7 @@ in {
inherit automaticPreferences;
};
nixpkgs.overlays =
[ (self: super: { ne = pkgs.writeScriptBin "dummy-ne" ""; }) ];
test.stubs.ne = { };
nmt = {
description = "Check that configuration files are correctly written";

View file

@ -17,8 +17,7 @@ with lib;
programs.neomutt.enable = true;
programs.neomutt.changeFolderWhenSourcingAccount = false;
nixpkgs.overlays =
[ (self: super: { neomutt = pkgs.writeScriptBin "dummy-neomutt" ""; }) ];
test.stubs.neomutt = { };
nmt.script = ''
assertFileExists home-files/.config/neomutt/hm@example.com

View file

@ -13,8 +13,7 @@ with lib;
programs.neomutt.enable = true;
nixpkgs.overlays =
[ (self: super: { neomutt = pkgs.writeScriptBin "dummy-neomutt" ""; }) ];
test.stubs.neomutt = { };
nmt.script = ''
assertFileExists home-files/.config/neomutt/neomuttrc

View file

@ -50,8 +50,7 @@ with lib;
];
};
nixpkgs.overlays =
[ (self: super: { neomutt = pkgs.writeScriptBin "dummy-neomutt" ""; }) ];
test.stubs.neomutt = { };
test.asserts.warnings.expected = [
"Specifying 'programs.neomutt.(binds|macros).map' as a string is deprecated, use a list of strings instead. See https://github.com/nix-community/home-manager/pull/1885."

View file

@ -50,8 +50,7 @@ with lib;
];
};
nixpkgs.overlays =
[ (self: super: { neomutt = pkgs.writeScriptBin "dummy-neomutt" ""; }) ];
test.stubs.neomutt = { };
nmt.script = ''
assertFileExists home-files/.config/neomutt/neomuttrc

View file

@ -16,8 +16,7 @@ with lib; {
programs.neomutt.enable = true;
nixpkgs.overlays =
[ (self: super: { neomutt = pkgs.writeScriptBin "dummy-neomutt" ""; }) ];
test.stubs.neomutt = { };
nmt.script = ''
assertFileExists home-files/.config/neomutt/neomuttrc

View file

@ -21,8 +21,7 @@ with lib;
programs.neomutt.enable = true;
nixpkgs.overlays =
[ (self: super: { neomutt = pkgs.writeScriptBin "dummy-neomutt" ""; }) ];
test.stubs.neomutt = { };
nmt.script = ''
assertFileExists home-files/.config/neomutt/neomuttrc

View file

@ -33,8 +33,7 @@ with lib;
vimKeys = false;
};
nixpkgs.overlays =
[ (self: super: { neomutt = pkgs.writeScriptBin "dummy-neomutt" ""; }) ];
test.stubs.neomutt = { };
nmt.script = ''
assertFileExists home-files/.config/neomutt/neomuttrc

View file

@ -24,8 +24,7 @@ with lib;
vimKeys = false;
};
nixpkgs.overlays =
[ (self: super: { neomutt = pkgs.writeScriptBin "dummy-neomutt" ""; }) ];
test.stubs.neomutt = { };
nmt.script = ''
assertFileExists home-files/.config/neomutt/neomuttrc

View file

@ -22,9 +22,7 @@ with lib;
queries = { "foo" = ''rssurl =~ "example.com"''; };
};
nixpkgs.overlays = [
(self: super: { newsboat = pkgs.writeScriptBin "dummy-newsboat" ""; })
];
test.stubs.newsboat = { };
nmt.script = ''
assertFileContent \

View file

@ -22,9 +22,7 @@ with lib;
queries = { "foo" = ''rssurl =~ "example.com"''; };
};
nixpkgs.overlays = [
(self: super: { newsboat = pkgs.writeScriptBin "dummy-newsboat" ""; })
];
test.stubs.newsboat = { };
# The format didn't change since 20.03, just the location.
nmt.script = ''

View file

@ -20,9 +20,7 @@ with lib;
queries = { "foo" = ''rssurl =~ "example.com"''; };
};
nixpkgs.overlays = [
(self: super: { newsboat = pkgs.writeScriptBin "dummy-newsboat" ""; })
];
test.stubs.newsboat = { };
nmt.script = ''
assertFileContent \

View file

@ -12,14 +12,10 @@
xdg.dataFile."fish/home-manager_generated_completions".source =
lib.mkForce (builtins.toFile "empty" "");
nixpkgs.overlays = [
(self: super:
let dummy = pkgs.writeScriptBin "dummy" "";
in {
zsh = dummy;
fish = dummy;
})
];
test.stubs = {
zsh = { };
fish = { };
};
programs.nix-index.enable = true;

View file

@ -16,14 +16,10 @@ in {
xdg.dataFile."fish/home-manager_generated_completions".source =
lib.mkForce (builtins.toFile "empty" "");
nixpkgs.overlays = [
(self: super:
let dummy = pkgs.writeScriptBin "dummy" "";
in {
zsh = dummy;
fish = dummy;
})
];
test.stubs = {
zsh = { };
fish = { };
};
programs.nix-index.enable = true;

View file

@ -22,8 +22,7 @@ with lib;
];
};
nixpkgs.overlays =
[ (self: super: { nushell = pkgs.writeScriptBin "dummy-nushell" ""; }) ];
test.stubs.nushell = { };
nmt.script = ''
assertFileContent \

View file

@ -18,8 +18,7 @@ with lib;
};
};
nixpkgs.overlays =
[ (self: super: { powerline-go = pkgs.writeScriptBin "dummy-pkg" ""; }) ];
test.stubs.powerline-go = { };
nmt.script = ''
assertFileExists home-files/.bashrc

View file

@ -22,14 +22,10 @@ with lib;
xdg.dataFile."fish/home-manager_generated_completions".source =
mkForce (builtins.toFile "empty" "");
nixpkgs.overlays = [
(self: super:
let dummy = pkgs.writeScriptBin "dummy" "";
in {
powerline-go = dummy;
fish = dummy;
})
];
test.stubs = {
powerline-go = { };
fish = { };
};
nmt.script = ''
assertFileExists home-files/.config/fish/config.fish

View file

@ -18,12 +18,10 @@ with lib;
};
};
nixpkgs.overlays = [
(self: super: {
powerline-go = pkgs.writeScriptBin "dummy-pkg" "";
zsh = pkgs.writeScriptBin "dummy-pkg" "";
})
];
test.stubs = {
powerline-go = { };
zsh = { };
};
nmt.script = ''
assertFileExists home-files/.zshrc

View file

@ -18,11 +18,7 @@ with lib;
};
};
nixpkgs.overlays = [
(self: super: {
qutebrowser = pkgs.writeScriptBin "dummy-qutebrowser" "";
})
];
test.stubs.qutebrowser = { };
nmt.script = let
qutebrowserConfig = if pkgs.stdenv.hostPlatform.isDarwin then

View file

@ -13,11 +13,7 @@ with lib;
};
};
nixpkgs.overlays = [
(self: super: {
qutebrowser = pkgs.writeScriptBin "dummy-qutebrowser" "";
})
];
test.stubs.qutebrowser = { };
nmt.script = let
quickmarksFile = if pkgs.stdenv.hostPlatform.isDarwin then

View file

@ -24,11 +24,7 @@ with lib;
'';
};
nixpkgs.overlays = [
(self: super: {
qutebrowser = pkgs.writeScriptBin "dummy-qutebrowser" "";
})
];
test.stubs.qutebrowser = { };
nmt.script = let
qutebrowserConfig = if pkgs.stdenv.hostPlatform.isDarwin then

View file

@ -1,4 +1,5 @@
{ pkgs, ... }:
let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
@ -7,13 +8,11 @@ let
else
".config/rbw/config.json";
in {
config = {
programs.rbw.enable = true;
imports = [ ./rbw-stubs.nix ];
nixpkgs.overlays = [ (import ./overlay.nix) ];
programs.rbw.enable = true;
nmt.script = ''
assertPathNotExists home-files/${path}
'';
};
}

View file

@ -1,12 +0,0 @@
self: super: {
rbw = self.writeScriptBin "dummy-rbw" "";
pinentry = {
gnome3 = self.writeScriptBin "pinentry-gnome3" "" // {
outPath = "@pinentry-gnome3@";
};
gtk2 = self.writeScriptBin "pinentry-gtk2" "" // {
outPath = "@pinentry-gtk2@";
};
flavors = [ "gnome3" "gtk2" ];
};
}

View file

@ -0,0 +1,16 @@
{ config, ... }:
{
test.stubs.rbw = { };
nixpkgs.overlays = [
(self: super: {
pinentry = {
gnome3 =
config.lib.test.mkStubPackage { outPath = "@pinentry-gnome3@"; };
gtk2 = config.lib.test.mkStubPackage { outPath = "@pinentry-gtk2@"; };
flavors = [ "gnome3" "gtk2" ];
};
})
];
}

View file

@ -1,4 +1,5 @@
{ pkgs, ... }:
let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
@ -17,7 +18,8 @@ let
}
'';
in {
config = {
imports = [ ./rbw-stubs.nix ];
programs.rbw = {
enable = true;
settings = {
@ -29,11 +31,8 @@ in {
};
};
nixpkgs.overlays = [ (import ./overlay.nix) ];
nmt.script = ''
assertFileExists home-files/${path}
assertFileContent home-files/${path} '${expected}'
'';
};
}

View file

@ -1,4 +1,5 @@
{ pkgs, ... }:
let
inherit (pkgs.stdenv.hostPlatform) isDarwin;
@ -17,17 +18,15 @@ let
}
'';
in {
config = {
imports = [ ./rbw-stubs.nix ];
programs.rbw = {
enable = true;
settings = { email = "name@example.com"; };
};
nixpkgs.overlays = [ (import ./overlay.nix) ];
nmt.script = ''
assertFileExists home-files/${path}
assertFileContent home-files/${path} '${expected}'
'';
};
}

View file

@ -16,14 +16,10 @@ with lib;
};
};
nixpkgs.overlays = [
(self: super:
let dummy = pkgs.writeScriptBin "dummy" "";
in {
rofi = dummy;
rofi-pass = dummy;
})
];
test.stubs = {
rofi = { };
rofi-pass = { };
};
nmt.script = ''
assertFileContent \

View file

@ -13,14 +13,10 @@ with lib;
};
};
nixpkgs.overlays = [
(self: super:
let dummy = pkgs.writeScriptBin "dummy" "";
in {
rofi = dummy;
rofi-pass = dummy;
})
];
test.stubs = {
rofi = { };
rofi-pass = { };
};
nmt.script = ''
assertFileContent \

View file

@ -17,8 +17,7 @@ with lib;
};
};
nixpkgs.overlays =
[ (self: super: { rofi = pkgs.writeScriptBin "dummy-rofi" ""; }) ];
test.stubs.rofi = { };
test.asserts.assertions.expected = [''
Cannot use the rofi options 'theme' and 'colors' simultaneously.

View file

@ -29,8 +29,7 @@ with lib;
};
};
nixpkgs.overlays =
[ (self: super: { rofi = pkgs.writeScriptBin "dummy-rofi" ""; }) ];
test.stubs.rofi = { };
nmt.script = ''
assertFileContent \

View file

@ -48,8 +48,7 @@ with lib;
};
};
nixpkgs.overlays =
[ (self: super: { rofi = pkgs.writeScriptBin "dummy-rofi" ""; }) ];
test.stubs.rofi = { };
nmt.script = ''
assertFileContent \

View file

@ -10,8 +10,7 @@
zsh.enable = true;
};
nixpkgs.overlays =
[ (self: super: { zsh = pkgs.writeScriptBin "dummy" ""; }) ];
test.stubs.zsh = { };
nmt.script = ''
assertFileNotRegex home-files/.zshrc '${pkgs.scmpuff} init -s'

View file

@ -8,8 +8,7 @@
zsh.enable = true;
};
nixpkgs.overlays =
[ (self: super: { zsh = pkgs.writeScriptBin "dummy" ""; }) ];
test.stubs.zsh = { };
nmt.script = ''
assertFileNotRegex home-files/.zshrc '${pkgs.scmpuff} init -s'

View file

@ -5,8 +5,7 @@
zsh.enable = true;
};
nixpkgs.overlays =
[ (self: super: { zsh = pkgs.writeScriptBin "dummy" ""; }) ];
test.stubs.zsh = { };
nmt.script = ''
assertFileExists home-files/.zshrc

View file

@ -39,8 +39,7 @@ with lib;
};
};
nixpkgs.overlays =
[ (self: super: { sm64ex = pkgs.writeScriptBin "dummy-sm64ex" ""; }) ];
test.stubs.sm64ex = { };
nmt.script = ''
assertFileContent \

View file

@ -44,9 +44,7 @@ with lib;
];
};
nixpkgs.overlays = [
(self: super: { starship = pkgs.writeScriptBin "dummy-starship" ""; })
];
test.stubs.starship = { };
nmt.script = ''
assertFileContent \

View file

@ -8,8 +8,7 @@
};
};
nixpkgs.overlays =
[ (self: super: { terminator = pkgs.writeScriptBin "dummy" ""; }) ];
test.stubs.terminator = { };
nmt.script = ''
assertFileContent home-files/.config/terminator/config ${

View file

@ -25,9 +25,7 @@ with lib;
];
};
nixpkgs.overlays = [
(self: super: { topgrade = pkgs.writeScriptBin "dummy-topgrade" ""; })
];
test.stubs.topgrade = { };
nmt.script = ''
assertFileContent \

View file

@ -2,12 +2,10 @@
with lib;
let
package = pkgs.writeScriptBin "dummy-waybar" "" // { outPath = "@waybar@"; };
in {
{
config = {
programs.waybar = {
inherit package;
package = config.lib.test.mkStubPackage { outPath = "@waybar@"; };
enable = true;
settings = [{
layer = "top";
@ -41,9 +39,7 @@ in {
format = "hello from {}";
exec = let
dummyScript =
pkgs.writeShellScriptBin "dummy" "echo within waybar" // {
outPath = "@dummy@";
};
config.lib.test.mkStubPackage { outPath = "@dummy@"; };
in "${dummyScript}/bin/dummy";
};
};

View file

@ -2,12 +2,10 @@
with lib;
let
package = pkgs.writeScriptBin "dummy-waybar" "" // { outPath = "@waybar@"; };
in {
{
config = {
programs.waybar = {
inherit package;
package = config.lib.test.mkStubPackage { outPath = "@waybar@"; };
enable = true;
style = ''
* {

View file

@ -2,12 +2,10 @@
with lib;
let
package = pkgs.writeScriptBin "dummy-waybar" "" // { outPath = "@waybar@"; };
in {
{
config = {
programs.waybar = {
inherit package;
package = config.lib.test.mkStubPackage { outPath = "@waybar@"; };
enable = true;
systemd.enable = true;
};

View file

@ -2,12 +2,10 @@
with lib;
let
package = pkgs.writeScriptBin "dummy-waybar" "" // { outPath = "@waybar@"; };
in {
{
config = {
programs.waybar = {
inherit package;
package = config.lib.test.mkStubPackage { outPath = "@waybar@"; };
enable = true;
settings = [{
modules-left = [ "custom/my-module" ];

View file

@ -6,7 +6,7 @@ with lib;
config = {
programs.xmobar = {
enable = true;
package = pkgs.writeScriptBin "dummy" "";
package = config.lib.test.mkStubPackage { };
extraConfig = ''
Config
{ font = "Fira Code"

View file

@ -21,16 +21,14 @@ with lib;
};
};
nixpkgs.overlays = [
(self: super: {
zsh = pkgs.writeScriptBin "dummy-zsh" "";
zplug = pkgs.writeScriptBin "dummy-zplug" "";
})
];
test.stubs = {
zplug = { };
zsh = { };
};
nmt.script = ''
assertFileRegex home-files/.zshrc \
'^source ${builtins.storeDir}/.*zplug.*/init\.zsh$'
assertFileContains home-files/.zshrc \
'source @zplug@/init.zsh'
assertFileContains home-files/.zshrc \
'zplug "plugins/git", from:oh-my-zsh'

Some files were not shown because too many files have changed in this diff Show more