2024-03-25 23:34:10 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
2024-08-31 08:27:10 +00:00
|
|
|
nix = pkgs.runCommand "nix-2.2" { } "mkdir -p $out";
|
2024-03-25 23:34:10 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
nix.optimise.automatic = true;
|
|
|
|
nix.optimise.user = "nixuser";
|
|
|
|
nix.package = nix;
|
|
|
|
|
|
|
|
test = ''
|
|
|
|
echo checking nix-optimise service in /Library/LaunchDaemons >&2
|
|
|
|
grep "<string>org.nixos.nix-optimise</string>" \
|
|
|
|
${config.out}/Library/LaunchDaemons/org.nixos.nix-optimise.plist
|
2024-08-31 08:27:10 +00:00
|
|
|
grep "<string>/bin/wait4path /nix/store && exec ${nix}/bin/nix-store --optimise</string>" \
|
2024-03-25 23:34:10 +00:00
|
|
|
${config.out}/Library/LaunchDaemons/org.nixos.nix-optimise.plist
|
|
|
|
grep "<key>UserName</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-optimise.plist
|
|
|
|
grep "<string>nixuser</string>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-optimise.plist
|
|
|
|
(! grep "<key>KeepAlive</key>" ${config.out}/Library/LaunchDaemons/org.nixos.nix-optimise.plist)
|
|
|
|
|
|
|
|
echo checking nix-optimise validation >&2
|
|
|
|
(! grep "nix.optimise.user = " ${config.out}/activate-user)
|
|
|
|
'';
|
|
|
|
}
|