1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-02 23:21:02 +01:00
home-manager/tests/modules/programs/nh/linux/config.nix
Foxocube 4e97102bd4
nh: add options for specific flakes (#7566)
* nh: Add options for specific flakes
* nh: Add tests for specific flake options

---------

Co-authored-by: Foxocube <git@foxocube.xyz>
2025-07-31 12:41:29 -05:00

41 lines
1.1 KiB
Nix

{ config, pkgs, ... }:
{
programs.nh = {
enable = true;
package = config.lib.test.mkStubPackage { version = "4.0.0"; };
flake = "/path/to/flake";
osFlake = "/path/to/osFlake";
homeFlake = "/path/to/homeFlake";
darwinFlake = "/path/to/darwinFlake";
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"'
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh 'NH_OS_FLAKE="/path/to/osFlake"'
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh 'NH_HOME_FLAKE="/path/to/homeFlake"'
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh 'NH_DARWIN_FLAKE="/path/to/darwinFlake"'
'';
}