tests/nh: init tests (#6819)

This commit is contained in:
Austin Horstman
2025-04-14 10:07:02 -07:00
committed by GitHub
parent 3375414477
commit 273ad32fbb
3 changed files with 37 additions and 0 deletions

View File

@@ -533,6 +533,7 @@ import nmtSrc {
./modules/programs/looking-glass-client
./modules/programs/mangohud
./modules/programs/ncmpcpp-linux
./modules/programs/nh
./modules/programs/pqiv
./modules/programs/rbw
./modules/programs/rofi

View File

@@ -0,0 +1 @@
{ nh = ./nh.nix; }

View File

@@ -0,0 +1,35 @@
{ config, pkgs, ... }:
{
programs.nh = {
enable = true;
package = config.lib.test.mkStubPackage { version = "4.0.0"; };
flake = "/path/to/flake";
clean = {
enable = true;
dates = "daily";
};
};
nmt.script = ''
unitDir=home-files/.config/systemd/user
timerFile=$unitDir/nh-clean.timer
assertFileExists $timerFile
assertFileContent $timerFile ${pkgs.writeText "timer-expected" ''
[Install]
WantedBy=timers.target
[Timer]
OnCalendar=daily
Persistent=true
[Unit]
Description=Run nh clean
''}
assertFileExists $unitDir/timers.target.wants/nh-clean.timer
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh 'NH_FLAKE="/path/to/flake"'
'';
}