added option for global and per profile pkg and zip installs

This commit is contained in:
2026-11-09 13:41:03 -05:00
parent 00147ba242
commit 0a9ede2ba8
6 changed files with 70 additions and 51 deletions

View File

@@ -1,6 +1,15 @@
{ pkgs, ... }:
{
archiveApps = [
{
name = "removemacai-app";
app = "RemoveMacAI.app";
url = "https://github.com/omlahore/RemoveMacAI/releases/download/v1.1.4/RemoveMacAI.zip";
sha256 = "2063d4dc7e0b41b15cebcd9e1b9807b04615b96e3e23db35cbd1196be3c96bee";
}
];
environment.systemPackages = with pkgs; [
ffmpeg
flac

View File

@@ -1,45 +0,0 @@
{ pkgs, lib, ... }:
let
stampDir = "/usr/local/share/nix-pkg-stamps";
apps = [
{
name = "removemacai-app";
app = "RemoveMacAI.app";
url = "https://github.com/omlahore/RemoveMacAI/releases/download/v1.1.4/RemoveMacAI.zip";
sha256 = "2063d4dc7e0b41b15cebcd9e1b9807b04615b96e3e23db35cbd1196be3c96bee";
}
];
appScript = a:
let
src = pkgs.fetchurl { inherit (a) url sha256; };
in ''
stamp="${stampDir}/${a.name}"
want="${src}"
if [ "$(cat "$stamp" 2>/dev/null)" != "$want" ]; then
echo "installing ${a.name}..."
tmp=$(mktemp -d)
if /usr/bin/unzip -q "$want" -d "$tmp"; then
if [ -d "$tmp/${a.app}" ]; then
rm -rf "/Applications/${a.app}"
/usr/bin/ditto "$tmp/${a.app}" "/Applications/${a.app}"
mkdir -p "${stampDir}"
echo "$want" > "$stamp"
else
echo "${a.name}: ${a.app} not found in zip, skipping"
fi
else
echo "${a.name}: could not unzip, skipping"
fi
rm -rf "$tmp"
fi
'';
in
{
system.activationScripts.postActivation.text =
lib.concatStringsSep "\n" (
(map appScript apps)
);
}