aboutsummaryrefslogtreecommitdiff
path: root/tests/modules/programs
diff options
context:
space:
mode:
authorRobert Helgesson <robert@rycee.net>2019-10-08 22:46:27 +0200
committerRobert Helgesson <robert@rycee.net>2019-10-26 13:07:04 +0200
commit797c77a00a50009239bc2b6576283e49fbd63b40 (patch)
tree65acc73e31053e429cc390ae4e356530857c80b4 /tests/modules/programs
parenta177d0282fbb6af0668b63fba3dfb74cb25f3178 (diff)
tests: reduce number of downloads
This replaces some derivation outputs by simple strings rather than full Nix store paths. This removes the need to download the whole derivation when all we need is a static string.
Diffstat (limited to 'tests/modules/programs')
-rw-r--r--tests/modules/programs/alacritty/empty-settings.nix6
-rw-r--r--tests/modules/programs/alacritty/example-settings.nix6
-rw-r--r--tests/modules/programs/bash/session-variables-expected.txt2
-rw-r--r--tests/modules/programs/bash/session-variables.nix9
-rw-r--r--tests/modules/programs/firefox/profile-settings.nix18
-rw-r--r--tests/modules/programs/firefox/state-version-19_09.nix18
-rw-r--r--tests/modules/programs/git-with-email.nix1
-rw-r--r--tests/modules/programs/git-with-str-extra-config.nix3
-rw-r--r--tests/modules/programs/git.nix1
-rw-r--r--tests/modules/programs/gpg/override-defaults.nix6
-rw-r--r--tests/modules/programs/tmux/disable-confirmation-prompt.nix24
-rw-r--r--tests/modules/programs/tmux/emacs-with-plugins.conf6
-rw-r--r--tests/modules/programs/tmux/emacs-with-plugins.nix38
-rw-r--r--tests/modules/programs/tmux/vi-all-true.nix23
-rw-r--r--tests/modules/programs/zsh/session-variables.nix8
15 files changed, 119 insertions, 50 deletions
diff --git a/tests/modules/programs/alacritty/empty-settings.nix b/tests/modules/programs/alacritty/empty-settings.nix
index f3f8486ad3d..5fd2792a88e 100644
--- a/tests/modules/programs/alacritty/empty-settings.nix
+++ b/tests/modules/programs/alacritty/empty-settings.nix
@@ -6,6 +6,12 @@ with lib;
config = {
programs.alacritty.enable = true;
+ nixpkgs.overlays = [
+ (self: super: {
+ alacritty = pkgs.writeScriptBin "dummy-alacritty" "";
+ })
+ ];
+
nmt.script = ''
assertPathNotExists home-files/.config/alacritty
'';
diff --git a/tests/modules/programs/alacritty/example-settings.nix b/tests/modules/programs/alacritty/example-settings.nix
index 2c84710d100..0caa80258b1 100644
--- a/tests/modules/programs/alacritty/example-settings.nix
+++ b/tests/modules/programs/alacritty/example-settings.nix
@@ -23,6 +23,12 @@ with lib;
};
};
+ nixpkgs.overlays = [
+ (self: super: {
+ alacritty = pkgs.writeScriptBin "dummy-alacritty" "";
+ })
+ ];
+
nmt.script = ''
assertFileContent \
home-files/.config/alacritty/alacritty.yml \
diff --git a/tests/modules/programs/bash/session-variables-expected.txt b/tests/modules/programs/bash/session-variables-expected.txt
index c586477ec4d..e13d63d4c78 100644
--- a/tests/modules/programs/bash/session-variables-expected.txt
+++ b/tests/modules/programs/bash/session-variables-expected.txt
@@ -1,6 +1,6 @@
# -*- mode: sh -*-
-. "@homeDirectory@/.nix-profile/etc/profile.d/hm-session-vars.sh"
+. "/home/testuser/.nix-profile/etc/profile.d/hm-session-vars.sh"
export V1="v1"
export V2="v2-v1"
diff --git a/tests/modules/programs/bash/session-variables.nix b/tests/modules/programs/bash/session-variables.nix
index a7a69a2a1f8..ea789a1d061 100644
--- a/tests/modules/programs/bash/session-variables.nix
+++ b/tests/modules/programs/bash/session-variables.nix
@@ -13,16 +13,13 @@ with lib;
};
};
+ home.homeDirectory = "/home/testuser";
+
nmt.script = ''
assertFileExists home-files/.profile
assertFileContent \
home-files/.profile \
- ${
- pkgs.substituteAll {
- src = ./session-variables-expected.txt;
- inherit (config.home) homeDirectory;
- }
- }
+ ${./session-variables-expected.txt}
'';
};
}
diff --git a/tests/modules/programs/firefox/profile-settings.nix b/tests/modules/programs/firefox/profile-settings.nix
index 45465b1d0bf..f1e9be92795 100644
--- a/tests/modules/programs/firefox/profile-settings.nix
+++ b/tests/modules/programs/firefox/profile-settings.nix
@@ -11,6 +11,24 @@ with lib;
};
};
+ nixpkgs.overlays = [
+ (self: super: {
+ firefox-unwrapped =
+ pkgs.runCommand
+ "firefox-0"
+ {
+ meta.description = "I pretend to be Firefox";
+ preferLocalBuild = true;
+ allowSubstitutes = false;
+ }
+ ''
+ mkdir -p "$out/bin"
+ touch "$out/bin/firefox"
+ chmod 755 "$out/bin/firefox"
+ '';
+ })
+ ];
+
nmt.script = ''
assertFileRegex \
home-path/bin/firefox \
diff --git a/tests/modules/programs/firefox/state-version-19_09.nix b/tests/modules/programs/firefox/state-version-19_09.nix
index 0c93096190e..4d65d7a7b5e 100644
--- a/tests/modules/programs/firefox/state-version-19_09.nix
+++ b/tests/modules/programs/firefox/state-version-19_09.nix
@@ -8,6 +8,24 @@ with lib;
programs.firefox.enable = true;
+ nixpkgs.overlays = [
+ (self: super: {
+ firefox-unwrapped =
+ pkgs.runCommand
+ "firefox-0"
+ {
+ meta.description = "I pretend to be Firefox";
+ preferLocalBuild = true;
+ allowSubstitutes = false;
+ }
+ ''
+ mkdir -p "$out/bin"
+ touch "$out/bin/firefox"
+ chmod 755 "$out/bin/firefox"
+ '';
+ })
+ ];
+
nmt.script = ''
assertFileRegex \
home-path/bin/firefox \
diff --git a/tests/modules/programs/git-with-email.nix b/tests/modules/programs/git-with-email.nix
index f8a762dcceb..a7107aa826e 100644
--- a/tests/modules/programs/git-with-email.nix
+++ b/tests/modules/programs/git-with-email.nix
@@ -8,6 +8,7 @@ with lib;
config = {
programs.git = {
enable = true;
+ package = pkgs.gitMinimal;
userEmail = "hm@example.com";
userName = "H. M. Test";
};
diff --git a/tests/modules/programs/git-with-str-extra-config.nix b/tests/modules/programs/git-with-str-extra-config.nix
index 734c5ee764c..3dbc497a5ea 100644
--- a/tests/modules/programs/git-with-str-extra-config.nix
+++ b/tests/modules/programs/git-with-str-extra-config.nix
@@ -1,4 +1,4 @@
-{ config, lib, ... }:
+{ config, lib, pkgs, ... }:
with lib;
@@ -6,6 +6,7 @@ with lib;
config = {
programs.git = {
enable = true;
+ package = pkgs.gitMinimal;
extraConfig = ''
This can be anything.
'';
diff --git a/tests/modules/programs/git.nix b/tests/modules/programs/git.nix
index c5203e417dc..3a84bf77a73 100644
--- a/tests/modules/programs/git.nix
+++ b/tests/modules/programs/git.nix
@@ -24,6 +24,7 @@ in
programs.git = mkMerge [
{
enable = true;
+ package = pkgs.gitMinimal;
aliases = {
a1 = "foo";
a2 = "bar";
diff --git a/tests/modules/programs/gpg/override-defaults.nix b/tests/modules/programs/gpg/override-defaults.nix
index 850334dc589..96234d0da4f 100644
--- a/tests/modules/programs/gpg/override-defaults.nix
+++ b/tests/modules/programs/gpg/override-defaults.nix
@@ -14,6 +14,12 @@ with lib;
};
};
+ nixpkgs.overlays = [
+ (self: super: {
+ gnupg = pkgs.writeScriptBin "dummy-gnupg" "";
+ })
+ ];
+
nmt.script = ''
assertFileExists home-files/.gnupg/gpg.conf
assertFileContent home-files/.gnupg/gpg.conf ${./override-defaults-expected.conf}
diff --git a/tests/modules/programs/tmux/disable-confirmation-prompt.nix b/tests/modules/programs/tmux/disable-confirmation-prompt.nix
index 82c53438b00..e3d13a4b1b2 100644
--- a/tests/modules/programs/tmux/disable-confirmation-prompt.nix
+++ b/tests/modules/programs/tmux/disable-confirmation-prompt.nix
@@ -2,27 +2,27 @@
with lib;
-let
-
- substituteExpected = path: pkgs.substituteAll {
- src = path;
-
- sensible_rtp = pkgs.tmuxPlugins.sensible.rtp;
- };
-
-in
-
{
config = {
programs.tmux = {
enable = true;
disableConfirmationPrompt = true;
};
-
+
+ nixpkgs.overlays = [
+ (self: super: {
+ tmuxPlugins = super.tmuxPlugins // {
+ sensible = super.tmuxPlugins.sensible // {
+ rtp = "@sensible_rtp@";
+ };
+ };
+ })
+ ];
+
nmt.script = ''
assertFileExists home-files/.tmux.conf
assertFileContent home-files/.tmux.conf \
- ${substituteExpected ./disable-confirmation-prompt.conf}
+ ${./disable-confirmation-prompt.conf}
'';
};
}
diff --git a/tests/modules/programs/tmux/emacs-with-plugins.conf b/tests/modules/programs/tmux/emacs-with-plugins.conf
index b047c97a766..66b10183750 100644
--- a/tests/modules/programs/tmux/emacs-with-plugins.conf
+++ b/tests/modules/programs/tmux/emacs-with-plugins.conf
@@ -37,18 +37,18 @@ set -g history-limit 2000
# tmuxplugin-logging
# ---------------------
-run-shell @tmuxplugin_logging@/share/tmux-plugins/logging/logging.tmux
+run-shell @tmuxplugin_logging_rtp@
# tmuxplugin-prefix-highlight
# ---------------------
-run-shell @tmuxplugin_prefix_highlight@/share/tmux-plugins/prefix-highlight/prefix_highlight.tmux
+run-shell @tmuxplugin_prefix_highlight_rtp@
# tmuxplugin-fzf-tmux-url
# ---------------------
-run-shell @tmuxplugin_fzf_tmux_url@/share/tmux-plugins/fzf-tmux-url/fzf-url.tmux
+run-shell @tmuxplugin_fzf_tmux_url_rtp@
# ============================================= #
diff --git a/tests/modules/programs/tmux/emacs-with-plugins.nix b/tests/modules/programs/tmux/emacs-with-plugins.nix
index 5e147b7290e..f9bccaa2ce4 100644
--- a/tests/modules/programs/tmux/emacs-with-plugins.nix
+++ b/tests/modules/programs/tmux/emacs-with-plugins.nix
@@ -2,19 +2,6 @@
with lib;
-let
-
- substituteExpected = path: pkgs.substituteAll {
- src = path;
-
- tmuxplugin_fzf_tmux_url = pkgs.tmuxPlugins.fzf-tmux-url;
- tmuxplugin_logging = pkgs.tmuxPlugins.logging;
- tmuxplugin_prefix_highlight = pkgs.tmuxPlugins.prefix-highlight;
- tmuxplugin_sensible_rtp = pkgs.tmuxPlugins.sensible.rtp;
- };
-
-in
-
{
config = {
programs.tmux = {
@@ -32,10 +19,31 @@ in
];
};
+ nixpkgs.overlays = [
+ (self: super: {
+ tmuxPlugins = super.tmuxPlugins // {
+ fzf-tmux-url = super.tmuxPlugins.fzf-tmux-url // {
+ rtp = "@tmuxplugin_fzf_tmux_url_rtp@";
+ };
+
+ logging = super.tmuxPlugins.logging // {
+ rtp = "@tmuxplugin_logging_rtp@";
+ };
+
+ prefix-highlight = super.tmuxPlugins.prefix-highlight // {
+ rtp = "@tmuxplugin_prefix_highlight_rtp@";
+ };
+
+ sensible = super.tmuxPlugins.sensible // {
+ rtp = "@tmuxplugin_sensible_rtp@";
+ };
+ };
+ })
+ ];
+
nmt.script = ''
assertFileExists home-files/.tmux.conf
- assertFileContent home-files/.tmux.conf \
- ${substituteExpected ./emacs-with-plugins.conf}
+ assertFileContent home-files/.tmux.conf ${./emacs-with-plugins.conf}
'';
};
}
diff --git a/tests/modules/programs/tmux/vi-all-true.nix b/tests/modules/programs/tmux/vi-all-true.nix
index e88ed587c03..70787128a8d 100644
--- a/tests/modules/programs/tmux/vi-all-true.nix
+++ b/tests/modules/programs/tmux/vi-all-true.nix
@@ -2,15 +2,7 @@
with lib;
-let
-
- substituteExpected = path: pkgs.substituteAll {
- src = path;
-
- sensible_rtp = pkgs.tmuxPlugins.sensible.rtp;
- };
-
-in {
+{
config = {
programs.tmux = {
aggressiveResize = true;
@@ -21,10 +13,19 @@ in {
reverseSplit = true;
};
+ nixpkgs.overlays = [
+ (self: super: {
+ tmuxPlugins = super.tmuxPlugins // {
+ sensible = super.tmuxPlugins.sensible // {
+ rtp = "@sensible_rtp@";
+ };
+ };
+ })
+ ];
+
nmt.script = ''
assertFileExists home-files/.tmux.conf
- assertFileContent home-files/.tmux.conf \
- ${substituteExpected ./vi-all-true.conf}
+ assertFileContent home-files/.tmux.conf ${./vi-all-true.conf}
'';
};
}
diff --git a/tests/modules/programs/zsh/session-variables.nix b/tests/modules/programs/zsh/session-variables.nix
index a87d39820cf..ca903619d68 100644
--- a/tests/modules/programs/zsh/session-variables.nix
+++ b/tests/modules/programs/zsh/session-variables.nix
@@ -1,4 +1,4 @@
-{ config, lib, ... }:
+{ config, lib, pkgs, ... }:
with lib;
@@ -13,6 +13,12 @@ with lib;
};
};
+ nixpkgs.overlays = [
+ (self: super: {
+ zsh = pkgs.writeScriptBin "dummy-zsh" "";
+ })
+ ];
+
nmt.script = ''
assertFileExists home-files/.zshrc
assertFileRegex home-files/.zshrc 'export V1="v1"'