Working nix-darwin config from this Mac

This commit is contained in:
Brian Nelson
2026-11-08 11:55:45 -05:00
commit ee735ee782
7 changed files with 350 additions and 0 deletions

33
pkg-installs.nix Normal file
View File

@@ -0,0 +1,33 @@
{ pkgs, lib, ... }:
let
# Add one entry per program you want to install from a .pkg file
pkgInstalls = [
{
name = "cupsadmin";
url = "https://github.com/kfattic/cupsadmin/releases/download/v1.4.1/cupsadmin-1.4.1.pkg";
hash = "sha256-DyIyDYSjAlcU7ivyfldMapIZw5nczEBXfnLicnK6k7Y=";
}
];
installScript = p:
let
src = pkgs.fetchurl { inherit (p) url hash; };
in ''
stamp="/usr/local/share/nix-pkg-stamps/${p.name}"
want="${src}"
if [ "$(cat "$stamp" 2>/dev/null)" != "$want" ]; then
echo "installing ${p.name}..."
if /usr/sbin/installer -pkg "$want" -target /; then
mkdir -p /usr/local/share/nix-pkg-stamps
echo "$want" > "$stamp"
else
echo "${p.name} install failed, skipping"
fi
fi
'';
in
{
system.activationScripts.postActivation.text =
lib.concatMapStringsSep "\n" installScript pkgInstalls;
}