diff --git a/flake.nix b/flake.nix index a1d8017..4b64464 100644 --- a/flake.nix +++ b/flake.nix @@ -29,6 +29,11 @@ "aarch64-linux" "aarch64-darwin" ]; + + # Add overlay for custom packages + overlay = final: prev: { + hammerspoon = final.callPackage ./modules/hammerspoon.nix { }; + }; in { lib = { @@ -85,6 +90,13 @@ self = self; }; modules = [ + # Add our overlay to the system configuration + ( + { pkgs, ... }: + { + nixpkgs.overlays = [ overlay ]; + } + ) mac-app-util.darwinModules.default ./darwin/common.nix ./darwin/lcech-mac-veracode.nix diff --git a/home-manager/lcech-mac-veracode.nix b/home-manager/lcech-mac-veracode.nix index 66a08d6..2783ce6 100644 --- a/home-manager/lcech-mac-veracode.nix +++ b/home-manager/lcech-mac-veracode.nix @@ -18,6 +18,7 @@ in home.packages = with pkgs; [ awscli2 + hammerspoon k9s kubectl nixd @@ -35,6 +36,11 @@ in window-height = 9999 ''; }; + "${homedir}/.hammerspoon/init.lua" = { + text = '' + + ''; + }; }; programs.direnv = { diff --git a/modules/hammerspoon.nix b/modules/hammerspoon.nix new file mode 100644 index 0000000..0fc6d6b --- /dev/null +++ b/modules/hammerspoon.nix @@ -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" + ]; + }; +})