Add hammerspoon

This commit is contained in:
Lukas Cech 2025-01-13 10:28:20 +01:00
parent fd85753fcf
commit e0956a2c52
3 changed files with 59 additions and 0 deletions

View File

@ -29,6 +29,11 @@
"aarch64-linux" "aarch64-linux"
"aarch64-darwin" "aarch64-darwin"
]; ];
# Add overlay for custom packages
overlay = final: prev: {
hammerspoon = final.callPackage ./modules/hammerspoon.nix { };
};
in in
{ {
lib = { lib = {
@ -85,6 +90,13 @@
self = self; self = self;
}; };
modules = [ modules = [
# Add our overlay to the system configuration
(
{ pkgs, ... }:
{
nixpkgs.overlays = [ overlay ];
}
)
mac-app-util.darwinModules.default mac-app-util.darwinModules.default
./darwin/common.nix ./darwin/common.nix
./darwin/lcech-mac-veracode.nix ./darwin/lcech-mac-veracode.nix

View File

@ -18,6 +18,7 @@ in
home.packages = with pkgs; [ home.packages = with pkgs; [
awscli2 awscli2
hammerspoon
k9s k9s
kubectl kubectl
nixd nixd
@ -35,6 +36,11 @@ in
window-height = 9999 window-height = 9999
''; '';
}; };
"${homedir}/.hammerspoon/init.lua" = {
text = ''
'';
};
}; };
programs.direnv = { programs.direnv = {

41
modules/hammerspoon.nix Normal file
View File

@ -0,0 +1,41 @@
{
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 = "1.0.0";
# 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-XbcCtV2kfcMG6PWUjZHvhb69MV3fopQoMioK9+1+an4=";
};
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"
];
};
})