changed cupsadmin

This commit is contained in:
2026-11-07 08:07:54 -05:00
parent f36234ea8c
commit b4ce55c151

View File

@@ -1,19 +1,24 @@
{ inputs, ... }:
{ inputs, pkgs, ... }:
let
cupsadminPkg = pkgs.fetchurl {
url = "https://github.com/kfattic/cupsadmin/releases/download/v1.4.1/cupsadmin-1.4.1.pkg";
hash = "sha256-DyIyDYSjAlcU7ivyfldMapIZw5nczEBXfnLicnK6k7Y=";
};
in
{
system.activationScripts.postActivation.text = ''
stamp=/usr/local/share/cupsadmin.stamp
want="${inputs.cupsadmin}"
want="${cupsadminPkg}"
stamp=/usr/local/share/cupsadmin-pkg.stamp
if [ "$(cat "$stamp" 2>/dev/null)" != "$want" ]; then
echo "building cupsadmin..."
tmp=$(mktmp -d)
cp -R "$want"/. "$tmp"
chmod -R u+w "$tmp"
( cd "$tmp" && /user/bin/swift build -c release ) \
&& install -m 755 "$tmp/.build/release/cupsadmin" /usr/local/bin/cupsadmin \
&& mkdir -p /usr/local/share && echo #$want" > "$stamp" \
|| echo "cupsadmin build failed, skipping"
rm -rf "$tmp"
echo "installing cupsadmin..."
if /usr/sbin/installer -pkg "$want" -target /; then
mkdir -p /usr/local/share
echo "$want" > "$stamp"
else
echo "cupsadmin install failed, skipping"
fi
fi
'';