1 { stdenv, lib, fetchzip, makeWrapper, nodejs, writeScript }:
8 url = "https://cli-assets.heroku.com/versions/8.11.4/501330b/heroku-v8.11.4-501330b-linux-x64.tar.xz";
9 hash = "sha256-Q8kXXsk2VGNLv4LyUqnN3Rapozac/jgkyhSnkBOcDmo=";
12 nativeBuildInputs = [ makeWrapper ];
17 mkdir -p $out/share/heroku $out/bin
18 cp -pr * $out/share/heroku
19 substituteInPlace $out/share/heroku/bin/run \
20 --replace "/usr/bin/env node" "${nodejs}/bin/node"
21 makeWrapper $out/share/heroku/bin/run $out/bin/heroku \
22 --set HEROKU_DISABLE_AUTOUPDATE 1
25 passthru.updateScript = writeScript "update-heroku" ''
26 #!/usr/bin/env nix-shell
27 #!nix-shell -I nixpkgs=./. -i bash -p nix-prefetch curl jq common-updater-scripts
29 curl -L "https://cli-assets.heroku.com/versions/heroku-linux-x64-tar-xz.json" \
30 | jq '[to_entries[] | { version: .key, url: .value } | select(.version|contains("-")|not)] | sort_by(.version|split(".")|map(tonumber)) | .[-1]'
32 url="$(jq <<<"$resp" .url --raw-output)"
33 version="$(jq <<<"$resp" .version --raw-output)"
34 hash="$(nix-prefetch fetchzip --url "$(jq <<<"$resp" .url --raw-output)")"
35 update-source-version heroku "$version" "$hash" "$url"
39 homepage = "https://devcenter.heroku.com/articles/heroku-cli";
40 description = "Everything you need to get started using Heroku";
41 mainProgram = "heroku";
42 maintainers = with lib.maintainers; [ aflatter mirdhyn marsam ];
43 license = lib.licenses.mit;
44 platforms = with lib.platforms; unix;