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.
main
Robert Helgesson 3 years ago
parent b0651cc217
commit cb09a968e9
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
  1. 14
      tests/default.nix
  2. 17
      tests/modules/i18n/input-method/fcitx5-configuration.nix
  3. 22
      tests/modules/i18n/input-method/fcitx5-overlay.nix
  4. 27
      tests/modules/i18n/input-method/fcitx5-stubs.nix
  5. 2
      tests/modules/misc/gtk/gtk2-basic-config.nix
  6. 2
      tests/modules/misc/gtk/gtk2-config-file-location.nix
  7. 4
      tests/modules/misc/numlock/numlock.nix
  8. 8
      tests/modules/misc/qt/qt-platform-theme-gnome.nix
  9. 3
      tests/modules/programs/abook/no-settings.nix
  10. 3
      tests/modules/programs/abook/with-settings.nix
  11. 4
      tests/modules/programs/alacritty/empty-settings.nix
  12. 2
      tests/modules/programs/alacritty/example-settings.nix
  13. 2
      tests/modules/programs/alacritty/settings-merging.nix
  14. 3
      tests/modules/programs/alot/alot.nix
  15. 3
      tests/modules/programs/aria2/settings.nix
  16. 4
      tests/modules/programs/autojump/default-settings.nix
  17. 2
      tests/modules/programs/autorandr/basic-configuration.nix
  18. 2
      tests/modules/programs/autorandr/scale.nix
  19. 3
      tests/modules/programs/bat/bat.nix
  20. 2
      tests/modules/programs/bottom/empty-settings.nix
  21. 2
      tests/modules/programs/bottom/example-settings.nix
  22. 3
      tests/modules/programs/broot/broot.nix
  23. 3
      tests/modules/programs/feh/feh-bindings.nix
  24. 3
      tests/modules/programs/feh/feh-empty-settings.nix
  25. 3
      tests/modules/programs/fish/functions.nix
  26. 3
      tests/modules/programs/fish/no-functions.nix
  27. 3
      tests/modules/programs/fish/plugins.nix
  28. 3
      tests/modules/programs/foot/empty-settings.nix
  29. 2
      tests/modules/programs/foot/example-settings.nix
  30. 6
      tests/modules/programs/foot/systemd-user-service.nix
  31. 3
      tests/modules/programs/gh/config-file.nix
  32. 12
      tests/modules/programs/git/git.nix
  33. 15
      tests/modules/programs/gnome-terminal/gnome-terminal-1.nix
  34. 43
      tests/modules/programs/himalaya/himalaya.nix
  35. 3
      tests/modules/programs/htop/empty-settings.nix
  36. 3
      tests/modules/programs/htop/example-settings.nix
  37. 3
      tests/modules/programs/htop/settings-without-fields.nix
  38. 6
      tests/modules/programs/i3status-rust/with-custom.nix
  39. 6
      tests/modules/programs/i3status-rust/with-default.nix
  40. 6
      tests/modules/programs/i3status-rust/with-extra-settings.nix
  41. 6
      tests/modules/programs/i3status-rust/with-multiple-bars.nix
  42. 4
      tests/modules/programs/i3status/with-custom.nix
  43. 4
      tests/modules/programs/i3status/with-default.nix
  44. 5
      tests/modules/programs/irsii/example-settings.nix
  45. 3
      tests/modules/programs/kitty/example-settings.nix
  46. 3
      tests/modules/programs/lf/all-options.nix
  47. 3
      tests/modules/programs/lf/minimal-options.nix
  48. 3
      tests/modules/programs/lf/no-pv-keybind.nix
  49. 2
      tests/modules/programs/lieer/lieer.nix
  50. 2
      tests/modules/programs/mangohud/basic-configuration.nix
  51. 4
      tests/modules/programs/mpv/mpv-example-settings.nix
  52. 2
      tests/modules/programs/mpv/mpv-invalid-settings.nix
  53. 10
      tests/modules/programs/ncmpcpp-linux/ncmpcpp-use-mpd-config.nix
  54. 3
      tests/modules/programs/ncmpcpp/ncmpcpp-empty-settings.nix
  55. 3
      tests/modules/programs/ncmpcpp/ncmpcpp-example-settings.nix
  56. 3
      tests/modules/programs/ne/defprefs.nix
  57. 3
      tests/modules/programs/ne/passthroughs.nix
  58. 3
      tests/modules/programs/neomutt/neomutt-no-folder-change.nix
  59. 3
      tests/modules/programs/neomutt/neomutt-not-primary.nix
  60. 3
      tests/modules/programs/neomutt/neomutt-with-binds-with-warning.nix
  61. 3
      tests/modules/programs/neomutt/neomutt-with-binds.nix
  62. 3
      tests/modules/programs/neomutt/neomutt-with-gpg.nix
  63. 3
      tests/modules/programs/neomutt/neomutt-with-msmtp.nix
  64. 3
      tests/modules/programs/neomutt/neomutt-with-named-mailboxes.nix
  65. 3
      tests/modules/programs/neomutt/neomutt.nix
  66. 4
      tests/modules/programs/newsboat/newsboat-basics-2003.nix
  67. 4
      tests/modules/programs/newsboat/newsboat-basics-2105.nix
  68. 4
      tests/modules/programs/newsboat/newsboat-basics.nix
  69. 12
      tests/modules/programs/nix-index/assert-on-command-not-found.nix
  70. 12
      tests/modules/programs/nix-index/integrations.nix
  71. 3
      tests/modules/programs/nushell/settings.nix
  72. 3
      tests/modules/programs/powerline-go/bash.nix
  73. 12
      tests/modules/programs/powerline-go/fish.nix
  74. 10
      tests/modules/programs/powerline-go/zsh.nix
  75. 6
      tests/modules/programs/qutebrowser/keybindings.nix
  76. 6
      tests/modules/programs/qutebrowser/quickmarks.nix
  77. 6
      tests/modules/programs/qutebrowser/settings.nix
  78. 13
      tests/modules/programs/rbw/empty-settings.nix
  79. 12
      tests/modules/programs/rbw/overlay.nix
  80. 16
      tests/modules/programs/rbw/rbw-stubs.nix
  81. 33
      tests/modules/programs/rbw/settings.nix
  82. 21
      tests/modules/programs/rbw/simple-settings.nix
  83. 12
      tests/modules/programs/rofi-pass/rofi-pass-config.nix
  84. 12
      tests/modules/programs/rofi-pass/rofi-pass-root.nix
  85. 3
      tests/modules/programs/rofi/assert-on-both-theme-and-colors.nix
  86. 3
      tests/modules/programs/rofi/custom-theme.nix
  87. 3
      tests/modules/programs/rofi/valid-config.nix
  88. 3
      tests/modules/programs/scmpuff/no-shell.nix
  89. 3
      tests/modules/programs/scmpuff/no-zsh.nix
  90. 3
      tests/modules/programs/scmpuff/zsh.nix
  91. 3
      tests/modules/programs/sm64ex/settings.nix
  92. 4
      tests/modules/programs/starship/settings.nix
  93. 3
      tests/modules/programs/terminator/config-file.nix
  94. 4
      tests/modules/programs/topgrade/settings.nix
  95. 10
      tests/modules/programs/waybar/settings-complex.nix
  96. 6
      tests/modules/programs/waybar/styling.nix
  97. 6
      tests/modules/programs/waybar/systemd-with-graphical-session-target.nix
  98. 6
      tests/modules/programs/waybar/warnings-tests.nix
  99. 2
      tests/modules/programs/xmobar/basic-configuration.nix
  100. 14
      tests/modules/programs/zplug/modules.nix
  101. Some files were not shown because too many files have changed in this diff Show More

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -5,34 +5,31 @@ with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ];
config = {
accounts.email.accounts = {
"hm@example.com" = {
himalaya = {
enable = true;
accounts.email.accounts = {
"hm@example.com" = {
himalaya = {
enable = true;
settings = { default-page-size = 50; };
};
imap.port = 995;
smtp.port = 465;
settings = { default-page-size = 50; };
};
};
programs.himalaya = {
enable = true;
settings = { downloads-dir = "/data/download"; };
imap.port = 995;
smtp.port = 465;
};
};
nixpkgs.overlays =
[ (self: super: { himalaya = pkgs.writeScriptBin "dummy-alot" ""; }) ];
nmt.script = ''
assertFileExists home-files/.config/himalaya/config.toml
assertFileContent home-files/.config/himalaya/config.toml ${
./himalaya-expected.toml
}
'';
programs.himalaya = {
enable = true;
settings = { downloads-dir = "/data/download"; };
};
test.stubs.himalaya = { };
nmt.script = ''
assertFileExists home-files/.config/himalaya/config.toml
assertFileContent home-files/.config/himalaya/config.toml ${
./himalaya-expected.toml
}
'';
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -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}
'';
};
nmt.script = ''
assertPathNotExists home-files/${path}
'';
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -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 = ''
* {

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

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

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

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

Loading…
Cancel
Save