nixpkgs/pkgs/by-name/ex/exoscale-cli/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

47 lines
1.2 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:
buildGoModule rec {
pname = "exoscale-cli";
version = "1.77.2";
src = fetchFromGitHub {
owner = "exoscale";
repo = "cli";
rev = "v${version}";
sha256 = "sha256-hVuQBdmVBEwioNYHPUneF5Ink12Lh5cdS7UU2hd6SXs=";
};
vendorHash = null;
nativeBuildInputs = [ installShellFiles ];
ldflags = [ "-s" "-w" "-X main.version=${version}" "-X main.commit=${src.rev}" ];
# we need to rename the resulting binary but can't use buildFlags with -o here
# because these are passed to "go install" which does not recognize -o
postBuild = ''
mv $GOPATH/bin/cli $GOPATH/bin/exo
mkdir -p manpage
$GOPATH/bin/docs --man-page
rm $GOPATH/bin/docs
$GOPATH/bin/completion bash
$GOPATH/bin/completion zsh
rm $GOPATH/bin/completion
'';
postInstall = ''
installManPage manpage/*
installShellCompletion --cmd exo --bash bash_completion --zsh zsh_completion
'';
meta = {
description = "Command-line tool for everything at Exoscale: compute, storage, dns";
homepage = "https://github.com/exoscale/cli";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ viraptor ];
mainProgram = "exo";
};
}