1 { lib, fetchurl, fetchFromGitHub, installShellFiles, buildGoModule, go }:
7 src = fetchFromGitHub {
11 sha256 = "sha256-TxN0DQ4OKfHn+u4ixpCgcyRRTs52IZRjgcbJuqajeVo=";
12 # The git commit is part of the `fastly version` original output;
13 # leave that output the same in nixpkgs. Use the `.git` directory
14 # to retrieve the commit SHA, and remove the directory afterwards,
15 # since it is not needed after that.
19 git rev-parse --short HEAD > $out/COMMIT
20 find "$out" -name .git -print0 | xargs -0 rm -rf
24 subPackages = [ "cmd/fastly" ];
26 vendorSha256 = "sha256-7EtyQYPe+oJmQ7uECbjkBjLnM9T03g6gFwUwebKuccc=";
28 nativeBuildInputs = [ installShellFiles ];
30 # Flags as provided by the build automation of the project:
31 # https://github.com/fastly/cli/blob/7844f9f54d56f8326962112b5534e5c40e91bf09/.goreleaser.yml#L14-L18
35 "-X github.com/fastly/cli/pkg/revision.AppVersion=v${version}"
36 "-X github.com/fastly/cli/pkg/revision.Environment=release"
37 "-X github.com/fastly/cli/pkg/revision.GoHostOS=${go.GOHOSTOS}"
38 "-X github.com/fastly/cli/pkg/revision.GoHostArch=${go.GOHOSTARCH}"
41 cliConfigToml = fetchurl {
42 url = "https://web.archive.org/web/20221104122906/https://developer.fastly.com/api/internal/cli-config";
43 sha256 = "sha256-BHsUWrMp//X95gcB+WbD/nfyduZUkH8jHXk3CfOBAhg=";
46 cp ${cliConfigToml} ./pkg/config/config.toml
47 ldflags+=" -X github.com/fastly/cli/pkg/revision.GitCommit=$(cat COMMIT)"
51 export HOME="$(mktemp -d)"
52 installShellCompletion --cmd fastly \
53 --bash <($out/bin/fastly --completion-script-bash) \
54 --zsh <($out/bin/fastly --completion-script-zsh)
58 description = "Command line tool for interacting with the Fastly API";
59 license = licenses.asl20;
60 homepage = "https://github.com/fastly/cli";
61 maintainers = with maintainers; [ ereslibre shyim ];