Created
October 27, 2017 18:54
-
-
Save dustinlacewell-wk/913db996993fd3aa6a488fc42b94c65e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, pkgs, lib, ... }: | |
with import <home-manager/modules/lib/dag.nix> { inherit lib; }; | |
let | |
version = "0.9.57"; | |
release = pkgs.fetchzip { | |
name = "Hammerspoon.app"; | |
url = "https://github.com/Hammerspoon/hammerspoon/releases/download/${version}/Hammerspoon-${version}.zip"; | |
sha256 = "12j9vylcxb7i3bn0v5x6zbxmnyyp7gh4am4vg48yv3hb54i73klx"; | |
}; | |
package = pkgs.stdenv.mkDerivation { | |
name = "Hammerspoon-${version}"; | |
builder = builtins.toFile "builder.sh" " | |
source $stdenv/setup | |
mkdir -p $out/Applications/Hammerspoon.app | |
echo ${release} | |
echo $out | |
"; | |
}; | |
in { | |
home.packages = [ package ]; | |
home.activation.hammerspoon = dagEntryAfter["linkgeneration"] (let | |
linkName = "Hammerspoon.app"; | |
home = config.home.homeDirectory; | |
applications = "${home}/.nix-profile/Applications"; | |
source = "${applications}/${linkName}"; | |
target = "${home}/Applications/"; | |
in '' | |
rm -f ${target} | |
osascript << EOF | |
tell application "Finder" | |
set mySource to POSIX file "${source}" as alias | |
make new alias to mySource at POSIX file "${target}" | |
set name of result to "${linkName}" | |
end tell | |
EOF | |
''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment