mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-22 10:19:39 +01:00
tests: rework derivation stubbing
Instead of having to manually stub packages that should not be downloaded we instead automatically stub all packages (except a small list of whitelisted ones). Tests can re-introduce the real package by using the `realPkgs` module argument.
This commit is contained in:
parent
c5c2cbc866
commit
7a3f0b3b8d
480 changed files with 3557 additions and 5511 deletions
|
|
@ -9,13 +9,86 @@ let
|
|||
sha256 = "0qhn7nnwdwzh910ss78ga2d00v42b0lspfd7ybl61mpfgz3lmdcj";
|
||||
};
|
||||
|
||||
# Recursively replace each derivation in the given attribute set with the same
|
||||
# derivation but with the `outPath` attribute set to the string
|
||||
# `"@package-name@"`. This allows the tests to refer to derivations through
|
||||
# their values without establishing an actual dependency on the derivation
|
||||
# output.
|
||||
scrubDerivations = attrs:
|
||||
let
|
||||
scrubDerivation = name: value:
|
||||
let
|
||||
scrubbedValue = scrubDerivations value;
|
||||
|
||||
newDrvAttrs = {
|
||||
buildScript = abort "no build allowed";
|
||||
|
||||
outPath = builtins.traceVerbose ("${name} - got out path")
|
||||
"@${lib.getName value}@";
|
||||
|
||||
# Prevent getOutput from descending into outputs
|
||||
outputSpecified = true;
|
||||
|
||||
# Allow the original package to be used in derivation inputs
|
||||
__spliced = {
|
||||
buildHost = value;
|
||||
hostTarget = value;
|
||||
};
|
||||
};
|
||||
in if lib.isAttrs value then
|
||||
if lib.isDerivation value then
|
||||
scrubbedValue // newDrvAttrs
|
||||
else
|
||||
scrubbedValue
|
||||
else
|
||||
value;
|
||||
in lib.mapAttrs scrubDerivation attrs;
|
||||
|
||||
# Globally unscrub a few selected packages that are used by a wide selection of tests.
|
||||
whitelist = let
|
||||
inner = self: super: {
|
||||
inherit (pkgs)
|
||||
coreutils jq desktop-file-utils diffutils findutils glibcLocales gettext
|
||||
gnugrep gnused shared-mime-info emptyDirectory
|
||||
# Needed by pretty much all tests that have anything to do with fish.
|
||||
babelfish fish;
|
||||
|
||||
xorg =
|
||||
super.xorg.overrideScope (self: super: { inherit (pkgs.xorg) lndir; });
|
||||
};
|
||||
|
||||
outer = self: super:
|
||||
inner self super // {
|
||||
buildPackages = super.buildPackages.extend inner;
|
||||
};
|
||||
in outer;
|
||||
|
||||
scrubbedPkgs =
|
||||
let rawScrubbedPkgs = lib.makeExtensible (final: scrubDerivations pkgs);
|
||||
in builtins.traceVerbose "eval scrubbed nixpkgs"
|
||||
(rawScrubbedPkgs.extend whitelist);
|
||||
|
||||
modules = import ../modules/modules.nix {
|
||||
inherit lib pkgs;
|
||||
check = false;
|
||||
} ++ [{
|
||||
# Bypass <nixpkgs> reference inside modules/modules.nix to make the test
|
||||
# suite more pure.
|
||||
_module.args.pkgsPath = pkgs.path;
|
||||
} ++ [
|
||||
({ config, ... }: {
|
||||
_module.args = {
|
||||
# Prevent the nixpkgs module from working. We want to minimize the number
|
||||
# of evaluations of Nixpkgs.
|
||||
pkgsPath = abort "pkgs path is unavailable in tests";
|
||||
realPkgs = pkgs;
|
||||
pkgs = let
|
||||
overlays = config.test.stubOverlays ++ lib.optionals
|
||||
(config.nixpkgs.overlays != null && config.nixpkgs.overlays != [ ])
|
||||
config.nixpkgs.overlays;
|
||||
stubbedPkgs = if overlays == [ ] then
|
||||
scrubbedPkgs
|
||||
else
|
||||
builtins.traceVerbose "eval overlayed nixpkgs"
|
||||
(lib.foldr (o: p: p.extend o) scrubbedPkgs overlays);
|
||||
in lib.mkImageMediaOverride stubbedPkgs;
|
||||
};
|
||||
|
||||
# Fix impurities. Without these some of the user's environment
|
||||
# will leak into the tests through `builtins.getEnv`.
|
||||
|
|
@ -33,7 +106,8 @@ let
|
|||
imports = [ ./asserts.nix ./big-test.nix ./stubs.nix ];
|
||||
|
||||
test.enableBig = enableBig;
|
||||
}];
|
||||
})
|
||||
];
|
||||
|
||||
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
|
||||
isLinux = pkgs.stdenv.hostPlatform.isLinux;
|
||||
|
|
|
|||
|
|
@ -15,24 +15,23 @@
|
|||
};
|
||||
};
|
||||
|
||||
i18n-custom-locales = { pkgs, ... }: {
|
||||
config = let stub = pkgs.glibcLocalesCustom;
|
||||
in {
|
||||
test.stubs.glibcLocalesCustom = {
|
||||
inherit (pkgs.glibcLocales) version;
|
||||
outPath = null; # we need a real path for this stub
|
||||
i18n-custom-locales = { config, pkgs, ... }: {
|
||||
config = let
|
||||
customGlibcLocales = pkgs.glibcLocales.override {
|
||||
allLocales = false;
|
||||
locales = [ "en_US.UTF-8/UTF-8" ];
|
||||
};
|
||||
|
||||
i18n.glibcLocales = stub;
|
||||
in {
|
||||
i18n.glibcLocales = customGlibcLocales;
|
||||
|
||||
nmt.script = ''
|
||||
hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh
|
||||
assertFileExists $hmEnvFile
|
||||
assertFileRegex $hmEnvFile 'LOCALE_ARCHIVE_.*${stub}'
|
||||
assertFileRegex $hmEnvFile 'LOCALE_ARCHIVE_.*${customGlibcLocales}'
|
||||
|
||||
envFile=home-files/.config/environment.d/10-home-manager.conf
|
||||
assertFileExists $envFile
|
||||
assertFileRegex $envFile 'LOCALE_ARCHIVE_.*${stub}'
|
||||
assertFileRegex $envFile 'LOCALE_ARCHIVE_.*${customGlibcLocales}'
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./fcitx5-stubs.nix ];
|
||||
{ config, lib, realPkgs, ... }:
|
||||
|
||||
lib.mkIf config.test.enableBig {
|
||||
i18n.inputMethod = {
|
||||
enabled = "fcitx5";
|
||||
fcitx5.waylandFrontend = true;
|
||||
};
|
||||
|
||||
_module.args.pkgs = lib.mkForce realPkgs;
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/systemd/user/fcitx5-daemon.service
|
||||
assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh 'GTK_IM_MODULE'
|
||||
|
|
|
|||
|
|
@ -1,57 +0,0 @@
|
|||
{
|
||||
test.stubs = {
|
||||
fcitx5 = {
|
||||
version = "0";
|
||||
outPath = null;
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin $out/share/applications $out/share/dbus-1/services $out/etc/xdg/autostart
|
||||
touch $out/bin/fcitx5 \
|
||||
$out/bin/fcitx5-config-qt \
|
||||
$out/share/applications/org.fcitx.Fcitx5.desktop \
|
||||
$out/share/dbus-1/services/org.fcitx.Fcitx5.service \
|
||||
$out/etc/xdg/autostart/org.fcitx.Fcitx5.desktop
|
||||
# The grep usage of fcitx5-with-addons expects one of the files to match with the fcitx5.out
|
||||
# https://github.com/NixOS/nixpkgs/blob/d2eb4be48705289791428c07aca8ff654c1422ba/pkgs/tools/inputmethods/fcitx5/with-addons.nix#L40-L44
|
||||
echo $out >> $out/etc/xdg/autostart/org.fcitx.Fcitx5.desktop
|
||||
chmod +x $out/bin/fcitx5 \
|
||||
$out/bin/fcitx5-config-qt
|
||||
'';
|
||||
};
|
||||
fcitx5-lua = { outPath = null; };
|
||||
fcitx5-gtk = { outPath = null; };
|
||||
|
||||
gtk2 = {
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin
|
||||
echo '#/usr/bin/env bash' > $out/bin/gtk-query-immodules-2.0
|
||||
chmod +x $out/bin/*
|
||||
'';
|
||||
};
|
||||
gtk3 = {
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin
|
||||
echo '#/usr/bin/env bash' > $out/bin/gtk-query-immodules-3.0
|
||||
chmod +x $out/bin/*
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
libsForQt5 = prev.libsForQt5.overrideScope (qt5final: qt5prev: {
|
||||
fcitx5-chinese-addons = prev.mkStubPackage { outPath = null; };
|
||||
fcitx5-configtool = prev.mkStubPackage { outPath = null; };
|
||||
fcitx5-qt = prev.mkStubPackage { outPath = null; };
|
||||
|
||||
fcitx5-with-addons = qt5prev.fcitx5-with-addons.override {
|
||||
inherit (final) libsForQt5 qt6Packages;
|
||||
};
|
||||
});
|
||||
|
||||
qt6Packages = prev.qt6Packages.overrideScope (qt6final: qt6prev: {
|
||||
fcitx5-qt = prev.mkStubPackage { outPath = null; };
|
||||
});
|
||||
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
kimeConfig = ''
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
debug = { pkgs, config, lib, ... }:
|
||||
debug = { realPkgs, config, lib, ... }:
|
||||
lib.mkIf config.test.enableBig {
|
||||
home.enableDebugInfo = true;
|
||||
home.packages = with pkgs; [ curl gdb ];
|
||||
home.packages = with realPkgs; [ curl gdb ];
|
||||
|
||||
nmt.script = ''
|
||||
[ -L $TESTED/home-path/lib/debug/curl ] \
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
home.packages = [
|
||||
# Look, no font!
|
||||
];
|
||||
|
|
@ -13,5 +8,4 @@ with lib;
|
|||
nmt.script = ''
|
||||
assertPathNotExists home-path/lib/fontconfig/cache
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, realPkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
lib.mkIf config.test.enableBig {
|
||||
home.packages = [ pkgs.comic-relief ];
|
||||
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
_module.args.pkgs = lib.mkForce realPkgs;
|
||||
|
||||
nmt.script = ''
|
||||
assertDirectoryNotEmpty home-path/lib/fontconfig/cache
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,10 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
gtk = {
|
||||
enable = true;
|
||||
theme.name = "Adwaita";
|
||||
gtk2.extraConfig = "gtk-can-change-accels = 1";
|
||||
};
|
||||
|
||||
test.stubs.dconf = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.gtkrc-2.0
|
||||
|
||||
|
|
@ -21,5 +14,4 @@ with lib;
|
|||
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
|
||||
'GTK2_RC_FILES=.*/.gtkrc-2.0'
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,12 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
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 \
|
||||
'GTK2_RC_FILES=.*/\.config/gtk-2.0/gtkrc'
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
gtk = {
|
||||
enable = true;
|
||||
gtk3.extraConfig = {
|
||||
|
|
@ -12,13 +7,10 @@ with lib;
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.dconf = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/gtk-3.0/settings.ini
|
||||
|
||||
assertFileContent home-files/.config/gtk-3.0/settings.ini \
|
||||
${./gtk3-basic-settings-expected.ini}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
{ ... }:
|
||||
{ lib, realPkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
manual = {
|
||||
html.enable = true;
|
||||
manpages.enable = true;
|
||||
json.enable = true;
|
||||
};
|
||||
|
||||
_module.args.pkgs = lib.mkForce realPkgs;
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-path/share/doc/home-manager/index.xhtml
|
||||
assertFileExists home-path/share/doc/home-manager/options.json
|
||||
|
|
@ -18,5 +19,4 @@
|
|||
assertFileExists home-path/share/man/man1/home-manager.1
|
||||
assertFileExists home-path/share/man/man5/home-configuration.nix.5
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
xsession.numlock.enable = true;
|
||||
|
||||
test.stubs.numlockx = { };
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=home-files/.config/systemd/user/numlockx.service
|
||||
assertFileExists $serviceFile
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,13 +6,6 @@
|
|||
style.name = "adwaita";
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
qgnomeplatform = { };
|
||||
qgnomeplatform-qt6 = { };
|
||||
adwaita-qt = { };
|
||||
adwaita-qt6 = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
|
||||
'QT_QPA_PLATFORMTHEME="gnome"'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
imports = [ ../../i18n/input-method/fcitx5-stubs.nix ];
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
qt = {
|
||||
enable = true;
|
||||
platformTheme.name = "gtk";
|
||||
|
|
@ -11,11 +11,11 @@
|
|||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
libsForQt5 = prev.libsForQt5.overrideScope (qt5final: qt5prev: {
|
||||
qtstyleplugins = prev.mkStubPackage { outPath = null; };
|
||||
qtstyleplugins = config.lib.test.mkStubPackage { outPath = null; };
|
||||
});
|
||||
|
||||
qt6Packages = prev.qt6Packages.overrideScope (qt6final: qt6prev: {
|
||||
qt6gtk2 = prev.mkStubPackage { outPath = null; };
|
||||
qt6gtk2 = config.lib.test.mkStubPackage { outPath = null; };
|
||||
});
|
||||
})
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,20 +1,38 @@
|
|||
{ pkgs, ... }: {
|
||||
config = {
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
xdg.autostart = {
|
||||
enable = true;
|
||||
entries = [
|
||||
"${pkgs.evolution}/share/applications/org.gnome.Evolution.desktop"
|
||||
"${pkgs.tdesktop}/share/applications/org.telegram.desktop.desktop"
|
||||
"${pkgs.test1}/share/applications/test1.desktop"
|
||||
"${pkgs.test2}/share/applications/test2.desktop"
|
||||
];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/autostart/org.gnome.Evolution.desktop
|
||||
assertFileContent home-files/.config/autostart/org.gnome.Evolution.desktop \
|
||||
${pkgs.evolution}/share/applications/org.gnome.Evolution.desktop
|
||||
assertFileExists home-files/.config/autostart/org.telegram.desktop.desktop
|
||||
assertFileContent home-files/.config/autostart/org.telegram.desktop.desktop \
|
||||
${pkgs.tdesktop}/share/applications/org.telegram.desktop.desktop
|
||||
test.stubs = {
|
||||
test1 = {
|
||||
outPath = null;
|
||||
buildScript = ''
|
||||
mkdir -p $out/share/applications
|
||||
echo test1 > $out/share/applications/test1.desktop
|
||||
'';
|
||||
};
|
||||
test2 = {
|
||||
outPath = null;
|
||||
buildScript = ''
|
||||
mkdir -p $out/share/applications
|
||||
echo test2 > $out/share/applications/test2.desktop
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/autostart/test1.desktop
|
||||
assertFileContent home-files/.config/autostart/test1.desktop \
|
||||
${pkgs.test1}/share/applications/test1.desktop
|
||||
|
||||
assertFileExists home-files/.config/autostart/test2.desktop
|
||||
assertFileContent home-files/.config/autostart/test2.desktop \
|
||||
${pkgs.test2}/share/applications/test2.desktop
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,28 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, realPkgs, ... }:
|
||||
|
||||
lib.mkIf config.test.enableBig {
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
extraPortals =
|
||||
[ pkgs.xdg-desktop-portal-hyprland pkgs.xdg-desktop-portal-wlr ];
|
||||
configPackages = [ pkgs.hyprland ];
|
||||
[ realPkgs.xdg-desktop-portal-hyprland realPkgs.xdg-desktop-portal-wlr ];
|
||||
configPackages = [ realPkgs.hyprland ];
|
||||
config = { sway.default = [ "wlr" "gtk" ]; };
|
||||
};
|
||||
|
||||
test.unstubs = [ (self: super: { inherit (realPkgs) xdg-desktop-portal; }) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-path/share/systemd/user/xdg-desktop-portal.service
|
||||
assertFileExists home-path/share/systemd/user/xdg-desktop-portal-wlr.service
|
||||
assertFileExists home-path/share/systemd/user/xdg-desktop-portal-hyprland.service
|
||||
|
||||
assertFileContent home-path/share/xdg-desktop-portal/portals/hyprland.portal \
|
||||
${pkgs.xdg-desktop-portal-hyprland}/share/xdg-desktop-portal/portals/hyprland.portal
|
||||
${realPkgs.xdg-desktop-portal-hyprland}/share/xdg-desktop-portal/portals/hyprland.portal
|
||||
assertFileContent home-path/share/xdg-desktop-portal/portals/wlr.portal \
|
||||
${pkgs.xdg-desktop-portal-wlr}/share/xdg-desktop-portal/portals/wlr.portal
|
||||
${realPkgs.xdg-desktop-portal-wlr}/share/xdg-desktop-portal/portals/wlr.portal
|
||||
|
||||
assertFileContent home-path/share/xdg-desktop-portal/hyprland-portals.conf \
|
||||
${pkgs.hyprland}/share/xdg-desktop-portal/hyprland-portals.conf
|
||||
${realPkgs.hyprland}/share/xdg-desktop-portal/hyprland-portals.conf
|
||||
assertFileContent home-files/.config/xdg-desktop-portal/sway-portals.conf \
|
||||
${./sway-portals-expected.conf}
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ with lib;
|
|||
config = {
|
||||
programs.abook.enable = true;
|
||||
|
||||
test.stubs.abook = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/abook/abookrc
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
test.stubs.abook = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/abook/abookrc
|
||||
assertFileContent home-files/.config/abook/abookrc ${./with-settings.cfg}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ with lib;
|
|||
This option is safe; if `passwordCommand` is properly set, no credentials will be written to the nix store.
|
||||
''];
|
||||
|
||||
test.stubs.aerc = { };
|
||||
|
||||
programs.aerc = {
|
||||
enable = true;
|
||||
extraAccounts = {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,5 @@ with lib;
|
|||
assertPathNotExists ${dir}/stylesets
|
||||
'';
|
||||
programs.aerc.enable = true;
|
||||
|
||||
test.stubs.aerc = { };
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ with lib;
|
|||
assertFileContent ${dir}/stylesets/asLines ${./stylesets.expected}
|
||||
'';
|
||||
|
||||
test.stubs.aerc = { };
|
||||
|
||||
programs.aerc = {
|
||||
enable = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.aerospace = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent home-files/.config/aerospace/aerospace.toml ${
|
||||
./settings-expected.toml
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
{
|
||||
config = {
|
||||
programs.alacritty.enable = true;
|
||||
|
||||
test.stubs.alacritty = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/alacritty
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
|
||||
settings = {
|
||||
window.dimensions = {
|
||||
lines = 3;
|
||||
|
|
@ -20,12 +15,9 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs = { alacritty = { }; };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/alacritty/alacritty.toml \
|
||||
${./example-settings-expected.toml}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
{ config, lib, ... }:
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
|
||||
settings = {
|
||||
window.dimensions = {
|
||||
lines = 3;
|
||||
|
|
@ -28,12 +25,9 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs = { alacritty = { }; };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/alacritty/alacritty.toml \
|
||||
${./settings-toml-expected.toml}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
|
||||
settings = {
|
||||
window.dimensions = {
|
||||
lines = 3;
|
||||
|
|
@ -25,12 +20,9 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs = { alacritty = { }; };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/alacritty/alacritty.toml \
|
||||
${./settings-toml-expected.toml}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
imports = [ ../../accounts/email-test-accounts.nix ];
|
||||
|
||||
config = {
|
||||
accounts.email.accounts = {
|
||||
"hm@example.com" = {
|
||||
notmuch.enable = true;
|
||||
|
|
@ -23,12 +18,9 @@ with lib;
|
|||
|
||||
programs.alot = { enable = true; };
|
||||
|
||||
test.stubs.alot = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/alot/config
|
||||
assertFileContent home-files/.config/alot/config ${./alot-expected.conf}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let relToDotDirCustom = ".zshplugins";
|
||||
in {
|
||||
programs.zsh = {
|
||||
|
|
@ -12,11 +10,6 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
antidote = { };
|
||||
zsh = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContains home-files/${relToDotDirCustom}/.zshrc \
|
||||
'source @antidote@/share/antidote/antidote.zsh'
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.aria2 = {
|
||||
enable = true;
|
||||
|
||||
|
|
@ -20,13 +15,11 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
test.stubs.aria2 = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/aria2/aria2.conf \
|
||||
${
|
||||
pkgs.writeText "aria2-expected-config.conf" ''
|
||||
builtins.toFile "aria2-expected-config.conf" ''
|
||||
dht-listen-port=60000
|
||||
ftp-pasv=true
|
||||
listen-port=60000
|
||||
|
|
@ -36,5 +29,4 @@ with lib;
|
|||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs = {
|
||||
atuin.enable = true;
|
||||
|
|
@ -9,11 +7,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
atuin = { name = "atuin"; };
|
||||
bash-preexec = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.bashrc
|
||||
assertFileContains \
|
||||
|
|
|
|||
|
|
@ -1,13 +1,6 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.atuin.enable = true;
|
||||
|
||||
test.stubs = {
|
||||
atuin = { name = "atuin"; };
|
||||
bash-preexec = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/atuin/config.toml
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -12,11 +12,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
atuin = { name = "atuin"; };
|
||||
bash-preexec = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/atuin/config.toml \
|
||||
|
|
|
|||
|
|
@ -10,11 +10,6 @@
|
|||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||
lib.mkForce (builtins.toFile "empty" "");
|
||||
|
||||
test.stubs = {
|
||||
atuin = { name = "atuin"; };
|
||||
bash-preexec = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/fish/config.fish
|
||||
assertFileContains \
|
||||
|
|
|
|||
|
|
@ -17,11 +17,6 @@
|
|||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||
lib.mkForce (builtins.toFile "empty" "");
|
||||
|
||||
test.stubs = {
|
||||
atuin = { name = "atuin"; };
|
||||
bash-preexec = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileNotRegex home-files/.zshrc 'atuin init zsh'
|
||||
assertFileNotRegex home-files/.bashrc 'atuin init bash'
|
||||
|
|
|
|||
|
|
@ -16,11 +16,6 @@
|
|||
xdg.dataFile."fish/home-manager_generated_completions".source =
|
||||
lib.mkForce (builtins.toFile "empty" "");
|
||||
|
||||
test.stubs = {
|
||||
atuin = { name = "atuin"; };
|
||||
bash-preexec = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.bashrc
|
||||
assertFileContains \
|
||||
|
|
|
|||
|
|
@ -1,16 +1,9 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs = {
|
||||
atuin.enable = true;
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
atuin = { name = "atuin"; };
|
||||
bash-preexec = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.zshrc
|
||||
assertFileContains \
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.autojump.enable = true;
|
||||
|
||||
test.stubs.autojump = {
|
||||
|
|
@ -14,5 +9,4 @@ with lib;
|
|||
nmt.script = ''
|
||||
assertFileExists home-path/bin/autojump
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.autorandr = {
|
||||
enable = true;
|
||||
profiles = {
|
||||
|
|
@ -33,8 +30,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.autorandr = { };
|
||||
|
||||
nmt.script = ''
|
||||
config=home-files/.config/autorandr/default/config
|
||||
setup=home-files/.config/autorandr/default/setup
|
||||
|
|
@ -46,7 +41,7 @@
|
|||
assertFileExists $config
|
||||
assertFileContent $config \
|
||||
${
|
||||
pkgs.writeText "basic-configuration.conf" ''
|
||||
builtins.toFile "basic-configuration.conf" ''
|
||||
output DP1
|
||||
off
|
||||
|
||||
|
|
@ -62,5 +57,4 @@
|
|||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.autorandr = {
|
||||
enable = true;
|
||||
profiles = {
|
||||
|
|
@ -17,18 +14,15 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.autorandr = { };
|
||||
|
||||
nmt.script = ''
|
||||
config=home-files/.config/autorandr/default/config
|
||||
|
||||
assertFileExists $config
|
||||
assertFileContent $config \
|
||||
${
|
||||
pkgs.writeText "scale-expected.conf" ''
|
||||
builtins.toFile "scale-expected.conf" ''
|
||||
output DP1
|
||||
scale 2x4''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs = {
|
||||
awscli = {
|
||||
|
|
@ -14,8 +12,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.awscli2 = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.aws/config
|
||||
assertFileContent home-files/.aws/config \
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
test.stubs.bacon = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists 'home-files/${configDir}/prefs.toml'
|
||||
assertFileContent 'home-files/${configDir}/prefs.toml' ${./expected.toml}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ let
|
|||
in {
|
||||
programs.bacon.enable = true;
|
||||
|
||||
test.stubs.bacon = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists 'home-files/${configDir}/prefs.toml'
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
programs.bash.enable = true;
|
||||
|
||||
test.stubs.bash-completion = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.bashrc
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
enableCompletion = false;
|
||||
|
|
@ -23,5 +18,4 @@ with lib;
|
|||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
enableCompletion = false;
|
||||
|
|
@ -29,5 +26,4 @@ with lib;
|
|||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
|
||||
|
|
@ -17,21 +12,19 @@ with lib;
|
|||
lessopen = false;
|
||||
};
|
||||
|
||||
themes.testtheme.src = pkgs.writeText "testtheme.tmTheme" ''
|
||||
themes.testtheme.src = builtins.toFile "testtheme.tmTheme" ''
|
||||
This is a test theme.
|
||||
'';
|
||||
|
||||
syntaxes.testsyntax.src = pkgs.writeText "testsyntax.sublime-syntax" ''
|
||||
syntaxes.testsyntax.src = builtins.toFile "testsyntax.sublime-syntax" ''
|
||||
This is a test syntax.
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.bat = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/bat/config
|
||||
assertFileContent home-files/.config/bat/config ${
|
||||
pkgs.writeText "bat.expected" ''
|
||||
builtins.toFile "bat.expected" ''
|
||||
--map-syntax='*.jenkinsfile:Groovy'
|
||||
--map-syntax='*.props:Java Properties'
|
||||
--pager='less -FR'
|
||||
|
|
@ -42,17 +35,16 @@ with lib;
|
|||
|
||||
assertFileExists home-files/.config/bat/themes/testtheme.tmTheme
|
||||
assertFileContent home-files/.config/bat/themes/testtheme.tmTheme ${
|
||||
pkgs.writeText "bat.expected" ''
|
||||
builtins.toFile "bat.expected" ''
|
||||
This is a test theme.
|
||||
''
|
||||
}
|
||||
|
||||
assertFileExists home-files/.config/bat/syntaxes/testsyntax.sublime-syntax
|
||||
assertFileContent home-files/.config/bat/syntaxes/testsyntax.sublime-syntax ${
|
||||
pkgs.writeText "bat.expected" ''
|
||||
builtins.toFile "bat.expected" ''
|
||||
This is a test syntax.
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
|
||||
|
|
@ -22,8 +17,6 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
test.stubs.bat = { };
|
||||
|
||||
test.asserts.warnings.enable = true;
|
||||
test.asserts.warnings.expected = [
|
||||
''
|
||||
|
|
@ -41,7 +34,7 @@ with lib;
|
|||
nmt.script = ''
|
||||
assertFileExists home-files/.config/bat/config
|
||||
assertFileContent home-files/.config/bat/config ${
|
||||
pkgs.writeText "bat.expected" ''
|
||||
builtins.toFile "bat.expected" ''
|
||||
--map-syntax='*.jenkinsfile:Groovy'
|
||||
--map-syntax='*.props:Java Properties'
|
||||
--pager='less -FR'
|
||||
|
|
@ -51,17 +44,16 @@ with lib;
|
|||
|
||||
assertFileExists home-files/.config/bat/themes/testtheme.tmTheme
|
||||
assertFileContent home-files/.config/bat/themes/testtheme.tmTheme ${
|
||||
pkgs.writeText "bat.expected" ''
|
||||
builtins.toFile "bat.expected" ''
|
||||
This is a test theme.
|
||||
''
|
||||
}
|
||||
|
||||
assertFileExists home-files/.config/bat/syntaxes/testsyntax.sublime-syntax
|
||||
assertFileContent home-files/.config/bat/syntaxes/testsyntax.sublime-syntax ${
|
||||
pkgs.writeText "bat.expected" ''
|
||||
builtins.toFile "bat.expected" ''
|
||||
This is a test syntax.
|
||||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
home.stateVersion = "23.05";
|
||||
|
||||
|
|
@ -14,11 +12,6 @@
|
|||
mpdIntegration.enableStats = true;
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
beets = { };
|
||||
mpd = { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/beets/config.yaml
|
||||
assertFileContent \
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
home.stateVersion = "23.05";
|
||||
|
||||
programs.beets = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { outPath = "@beets@"; };
|
||||
mpdIntegration.enableUpdate = true;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.bemenu = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
|
||||
assertFileContains home-path/etc/profile.d/hm-session-vars.sh \
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
{
|
||||
programs.bemenu = { enable = true; };
|
||||
|
||||
test.stubs.bemenu = { };
|
||||
programs.bemenu.enable = true;
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ config, realPkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
|
|
@ -61,8 +61,6 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
nmt.script = ''
|
||||
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
|
||||
assertFileExists $config_file
|
||||
|
|
@ -120,7 +118,7 @@ in {
|
|||
builtins.elemAt backups.main.hooks.extraConfig.before_actions 0
|
||||
}"
|
||||
|
||||
yq=${pkgs.yq-go}/bin/yq
|
||||
yq=${realPkgs.yq-go}/bin/yq
|
||||
|
||||
for filter in "''${!expectations[@]}"; do
|
||||
expected_value="''${expectations[$filter]}"
|
||||
|
|
|
|||
|
|
@ -1,10 +1,4 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
backups = config.programs.borgmatic.backups;
|
||||
|
||||
in {
|
||||
{
|
||||
programs.borgmatic = {
|
||||
enable = true;
|
||||
backups = {
|
||||
|
|
@ -18,8 +12,6 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
test.asserts.assertions.expected = [''
|
||||
Borgmatic backup configuration "main" cannot specify both 'location.sourceDirectories' and 'location.patterns'.
|
||||
''];
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ realPkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
backups = config.programs.borgmatic.backups;
|
||||
excludeFile = builtins.toFile "excludeFile.txt" "/foo/bar";
|
||||
|
||||
in {
|
||||
{
|
||||
programs.borgmatic = {
|
||||
enable = true;
|
||||
backups = {
|
||||
|
|
@ -19,13 +14,11 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
nmt.script = ''
|
||||
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
|
||||
assertFileExists $config_file
|
||||
|
||||
yq=${pkgs.yq-go}/bin/yq
|
||||
yq=${realPkgs.yq-go}/bin/yq
|
||||
|
||||
hmExclusionsFile=$($yq '.exclude_from[0]' $config_file)
|
||||
expected_content='/home/hm-user/.config/borgmatic.d/main.yaml'
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ realPkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
backups = config.programs.borgmatic.backups;
|
||||
excludeFile = builtins.toFile "excludeFile.txt" "/foo/bar";
|
||||
|
||||
in {
|
||||
|
|
@ -20,8 +19,6 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
nmt.script = ''
|
||||
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
|
||||
assertFileExists $config_file
|
||||
|
|
@ -30,7 +27,7 @@ in {
|
|||
|
||||
expectations[exclude_from[0]]="${excludeFile}"
|
||||
|
||||
yq=${pkgs.yq-go}/bin/yq
|
||||
yq=${realPkgs.yq-go}/bin/yq
|
||||
|
||||
for filter in "''${!expectations[@]}"; do
|
||||
expected_value="''${expectations[$filter]}"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ realPkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
backups = config.programs.borgmatic.backups;
|
||||
excludeFile = builtins.toFile "excludeFile.txt" "/foo/bar";
|
||||
|
||||
in {
|
||||
|
|
@ -20,8 +19,6 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
nmt.script = ''
|
||||
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
|
||||
assertFileExists $config_file
|
||||
|
|
@ -30,7 +27,7 @@ in {
|
|||
|
||||
expectations[exclude_from[0]]="${excludeFile}"
|
||||
|
||||
yq=${pkgs.yq-go}/bin/yq
|
||||
yq=${realPkgs.yq-go}/bin/yq
|
||||
|
||||
for filter in "''${!expectations[@]}"; do
|
||||
expected_value="''${expectations[$filter]}"
|
||||
|
|
|
|||
|
|
@ -1,17 +1,9 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
backups = config.programs.borgmatic.backups;
|
||||
|
||||
in {
|
||||
{
|
||||
programs.borgmatic = {
|
||||
enable = true;
|
||||
backups = { main = { location = { repositories = [ "/mnt/disk1" ]; }; }; };
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
test.asserts.assertions.expected = [''
|
||||
Borgmatic backup configuration "main" must specify one of 'location.sourceDirectories' or 'location.patterns'.
|
||||
''];
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ config, realPkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
boolToString = bool: if bool then "true" else "false";
|
||||
backups = config.programs.borgmatic.backups;
|
||||
|
||||
in {
|
||||
|
|
@ -23,8 +22,6 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.borgmatic = { };
|
||||
|
||||
nmt.script = ''
|
||||
config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml
|
||||
assertFileExists $config_file
|
||||
|
|
@ -44,7 +41,7 @@ in {
|
|||
builtins.elemAt backups.main.location.patterns 3
|
||||
}"
|
||||
|
||||
yq=${pkgs.yq-go}/bin/yq
|
||||
yq=${realPkgs.yq-go}/bin/yq
|
||||
|
||||
for filter in "''${!expectations[@]}"; do
|
||||
expected_value="''${expectations[$filter]}"
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ with lib;
|
|||
config = {
|
||||
programs.boxxy.enable = true;
|
||||
|
||||
test.stubs.boxxy = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/boxxy
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ with lib;
|
|||
context = [ "/home/test_user/your_project_repo" ];
|
||||
}];
|
||||
|
||||
test.stubs.boxxy = { };
|
||||
|
||||
nmt.script = ''
|
||||
boxxyyaml=home-files/.config/boxxy/boxxy.yaml
|
||||
assertFileExists $boxxyyaml
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ ... }:
|
||||
{ realPkgs, ... }:
|
||||
|
||||
{
|
||||
programs.broot = {
|
||||
|
|
@ -6,10 +6,7 @@
|
|||
settings.modal = true;
|
||||
};
|
||||
|
||||
tests.stubs = {
|
||||
broot = { };
|
||||
hjson = { };
|
||||
};
|
||||
nixpkgs.overlays = [ (self: super: { inherit (realPkgs) broot hjson; }) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/broot/conf.toml
|
||||
|
|
|
|||
|
|
@ -1,16 +1,14 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ realPkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.browserpass = {
|
||||
enable = true;
|
||||
browsers =
|
||||
[ "brave" "chrome" "chromium" "firefox" "librewolf" "vivaldi" ];
|
||||
browsers = [ "brave" "chrome" "chromium" "firefox" "librewolf" "vivaldi" ];
|
||||
};
|
||||
|
||||
nmt.script = if pkgs.stdenv.hostPlatform.isDarwin then ''
|
||||
nixpkgs.overlays = [ (self: super: { inherit (realPkgs) browserpass; }) ];
|
||||
|
||||
nmt.script = if realPkgs.stdenv.hostPlatform.isDarwin then ''
|
||||
for dir in "BraveSoftware/Brave-Browser" "Google/Chrome" "Chromium" "Mozilla" "LibreWolf" "Vivaldi"; do
|
||||
assertFileExists "home-files/Library/Application Support/$dir/NativeMessagingHosts/com.github.browserpass.native.json"
|
||||
done
|
||||
|
|
@ -31,5 +29,4 @@ with lib;
|
|||
assertFileExists "home-files/$dir/native-messaging-hosts/com.github.browserpass.native.json"
|
||||
done
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.btop.enable = true;
|
||||
|
||||
test.stubs.btop = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/btop
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs = {
|
||||
carapace.enable = true;
|
||||
|
|
@ -9,6 +7,6 @@
|
|||
nmt.script = ''
|
||||
assertFileExists home-files/.bashrc
|
||||
assertFileRegex home-files/.bashrc \
|
||||
'source <(/nix/store/.*carapace.*/bin/carapace _carapace bash)'
|
||||
'source <(@carapace@/bin/carapace _carapace bash)'
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
{ ... }:
|
||||
{ config, lib, realPkgs, ... }:
|
||||
|
||||
{
|
||||
lib.mkIf config.test.enableBig {
|
||||
programs = {
|
||||
carapace.enable = true;
|
||||
fish.enable = true;
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [ (self: super: { inherit (realPkgs) carapace; }) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/fish/config.fish
|
||||
assertFileRegex home-files/.config/fish/config.fish \
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs = {
|
||||
carapace.enable = true;
|
||||
|
|
@ -9,6 +7,6 @@
|
|||
nmt.script = ''
|
||||
assertFileExists home-files/.zshrc
|
||||
assertFileRegex home-files/.zshrc \
|
||||
'source <(/nix/store/.*carapace.*/bin/carapace _carapace zsh)'
|
||||
'source <(@carapace@/bin/carapace _carapace zsh)'
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.cmus = {
|
||||
enable = true;
|
||||
|
|
@ -7,8 +5,6 @@
|
|||
extraConfig = "test";
|
||||
};
|
||||
|
||||
test.stubs.cmus = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/cmus/rc \
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.comodoro = {
|
||||
enable = true;
|
||||
|
|
@ -26,8 +24,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.comodoro = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/comodoro/config.toml
|
||||
assertFileContent home-files/.config/comodoro/config.toml ${./expected.toml}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.bash.enable = true;
|
||||
programs.direnv.enable = true;
|
||||
|
||||
|
|
@ -11,7 +6,6 @@ with lib;
|
|||
assertFileExists home-files/.bashrc
|
||||
assertFileRegex \
|
||||
home-files/.bashrc \
|
||||
'eval "\$(/nix/store/.*direnv.*/bin/direnv hook bash)"'
|
||||
'eval "\$(@direnv@/bin/direnv hook bash)"'
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,14 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ realPkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.bash.enable = true;
|
||||
programs.direnv.enable = true;
|
||||
programs.direnv.nix-direnv.enable = true;
|
||||
|
||||
nixpkgs.overlays = [ (_: _: { inherit (realPkgs) nix-direnv; }) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.bashrc
|
||||
assertFileExists home-files/.config/direnv/lib/hm-nix-direnv.sh
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@
|
|||
programs.nushell.enable = true;
|
||||
programs.direnv.enable = true;
|
||||
|
||||
test.stubs.nushell = { };
|
||||
|
||||
nmt.script = let
|
||||
configFile = if pkgs.stdenv.isDarwin && !config.xdg.enable then
|
||||
"home-files/Library/Application Support/nushell/config.nu"
|
||||
|
|
@ -13,6 +11,6 @@
|
|||
"home-files/.config/nushell/config.nu";
|
||||
in ''
|
||||
assertFileExists "${configFile}"
|
||||
assertFileRegex "${configFile}" '/nix/store/.*direnv.*/bin/direnv export json'
|
||||
assertFileRegex "${configFile}" '@direnv@/bin/direnv export json'
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ realPkgs, ... }:
|
||||
|
||||
let expectedContent = "something important";
|
||||
in {
|
||||
config = {
|
||||
programs.bash.enable = true;
|
||||
programs.direnv.enable = true;
|
||||
programs.direnv.nix-direnv.enable = true;
|
||||
programs.direnv.stdlib = expectedContent;
|
||||
|
||||
nixpkgs.overlays = [ (_: _: { inherit (realPkgs) nix-direnv; }) ];
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.bashrc
|
||||
assertFileExists home-files/.config/direnv/lib/hm-nix-direnv.sh
|
||||
|
|
@ -17,5 +16,4 @@ in {
|
|||
home-files/.config/direnv/direnvrc \
|
||||
'${expectedContent}'
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let expectedContent = "something important";
|
||||
in {
|
||||
config = {
|
||||
programs.bash.enable = true;
|
||||
programs.direnv.enable = true;
|
||||
programs.direnv.stdlib = expectedContent;
|
||||
|
|
@ -16,5 +11,4 @@ in {
|
|||
home-files/.config/direnv/direnvrc \
|
||||
'${expectedContent}'
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.fastfetch = { };
|
||||
|
||||
nmt.script = let configFile = "home-files/.config/fastfetch/config.jsonc";
|
||||
in ''
|
||||
assertFileExists "${configFile}"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
{
|
||||
programs.fastfetch.enable = true;
|
||||
|
||||
test.stubs.fastfetch = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists "home-files/.config/fastfetch/config.jsonc"
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.feh.enable = true;
|
||||
|
||||
programs.feh.buttons = {
|
||||
|
|
@ -17,8 +14,6 @@
|
|||
prev_img = [ "h" "Left" ];
|
||||
};
|
||||
|
||||
test.stubs.feh = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/feh/buttons \
|
||||
|
|
@ -28,5 +23,4 @@
|
|||
home-files/.config/feh/keys \
|
||||
${./feh-bindings-expected-keys}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,9 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.feh.enable = true;
|
||||
|
||||
test.stubs.feh = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/feh/buttons
|
||||
assertPathNotExists home-files/.config/feh/keys
|
||||
assertPathNotExists home-files/.config/feh/themes
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.feh.enable = true;
|
||||
|
||||
programs.feh.themes = {
|
||||
|
|
@ -21,12 +18,9 @@
|
|||
example = [ "--info" "foo bar" ];
|
||||
};
|
||||
|
||||
test.stubs.feh = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/feh/themes \
|
||||
${./feh-themes-expected}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,16 @@
|
|||
modulePath:
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, realPkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
cfg = lib.getAttrFromPath modulePath config;
|
||||
|
||||
firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath;
|
||||
|
||||
in {
|
||||
imports = [ firefoxMockOverlay ];
|
||||
|
||||
config = lib.mkIf config.test.enableBig
|
||||
in lib.mkIf config.test.enableBig
|
||||
(lib.setAttrByPath modulePath { enable = true; } // {
|
||||
home.stateVersion = "19.09";
|
||||
|
||||
_module.args.pkgs = lib.mkForce realPkgs;
|
||||
|
||||
nmt.script = ''
|
||||
package=${cfg.package}
|
||||
finalPackage=${cfg.finalPackage}
|
||||
|
|
@ -21,5 +18,4 @@ in {
|
|||
fail "Expected finalPackage ($finalPackage) to equal package ($package)"
|
||||
fi
|
||||
'';
|
||||
});
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,30 +1,36 @@
|
|||
modulePath:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ config, lib, realPkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
cfg = getAttrFromPath modulePath config;
|
||||
cfg = lib.getAttrFromPath modulePath config;
|
||||
|
||||
in {
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
"${cfg.wrappedPackageName}-unwrapped" =
|
||||
pkgs.runCommandLocal "${cfg.wrappedPackageName}-0" {
|
||||
test.stubs = let unwrappedName = "${cfg.wrappedPackageName}-unwrapped";
|
||||
in {
|
||||
"${unwrappedName}" = {
|
||||
name = unwrappedName;
|
||||
extraAttrs = {
|
||||
binaryName = cfg.wrappedPackageName;
|
||||
gtk3 = null;
|
||||
meta.description = "I pretend to be ${cfg.name}";
|
||||
passthru.gtk3 = null;
|
||||
} ''
|
||||
};
|
||||
outPath = null;
|
||||
buildScript = ''
|
||||
echo BUILD
|
||||
mkdir -p "$out"/{bin,lib}
|
||||
touch "$out/bin/${cfg.wrappedPackageName}"
|
||||
chmod 755 "$out/bin/${cfg.wrappedPackageName}"
|
||||
'';
|
||||
};
|
||||
|
||||
chrome-gnome-shell =
|
||||
pkgs.runCommandLocal "dummy-chrome-gnome-shell" { } ''
|
||||
chrome-gnome-shell = {
|
||||
buildScript = ''
|
||||
mkdir -p $out/lib/mozilla/native-messaging-hosts
|
||||
touch $out/lib/mozilla/native-messaging-hosts/dummy
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [ (_: _: { inherit (realPkgs) mozlz4a; }) ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,7 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.foot.enable = true;
|
||||
|
||||
test.stubs.foot = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/foot
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.foot = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
|
|
@ -25,5 +22,4 @@ with lib;
|
|||
home-files/.config/foot/foot.ini \
|
||||
${./example-settings-expected.ini}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.foot = {
|
||||
package = config.lib.test.mkStubPackage { outPath = "@foot@"; };
|
||||
enable = true;
|
||||
server.enable = true;
|
||||
};
|
||||
|
|
@ -15,5 +11,4 @@
|
|||
home-files/.config/systemd/user/foot.service \
|
||||
${./systemd-user-service-expected.service}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.freetube = {
|
||||
enable = true;
|
||||
|
|
@ -17,8 +15,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.freetube = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/FreeTube/hm_settings.db
|
||||
assertFileContent home-files/.config/FreeTube/hm_settings.db \
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.fuzzel.enable = true;
|
||||
|
||||
test.stubs.fuzzel = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/fuzzel
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.gallery-dl = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent home-files/.config/gallery-dl/config.json \
|
||||
${builtins.toFile "gallery-dl-expected-settings.json" ''
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.gh-dash = {
|
||||
enable = true;
|
||||
|
|
@ -11,8 +9,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.gh = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/gh-dash/config.yml
|
||||
assertFileContent home-files/.config/gh-dash/config.yml ${
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
settings.aliases = { co = "pr checkout"; };
|
||||
settings.editor = "vim";
|
||||
};
|
||||
|
||||
test.stubs.gh = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/gh/config.yml
|
||||
assertFileContent home-files/.config/gh/config.yml ${
|
||||
|
|
@ -22,5 +17,4 @@
|
|||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
|
|
@ -11,8 +9,6 @@
|
|||
|
||||
programs.git.enable = true;
|
||||
|
||||
test.stubs.gh = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/git/config
|
||||
assertFileContent home-files/.config/git/config \
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.gh = {
|
||||
|
|
@ -7,7 +7,6 @@
|
|||
};
|
||||
|
||||
test.stubs = {
|
||||
gh = { };
|
||||
gh-eco = {
|
||||
name = "gh-eco";
|
||||
buildScript = ''
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
{ config, options, lib, pkgs, ... }:
|
||||
{ options, lib, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
aliases = { co = "pr checkout"; };
|
||||
editor = "vim";
|
||||
};
|
||||
|
||||
test.stubs.gh = { };
|
||||
|
||||
test.asserts.warnings.expected = [
|
||||
"The option `programs.gh.editor' defined in ${
|
||||
lib.showFiles options.programs.gh.editor.files
|
||||
|
|
@ -32,5 +29,4 @@
|
|||
''
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
programs.ghostty.enable = true;
|
||||
test.stubs.ghostty = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/ghostty/config
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
{ config, ... }: {
|
||||
{
|
||||
programs.ghostty = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
|
||||
themes = {
|
||||
catppuccin-mocha = {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
programs.git-cliff = {
|
||||
enable = true;
|
||||
|
|
@ -13,8 +9,6 @@ with lib;
|
|||
};
|
||||
};
|
||||
|
||||
test.stubs.git-cliff = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContent \
|
||||
home-files/.config/git-cliff/cliff.toml \
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs.git-credential-oauth = { enable = true; };
|
||||
|
||||
programs.git = { enable = true; };
|
||||
|
||||
test.stubs.git-credential-oauth = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/git/config
|
||||
assertFileContains \
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs.git-credential-oauth = {
|
||||
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
programs.git = { enable = true; };
|
||||
|
||||
test.stubs.git-credential-oauth = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/git/config
|
||||
assertFileContains \
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ realPkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ../../accounts/email-test-accounts.nix ];
|
||||
|
||||
config = {
|
||||
accounts.email.accounts.hm-account.smtp.tls.certificatesFile =
|
||||
"/etc/test/certificates.crt";
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitMinimal;
|
||||
userEmail = "hm@example.com";
|
||||
userName = "H. M. Test";
|
||||
};
|
||||
|
|
@ -20,7 +17,7 @@ with lib;
|
|||
nmt.script = ''
|
||||
function assertGitConfig() {
|
||||
local value
|
||||
value=$(${pkgs.gitMinimal}/bin/git config \
|
||||
value=$(${realPkgs.gitMinimal}/bin/git config \
|
||||
--file $TESTED/home-files/.config/git/config \
|
||||
--get $1)
|
||||
if [[ $value != $2 ]]; then
|
||||
|
|
@ -36,5 +33,4 @@ with lib;
|
|||
assertGitConfig "sendemail.hm@example.com.from" "H. M. Test <hm@example.com>"
|
||||
assertGitConfig "sendemail.hm-account.from" "H. M. Test Jr. <hm@example.org>"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{ realPkgs, ... }:
|
||||
|
||||
{
|
||||
programs.git = {
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
nmt.script = ''
|
||||
function getGitConfig() {
|
||||
${pkgs.gitMinimal}/bin/git config \
|
||||
${realPkgs.gitMinimal}/bin/git config \
|
||||
--file $TESTED/home-files/.config/git/config \
|
||||
--get $1
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,22 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
{ pkgs, realPkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ../../accounts/email-test-accounts.nix ];
|
||||
|
||||
config = {
|
||||
accounts.email.accounts."hm@example.com".msmtp.enable = true;
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitMinimal;
|
||||
userEmail = "hm@example.com";
|
||||
userName = "H. M. Test";
|
||||
};
|
||||
|
||||
home.stateVersion = "20.09";
|
||||
|
||||
test.stubs.msmtp = { };
|
||||
|
||||
nmt.script = ''
|
||||
function assertGitConfig() {
|
||||
local value
|
||||
value=$(${pkgs.gitMinimal}/bin/git config \
|
||||
value=$(${realPkgs.gitMinimal}/bin/git config \
|
||||
--file $TESTED/home-files/.config/git/config \
|
||||
--get $1)
|
||||
if [[ $value != $2 ]]; then
|
||||
|
|
@ -39,5 +33,4 @@ with lib;
|
|||
assertGitConfig "sendemail.hm@example.com.smtpServer" "${pkgs.msmtp}/bin/msmtp"
|
||||
assertGitConfig "sendemail.hm@example.com.envelopeSender" "auto"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue