fastly: use viceroy from nix

This commit is contained in:
Rafael Fernández López 2023-03-07 22:39:05 +01:00 committed by Cole Helbling
parent 8d8f5ede91
commit 737e372a78

View File

@ -4,17 +4,19 @@
, installShellFiles
, buildGoModule
, go
, makeWrapper
, viceroy
}:
buildGoModule rec {
pname = "fastly";
version = "7.0.1";
version = "8.0.0";
src = fetchFromGitHub {
owner = "fastly";
repo = "cli";
rev = "refs/tags/v${version}";
hash = "sha256-6M1vdwtw+qjKldW642JN2sanaKV3u9J1qWAoLRNupzE=";
hash = "sha256-Bwof1Np0eSjmBXQ6dqFmw3TA/2u+VzzyIn/95m9eXVo=";
# The git commit is part of the `fastly version` original output;
# leave that output the same in nixpkgs. Use the `.git` directory
# to retrieve the commit SHA, and remove the directory afterwards,
@ -31,10 +33,11 @@ buildGoModule rec {
"cmd/fastly"
];
vendorHash = "sha256-oQwlhlZHpUvGaOyozBpK5W9glzo8VKH7S3vih5c15OA=";
vendorHash = "sha256-/tdvIX839NkhUoj/bfJ/68K8RtPCidydNQZCdDvizzU=";
nativeBuildInputs = [
installShellFiles
makeWrapper
];
# Flags as provided by the build automation of the project:
@ -49,14 +52,19 @@ buildGoModule rec {
];
preBuild = let
cliConfigToml = fetchurl {
url = "https://web.archive.org/web/20230207211120/https://developer.fastly.com/api/internal/cli-config";
hash = "sha256-Vkl8V5AkiJMZLswSN0vTnz7S7/5lXftlWD5UZh//vUw=";
url = "https://web.archive.org/web/20230308181550/https://developer.fastly.com/api/internal/cli-config";
hash = "sha256-Y2KBTiUQlugKjfhOY+8W7/IUSjgeRVc2NgmL+nhb6aQ=";
};
in ''
cp ${cliConfigToml} ./pkg/config/config.toml
ldflags+=" -X github.com/fastly/cli/pkg/revision.GitCommit=$(cat COMMIT)"
'';
preFixup = ''
wrapProgram $out/bin/fastly --prefix PATH : ${lib.makeBinPath [ viceroy ]} \
--set FASTLY_VICEROY_USE_PATH 1
'';
postInstall = ''
export HOME="$(mktemp -d)"
installShellCompletion --cmd fastly \