feat(darwin): more provisioned apps
This commit is contained in:
parent
80fc71d327
commit
6d4c7a62a7
5 changed files with 81 additions and 6 deletions
|
@ -14,6 +14,11 @@
|
|||
alacritty
|
||||
raycast
|
||||
karabiner
|
||||
wireguard
|
||||
brave
|
||||
forkgram
|
||||
snipaste
|
||||
nekoray
|
||||
]))
|
||||
(import (abs "users/teidesu/darwin.nix") {})
|
||||
];
|
||||
|
|
|
@ -14,13 +14,13 @@ rec {
|
|||
withMountedDmg = path: shell: ''
|
||||
_result=$(hdiutil mount ${path} | tail -n1)
|
||||
DMG_DEVICE=$(echo "$_result" | awk '{print $1}')
|
||||
DMG_MOUNTPOINT=$(echo "$_result" | awk '{print $3}')
|
||||
DMG_MOUNTPOINT=$(echo "$_result" | perl -lane 'print "@F[2..$#F]"')
|
||||
unset _result
|
||||
|
||||
function _unmount {
|
||||
hdiutil unmount $DMG_DEVICE > /dev/null
|
||||
}
|
||||
trap _unmount ERR exit
|
||||
# trap _unmount ERR exit
|
||||
|
||||
${shell}
|
||||
|
||||
|
@ -65,4 +65,36 @@ rec {
|
|||
rm -rf $DOWNLOADED_FILE
|
||||
fi
|
||||
'';
|
||||
|
||||
downloadAndInstallZipApp = {
|
||||
url,
|
||||
filename,
|
||||
params ? "",
|
||||
renameTo ? null,
|
||||
afterInstall ? ""
|
||||
}: let
|
||||
conditionFile = if renameTo == null then filename else renameTo;
|
||||
in ''
|
||||
if [ ! -d "/Applications/"${lib.escapeShellArg (builtins.baseNameOf conditionFile)} ]; then
|
||||
${download { inherit url params; }}
|
||||
tmpdir=$(mktemp -d)
|
||||
unzip -q $DOWNLOADED_FILE -d $tmpdir
|
||||
|
||||
if [ ! -d "$tmpdir/"${lib.escapeShellArg filename} ]; then
|
||||
echo "Error: file not found:" ${lib.escapeShellArg filename}
|
||||
rm -rf $DOWNLOADED_FILE $tmpdir
|
||||
exit 1
|
||||
fi
|
||||
|
||||
${if (renameTo != null) then ''
|
||||
mv "$tmpdir/"${lib.escapeShellArg filename} "$tmpdir/"${lib.escapeShellArg renameTo}
|
||||
mv "$tmpdir/"${lib.escapeShellArg renameTo} /Applications
|
||||
'' else ''
|
||||
mv "$tmpdir/"${lib.escapeShellArg filename} /Applications
|
||||
''}
|
||||
rm -rf $DOWNLOADED_FILE $tmpdir
|
||||
|
||||
${afterInstall}
|
||||
fi
|
||||
'';
|
||||
}
|
|
@ -9,7 +9,9 @@
|
|||
# i'll just handle dmg's myself :D
|
||||
|
||||
let
|
||||
repo = pkgs.callPackage ./productivity.nix {};
|
||||
repo =
|
||||
(pkgs.callPackage ./productivity.nix {})
|
||||
// (pkgs.callPackage ./system.nix {});
|
||||
in appsFactory: {
|
||||
system.activationScripts.postUserActivation.text = ''
|
||||
set -eau
|
||||
|
|
|
@ -8,14 +8,25 @@ in with common; {
|
|||
filename = "Raycast.app";
|
||||
};
|
||||
|
||||
brave = downloadAndInstallDmgApp {
|
||||
url = "https://referrals.brave.com/latest/BRV010/Brave-Browser.dmg";
|
||||
filename = "Brave Browser.app";
|
||||
};
|
||||
|
||||
snipaste = downloadAndInstallDmgApp {
|
||||
url = "https://dl.snipaste.com/mac-beta";
|
||||
filename = "Snipaste.app";
|
||||
};
|
||||
|
||||
karabiner = downloadAndInstallDmgPkg {
|
||||
url = "https://github.com/pqrs-org/Karabiner-Elements/releases/download/v14.13.0/Karabiner-Elements-14.13.0.dmg";
|
||||
filename = "Karabiner-Elements.pkg";
|
||||
condition = "! -d /Applications/Karabiner-Elements.app";
|
||||
};
|
||||
|
||||
alacritty = downloadAndInstallDmgApp {
|
||||
url = "https://github.com/alacritty/alacritty/releases/download/v0.13.2/Alacritty-v0.13.2.dmg";
|
||||
filename = "Alacritty.app";
|
||||
forkgram = downloadAndInstallZipApp {
|
||||
url = "https://github.com/forkgram/tdesktop/releases/download/v4.16.10/Forkgram.macOS.no.auto-update_arm64.zip";
|
||||
filename = "Telegram.app";
|
||||
renameTo = "Forkgram.app";
|
||||
};
|
||||
}
|
25
lib/darwin/apps/system.nix
Normal file
25
lib/darwin/apps/system.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{ callPackage }:
|
||||
|
||||
let
|
||||
common = callPackage ./common.nix {};
|
||||
in with common; {
|
||||
wireguard = downloadAndInstallZipApp {
|
||||
url = "https://s3.tei.su/wireguard-mac-1.0.16.zip";
|
||||
filename = "WireGuard.app";
|
||||
};
|
||||
|
||||
nekoray = downloadAndInstallZipApp {
|
||||
url = "https://github.com/abbasnaqdi/nekoray-macos/releases/download/3.26/nekoray_arm64.zip";
|
||||
filename = "nekoray_arm64.app";
|
||||
renameTo = "nekoray.app";
|
||||
# https://github.com/abbasnaqdi/nekoray-macos/issues/64
|
||||
afterInstall = ''
|
||||
plutil -insert LSUIElement -bool YES /Applications/nekoray.app/Contents/Info.plist
|
||||
'';
|
||||
};
|
||||
|
||||
alacritty = downloadAndInstallDmgApp {
|
||||
url = "https://github.com/alacritty/alacritty/releases/download/v0.13.2/Alacritty-v0.13.2.dmg";
|
||||
filename = "Alacritty.app";
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue