restructed modules for home and work, untested
This commit is contained in:
45
profiles/personal/archive-installs.nix
Normal file
45
profiles/personal/archive-installs.nix
Normal file
@@ -0,0 +1,45 @@
|
||||
{ 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)
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user