depot/pkgs/by-name/in/incus/client.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

51 lines
967 B
Nix

{
lts ? false,
meta,
patches,
src,
vendorHash,
version,
lib,
buildGoModule,
installShellFiles,
}:
let
pname = "incus${lib.optionalString lts "-lts"}-client";
in
buildGoModule {
inherit
patches
pname
src
vendorHash
version
;
CGO_ENABLED = 0;
nativeBuildInputs = [ installShellFiles ];
subPackages = [ "cmd/incus" ];
postInstall = ''
# Needed for builds on systems with auto-allocate-uids to pass.
# Incus tries to read ~/.config/incus while generating completions
# to resolve user aliases.
export HOME="$(mktemp -d)"
mkdir -p "$HOME/.config/incus"
installShellCompletion --cmd incus \
--bash <($out/bin/incus completion bash) \
--fish <($out/bin/incus completion fish) \
--zsh <($out/bin/incus completion zsh)
'';
# don't run the full incus test suite
doCheck = false;
meta = meta // {
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}