Helper for packaging/grabbing osx apps; use it for OBS, keycastr, vlc
This commit is contained in:
parent
b7b1f88956
commit
7f724256b9
2 changed files with 85 additions and 2 deletions
|
|
@ -1,5 +1,35 @@
|
|||
{ config, pkgs, ... }:
|
||||
let
|
||||
obs-studio = pkgs.callPackage ./makeApp.nix rec {
|
||||
name = "OBS";
|
||||
version = "29.1.1";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://cdn-fastly.obsproject.com/downloads/obs-studio-${version}-macos-arm64.dmg";
|
||||
sha256 = "07rhswgx3zqpn32n4ipf34zjjm2cx8fmrb7gliiw6hskwcbbs3yi";
|
||||
};
|
||||
};
|
||||
|
||||
vlc =
|
||||
pkgs.callPackage ./makeApp.nix rec {
|
||||
name = "VLC";
|
||||
version = "3.0.18";
|
||||
sourceRoot = "${name}.app";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://get.videolan.org/vlc/3.0.18/macosx/vlc-${version}-arm64.dmg";
|
||||
sha256 = "0iwgcrwcfyw0r41kjx4hx1sy37mzx5q8nlbzh58gs8ajpjymkhlr";
|
||||
};
|
||||
};
|
||||
|
||||
keycastr =
|
||||
pkgs.callPackage ./makeApp.nix rec {
|
||||
name = "KeyCastr";
|
||||
version = "0.9.13";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/keycastr/keycastr/releases/download/v${version}/KeyCastr.app.zip";
|
||||
sha256 = "1pp0gslq53azhbbyxp12gjy9iaysrf56l16swqdaf4z21p7iag7k";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
|
@ -15,9 +45,11 @@
|
|||
pkgs.slack
|
||||
pkgs._1password
|
||||
pkgs.tailscale
|
||||
obs-studio
|
||||
vlc
|
||||
keycastr
|
||||
|
||||
# wishlist
|
||||
# LICEcap
|
||||
# keycastr
|
||||
# todo (unsupported on aarch64-darwin):
|
||||
# pkgs.spotify
|
||||
# pkgs.firefox
|
||||
|
|
|
|||
51
nix/system/worktop/makeApp.nix
Normal file
51
nix/system/worktop/makeApp.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{ name
|
||||
, appname ? name
|
||||
, version
|
||||
, src
|
||||
, sourceRoot ? "."
|
||||
, # from nix
|
||||
pkgs
|
||||
, stdenv
|
||||
, unzip
|
||||
, ...
|
||||
}:
|
||||
if stdenv.isDarwin then
|
||||
pkgs.stdenv.mkDerivation
|
||||
{
|
||||
name = "${name}-${version}";
|
||||
version = "${version}";
|
||||
src = src;
|
||||
|
||||
sourceRoot = "${appname}.app";
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
unpackCmd = ''
|
||||
echo "File to unpack: $curSrc"
|
||||
if ! [[ "$curSrc" =~ \.dmg$ ]]; then return 1; fi
|
||||
mnt=$(mktemp -d -t ci-XXXXXXXXXX)
|
||||
|
||||
function finish {
|
||||
echo "Detaching $mnt"
|
||||
/usr/bin/hdiutil detach $mnt -force
|
||||
rm -rf $mnt
|
||||
}
|
||||
trap finish EXIT
|
||||
|
||||
echo "Attaching $mnt"
|
||||
/usr/bin/hdiutil attach -nobrowse -readonly $src -mountpoint $mnt
|
||||
|
||||
echo "What's in the mount dir"?
|
||||
ls -la $mnt/
|
||||
|
||||
echo "Copying contents"
|
||||
shopt -s extglob
|
||||
DEST="$PWD"
|
||||
(cd "$mnt"; cp -a !(Applications) "$DEST/")
|
||||
'';
|
||||
nativeBuildInputs = [ pkgs.unzip ];
|
||||
installPhase = ''
|
||||
mkdir -p $out/Applications/${appname}.app
|
||||
cp -a ./. $out/Applications/${appname}.app/
|
||||
'';
|
||||
}
|
||||
else
|
||||
{ }
|
||||
Loading…
Add table
Add a link
Reference in a new issue