nix: add platforms to meta; allow overriding symlink behaviour

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ib6e44abd86bd0e58f290b456680a97236a6a6964
This commit is contained in:
raf 2026-02-26 09:11:43 +03:00
commit 4d58cae50d
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF

View file

@ -4,9 +4,10 @@
stdenv, stdenv,
mold, mold,
versionCheckHook, versionCheckHook,
createSymlinks ? true,
}: let }: let
pname = "stash"; pname = "stash";
version = (builtins.fromTOML (builtins.readFile ../Cargo.toml)).package.version; version = (lib.importTOML ../Cargo.toml).package.version;
src = let src = let
fs = lib.fileset; fs = lib.fileset;
s = ../.; s = ../.;
@ -36,7 +37,7 @@ in
# generated by the build wrapper are correctly linked, we should link # generated by the build wrapper are correctly linked, we should link
# them *manually*. The postInstallCheck phase that follows will check # them *manually*. The postInstallCheck phase that follows will check
# to verify if all of those links are in place. # to verify if all of those links are in place.
postInstall = '' postInstall = lib.optionalString createSymlinks ''
mkdir -p $out mkdir -p $out
for bin in stash-copy stash-paste wl-copy wl-paste; do for bin in stash-copy stash-paste wl-copy wl-paste; do
ln -sf $out/bin/stash $out/bin/$bin ln -sf $out/bin/stash $out/bin/$bin
@ -48,7 +49,7 @@ in
# After the version check, let's see if all binaries are linked correctly. # After the version check, let's see if all binaries are linked correctly.
# We could probably add a check phase to get the versions of each. # We could probably add a check phase to get the versions of each.
postInstallCheck = '' postInstallCheck = lib.optionalString createSymlinks ''
for bin in stash stash-copy stash-paste wl-copy wl-paste; do for bin in stash stash-copy stash-paste wl-copy wl-paste; do
[ -x "$out/bin/$bin" ] || { echo "$bin missing"; exit 1; } [ -x "$out/bin/$bin" ] || { echo "$bin missing"; exit 1; }
done done
@ -65,5 +66,6 @@ in
license = lib.licenses.mpl20; license = lib.licenses.mpl20;
maintainers = [lib.maintainers.NotAShelf]; maintainers = [lib.maintainers.NotAShelf];
mainProgram = "stash"; mainProgram = "stash";
platforms = lib.platforms.linux;
}; };
} }