nh: fix clean option behaviour for Darwin

This commit is contained in:
Ali Jamadi 2025-06-30 16:52:30 -06:00 committed by Austin Horstman
parent 78fc50f1cf
commit e8a3e2c1e0
6 changed files with 77 additions and 5 deletions

View file

@ -0,0 +1,22 @@
{
programs.nh = {
enable = true;
flake = "/path/to/flake";
clean = {
enable = true;
dates = "weekly";
};
};
nmt.script = ''
serviceFile="LaunchAgents/org.nix-community.home.nh-clean.plist"
serviceFileNormalized="$(normalizeStorePaths "$serviceFile")"
assertFileExists $serviceFile
assertFileContent $serviceFileNormalized ${./launchd.plist}
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh 'NH_FLAKE="/path/to/flake"'
'';
}

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.nix-community.home.nh-clean</string>
<key>ProgramArguments</key>
<array>
<string>@nh@/bin/nh</string>
<string>clean</string>
<string>user</string>
</array>
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Hour</key>
<integer>0</integer>
<key>Minute</key>
<integer>0</integer>
<key>Weekday</key>
<integer>1</integer>
</dict>
</array>
</dict>
</plist>

View file

@ -1,4 +1,7 @@
{ lib, pkgs, ... }:
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
nh = ./nh.nix;
}
(lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin {
nh = ./darwin/config.nix;
})
// (lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
nh = ./linux/config.nix;
})