-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fastly: init at 3.1.0 #179467
fastly: init at 3.1.0 #179467
Conversation
Why not just use |
It's a tarball that contains a binary. |
It'll be preferable to build the package from source instead of just using a prebuilt binary. We had a discussion about that recently. I think building it would be relatively easy with |
In any case, if someone is interested and finds what's going on, this is the diff on top of this PR to generate the completions: diff --git a/pkgs/misc/fastly/default.nix b/pkgs/misc/fastly/default.nix
index a42c9b26976..bf59fee42ec 100644
--- a/pkgs/misc/fastly/default.nix
+++ b/pkgs/misc/fastly/default.nix
@@ -45,6 +45,12 @@ stdenv.mkDerivation {
runHook postInstall
'';
+ postInstall = ''
+ $out/bin/fastly --completion-script-bash > fastly.bash
+ $out/bin/fastly --completion-script-zsh > fastly.zsh
+ installShellCompletion fastly.{bash,zsh}
+ '';
+
meta = with lib; {
description = "Command line tool for interacting with the Fastly API";
license = licenses.asl20; When trying to build it on
I can change it to use |
Yup, I can give it a shot. |
@azahi: updated to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, don't merge yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change mentioned in the existing thread, also:
PR title and commit need the v prefix removed
bd138be
to
b561e6f
Compare
Ok, this is ready now. Thanks for the pointers :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
f933b7a
to
9abb3bb
Compare
53e272e
to
ba38c08
Compare
]; | ||
preBuild = '' | ||
ldflags+=" -X github.com/fastly/cli/pkg/revision.GitCommit=$(cat COMMIT)" | ||
ldflags+=" -X 'github.com/fastly/cli/pkg/revision.GoVersion=$(go version)'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upstream's HEAD has a fix for GoVersion
handling introduced in fastly/cli@8ef2fd9.
In the next release, you can eliminate running go version
and passing the output in favor of passing GoHostOS
and GoHostArch
in ldflags and letting it render a proper version.
{lib, fetchFromGithub, [...], go} :
[...]
ldflags = [
...
"-X github.com/fastly/cli/pkg/revision.GoHostOS=${go.GOOS}"
"-X github.com/fastly/cli/pkg/revision.GoHostArch=${go.GOARCH}"
];
diff --git a/pkgs/misc/fastly/default.nix b/pkgs/misc/fastly/default.nix
index 1a376271d18..2028f3f9bcf 100644
--- a/pkgs/misc/fastly/default.nix
+++ b/pkgs/misc/fastly/default.nix
@@ -1,14 +1,14 @@
-{ lib, fetchFromGitHub, installShellFiles, buildGoModule }:
+{ lib, fetchFromGitHub, installShellFiles, buildGoModule, go }:
buildGoModule rec {
pname = "fastly";
- version = "3.1.0";
+ version = "HEAD";
src = fetchFromGitHub {
owner = "fastly";
repo = "cli";
- rev = "v${version}";
- sha256 = "sha256-Su4ZwiuI+pMoLAGhc3dWcwgcfwe5cZGTg8kEnpM4JbA=";
+ rev = "HEAD";
+ sha256 = "sha256-hVcL7kK+UL3HCrtHU4Jq16DcItWBBo4dnhy7PzNrD+I=";
# 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,
@@ -34,10 +34,11 @@ buildGoModule rec {
"-w"
"-X github.com/fastly/cli/pkg/revision.AppVersion=v${version}"
"-X github.com/fastly/cli/pkg/revision.Environment=release"
+ "-X github.com/fastly/cli/pkg/revision.GoHostOS=${go.GOOS}"
+ "-X github.com/fastly/cli/pkg/revision.GoHostArch=${go.GOARCH}"
];
preBuild = ''
ldflags+=" -X github.com/fastly/cli/pkg/revision.GitCommit=$(cat COMMIT)"
- ldflags+=" -X 'github.com/fastly/cli/pkg/revision.GoVersion=$(go version)'"
'';
postInstall = ''
% nix run .#fastly -- version
[...]
Fastly CLI version vHEAD (5b0d8ee)
Built with go version go1.17.11 linux/amd64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, thanks @bdd!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GoVersion will continue to work too but yes, the more nix-ie way would be to pull from go.
As a note those are the wrong values. It needs to be go.GOHOSTOS
and °go.GOHOSTARCH` for the build host details rather than build target details
https://github.com/NixOS/nixpkgs/blob/nixos-22.05/pkgs/development/compilers/go/1.17.nix#L201
GOOS and GOARCH for the target (running) system are available in the runtime package. This was covered in the other comment and PR
Description of changes
Supersedes #170077
I could not make the shell completions to work on all my environments. I managed to make it work for
x86_64-darwin
but not forx86_64-linux
with weird errors about thefastly
binary not being found.I can look into that, but in the meantime we have a basic working
fastly
binary.Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes