mirror of
https://github.com/NotAShelf/stash.git
synced 2026-04-12 14:07:42 +00:00
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I6a6a696479e976a7f4db18e6501e347a4940ce28
62 lines
1.8 KiB
Nix
62 lines
1.8 KiB
Nix
{
|
|
lib,
|
|
craneLib,
|
|
versionCheckHook,
|
|
}: let
|
|
pname = "stash";
|
|
version = (builtins.fromTOML (builtins.readFile ../Cargo.toml)).package.version;
|
|
src = let
|
|
fs = lib.fileset;
|
|
s = ../.;
|
|
in
|
|
fs.toSource {
|
|
root = s;
|
|
fileset = fs.unions [
|
|
(fs.fileFilter (file: builtins.any file.hasExt ["rs"]) (s + /src))
|
|
(s + /Cargo.lock)
|
|
(s + /Cargo.toml)
|
|
(s + /build.rs)
|
|
];
|
|
};
|
|
|
|
cargoArtifacts = craneLib.buildDepsOnly {
|
|
name = "${pname}-deps";
|
|
strictDeps = true;
|
|
inherit src;
|
|
};
|
|
in
|
|
craneLib.buildPackage {
|
|
inherit pname src version cargoArtifacts;
|
|
|
|
strictDeps = true;
|
|
|
|
# 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*. The postInstallCheck phase that follows will check
|
|
# to verify if all of those links are in place.
|
|
postInstall = ''
|
|
mkdir -p $out
|
|
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 get 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 = {
|
|
description = "Wayland clipboard manager with fast persistent history and multi-media support";
|
|
homepage = "https://github.com/notashelf/stash";
|
|
license = lib.licenses.mpl20;
|
|
maintainers = [lib.maintainers.NotAShelf];
|
|
mainProgram = "stash";
|
|
};
|
|
}
|