Skip to content

Instantly share code, notes, and snippets.

@J-Swift
Created April 19, 2022 15:31
Show Gist options
  • Save J-Swift/364a8b158bf0b603f6e784e454ca6e53 to your computer and use it in GitHub Desktop.
Save J-Swift/364a8b158bf0b603f6e784e454ca6e53 to your computer and use it in GitHub Desktop.
Basic example of installing a binary through nix home manager
{ config, lib, pkgs, options, ... }:
let
carthage = pkgs.stdenv.mkDerivation rec {
pname = "carthage";
version = "0.38.0";
src = pkgs.fetchurl {
url = "https://github.com/Carthage/Carthage/releases/download/${version}/Carthage.pkg";
sha256 = "1d5s160vbd3c3fvx93zq7aw0qgp1l95ri3ayskjg7cc8c2qk1s0f";
};
# if on a mac
dontStrip = true;
unpackCmd = ''
mkdir -p out
cp "$curSrc" out/
'';
installPhase = ''
mkdir -p $out/bin
/usr/sbin/pkgutil --expand-full "$src" out
cp out/*.pkg/Payload/usr/local/bin/carthage $out/bin/
chmod +x $out/bin/carthage
'';
};
in {
home.packages = [
carthage
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment