dots/modules/darwin/nix.nix
Nico 608d22a71a darwin: use a new script for copying nix-managed apps to /Applications
copies the files over now, better indexability from spotlight
2025-05-03 16:34:35 +10:00

37 lines
961 B
Nix

{ config, lib, pkgs, ... }:
{
system.activationScripts.applications.text = let
appsSrc = config.system.build.applications + /Applications;
baseDir = "/Applications/Nix Apps";
in
pkgs.lib.mkForce ''
echo 'Setting up /Applications/Nix Apps...' >&2
appsSrc="${appsSrc}"
if [ -d "$appsSrc" ]; then
baseDir="${baseDir}"
rsyncFlags=(
--archive
--checksum
--chmod=-w
--copy-unsafe-links
--delete
--no-group
--no-owner
)
$DRY_RUN_CMD mkdir -p "$baseDir"
$DRY_RUN_CMD ${lib.getBin pkgs.rsync}/bin/rsync \
''${VERBOSE_ARG:+-v} "''${rsyncFlags[@]}" "$appsSrc/" "$baseDir"
fi
'';
# nix auto garbage collection
nix.gc = {
automatic = true;
interval = { Weekday = 0; Hour = 0; Minute = 0; };
options = "--delete-older-than 7d";
};
# changing this might break
system.stateVersion = 5;
}