Skip to content

Instantly share code, notes, and snippets.

@Qyriad
Created February 4, 2024 23:38
Show Gist options
  • Save Qyriad/a81f644c0199076577726983bd7f533a to your computer and use it in GitHub Desktop.
Save Qyriad/a81f644c0199076577726983bd7f533a to your computer and use it in GitHub Desktop.
Hammerspoon package definition for Nix
{
lib,
stdenvNoCC,
fetchurl,
unzip,
}:
# This cannot be built from source since Hammerspoon requires entitlements to work,
# and codesigning entitlements is unfortunately incompatible with immutability.
stdenvNoCC.mkDerivation (self: {
pname = "hammerspoon";
version = "0.9.100";
# We don't use fetchzip because that seems to unpack the .app as well.
src = fetchurl {
name = "${self.pname}-${self.version}-source.zip";
url = "https://github.com/Hammerspoon/hammerspoon/releases/download/${self.version}/Hammerspoon-${self.version}.zip";
sha256 = "sha256-bc/IB8fOxpLK87GMNsweo69rn0Jpm03yd3NECOTgc5k=";
};
nativeBuildInputs = [
# Adds unpack hook.
unzip
];
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -r ../Hammerspoon.app $out/Applications/
runHook postInstall
'';
meta = {
homepage = "https://www.hammerspoon.org";
description = "Staggeringly powerful macOS desktop automation with Lua";
license = lib.licenses.mit;
platforms = [ "x86_64-darwin" "aarch64-darwin" ];
};
})
@geoffreygarrett
Copy link

Much appreciated for the share.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment