nix: install multicall binaries in postInstall

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I6a6a69646b6afeb1d9dda8d16e00f6f39b8046ff
This commit is contained in:
raf 2025-10-14 08:39:35 +03:00
commit a94ef7f5b4
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF

View file

@ -1,6 +1,7 @@
{
lib,
craneLib,
versionCheckHook,
}: let
pname = "stash";
version = (builtins.fromTOML (builtins.readFile ../Cargo.toml)).package.version;
@ -14,6 +15,7 @@
(fs.fileFilter (file: builtins.any file.hasExt ["rs"]) (s + /src))
(s + /Cargo.lock)
(s + /Cargo.toml)
(s + /build.rs)
];
};
@ -28,11 +30,32 @@ in
strictDeps = true;
# Whether cargo's target directory should be copied as an output
doInstallCargoArtifacts = true;
# Install Systemd service for Stash into $out/share.
# This can be used to use Stash in 'systemd.packages'
postInstall = ''
mkdir -p $out
install -Dm755 ${../vendor/stash.service} $out/share/stash.service
# Since Crane doesn't have a good way of enforcing that our symlinks
# generated by the build wrapper are correctly linked, we should link
# them *manually*.
for bin in stash-copy stash-paste wl-copy wl-paste; do
ln -sf $out/bin/stash $out/bin/$bin
done
'';
nativeInstallCheckInputs = [versionCheckHook];
doInstallCheck = true;
# After the version check, let's see if all binaries are linked correctly.
# We could probably add a check phase to the versions of each.
postInstallCheck = ''
for bin in stash stash-copy stash-paste wl-copy wl-paste; do
[ -x "$out/bin/$bin" ] || { echo "$bin missing"; exit 1; }
done
'';
meta = {