Working nix-darwin config from this Mac
This commit is contained in:
33
pkg-installs.nix
Normal file
33
pkg-installs.nix
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user