tarsnap: fix cross build, modernize derivation

This commit is contained in:
FliegendeWurst
2025-03-28 23:11:59 +01:00
parent 4534205b61
commit 0f41145f9f
+20 -8
View File
@@ -6,6 +6,7 @@
zlib,
e2fsprogs,
bzip2,
installShellFiles,
}:
let
@@ -23,22 +24,33 @@ stdenv.mkDerivation rec {
sha256 = "1mbzq81l4my5wdhyxyma04sblr43m8p7ryycbpi6n78w1hwfbjmw";
};
preConfigure = ''
configureFlags="--with-bash-completion-dir=$out/share/bash-completion/completions"
'';
configureFlags = [
"--with-bash-completion-dir=${placeholder "out"}/share/bash-completion/completions"
# required for cross builds
"--host=${stdenv.hostPlatform.system}"
];
patchPhase = ''
makeFlags = [
"AR=${stdenv.cc.targetPrefix}ar"
];
postPatch = ''
substituteInPlace Makefile.in \
--replace "command -p mv" "mv"
--replace-fail "command -p mv" "mv"
substituteInPlace configure \
--replace "command -p getconf PATH" "echo $PATH"
--replace-fail "command -p getconf PATH" "echo $PATH"
'';
postInstall = ''
# Install some handy-dandy shell completions
install -m 444 -D ${zshCompletion} $out/share/zsh/site-functions/_tarsnap
# install third-party zsh completions (bash completions already available)
installShellCompletion --cmd tarsnap \
--zsh ${zshCompletion}
'';
nativeBuildInputs = [
installShellFiles
];
buildInputs =
[
openssl