Merge pull request #312939 from chewblacka/update-apx
This commit is contained in:
@@ -1,33 +1,36 @@
|
||||
{ lib
|
||||
, buildGoModule
|
||||
, fetchFromGitHub
|
||||
, distrobox
|
||||
, installShellFiles
|
||||
{
|
||||
lib,
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
installShellFiles,
|
||||
distrobox,
|
||||
podman,
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "apx";
|
||||
version = "2.4.0";
|
||||
version = "2.4.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Vanilla-OS";
|
||||
repo = "apx";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-OLJrwibw9uX5ty7FRZ0q8zx0i1vQXRKK8reQsJFFxAI=";
|
||||
hash = "sha256-X6nphUzJc/R3Egw09eRQbza1QebpLGsMIfV7BpLOXTc=";
|
||||
};
|
||||
|
||||
vendorHash = null;
|
||||
vendorHash = "sha256-hGi+M5RRUL2oyxFGVeR0sum93/CA+FGYy0m4vDmlXTc=";
|
||||
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
# podman needed for apx to not error when building shell completions
|
||||
nativeBuildInputs = [ installShellFiles podman ];
|
||||
|
||||
ldflags = [ "-s" "-w" ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace config/apx.json \
|
||||
--replace "/usr/share/apx/distrobox/distrobox" "${distrobox}/bin/distrobox" \
|
||||
--replace "/usr/share/apx" "$out/bin/apx"
|
||||
--replace-fail "/usr/share/apx/distrobox/distrobox" "${distrobox}/bin/distrobox" \
|
||||
--replace-fail "/usr/share/apx" "$out/bin/apx"
|
||||
substituteInPlace settings/config.go \
|
||||
--replace "/usr/share/apx/" "$out/share/apx/"
|
||||
--replace-fail "/usr/share/apx/" "$out/share/apx/"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
@@ -35,6 +38,15 @@ buildGoModule rec {
|
||||
installManPage man/man1/*
|
||||
install -Dm444 README.md -t $out/share/docs/apx
|
||||
install -Dm444 COPYING.md $out/share/licenses/apx/LICENSE
|
||||
|
||||
# Create a temp writable home-dir so apx outputs completions without error
|
||||
export HOME=$(mktemp -d)
|
||||
# apx command now works (for completions)
|
||||
# though complains "Error: no such file or directory"
|
||||
installShellCompletion --cmd apx \
|
||||
--bash <($out/bin/apx completion bash) \
|
||||
--fish <($out/bin/apx completion fish) \
|
||||
--zsh <($out/bin/apx completion zsh)
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
|
||||
Reference in New Issue
Block a user