Created
February 25, 2018 07:16
-
-
Save pjan/8a281e79409fc702d70bd03bbd7499c6 to your computer and use it in GitHub Desktop.
nix overlay for the creation of mac applications
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
# overlays/pkgs/osx/dash/default.nix | |
{ pkgs }: | |
with pkgs; osx.mkAppDerivation rec { | |
name = "Dash"; | |
sourceRoot = "Dash.app"; | |
src = fetchurl { | |
url = "https://kapeli.com/downloads/v4/Dash.zip"; | |
sha256 = "073fzga9gra5rln7cixj50h7c6zgajhd2jibslkx2qrdbry67mc4"; | |
}; | |
meta = { | |
version = "4.1.3"; | |
description = "API Documentation Browser and Code Snippet Manager"; | |
homepage = https://kapeli.com/dash; | |
}; | |
} |
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
# overlays/mkAppDerivation.nix | |
self: super: | |
let | |
mkAppDerivation = | |
{ name | |
, ... | |
} @ args: | |
let | |
drvName = | |
let | |
root = builtins.replaceStrings [ " " ] [ "-" ] name; | |
suffix = | |
if (super.lib.hasAttrByPath [ "meta" "version" ] args) | |
then ''-${super.lib.getAttrFromPath [ "meta" "version" ] args}'' | |
else ""; | |
in "${root}${suffix}"; | |
in with super; stdenv.mkDerivation (args // { | |
name = drvName; | |
buildInputs = [ undmg unzip ]; | |
phases = [ "unpackPhase" "installPhase" "fixupPhase" ]; | |
installPhase = '' | |
mkdir -p "$out/Applications/${name}.app" | |
cp -pR * "$out/Applications/${name}.app" | |
''; | |
}); | |
in rec { | |
osx = { | |
inherit mkAppDerivation; | |
}; | |
} |
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
# overlays/pkgs.nix | |
self: super: | |
rec { | |
dash = super.callPackage ./pkgs/osx/dash { }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment