pscand/nix/package.nix
NotAShelf d8f0bf3b09
nix: add package & NixOS module
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I5bfbacb984356f912f1f40d6209f0a896a6a6964
2026-02-19 00:13:18 +03:00

54 lines
1.2 KiB
Nix

{
lib,
rustPlatform,
makeWrapper,
...
}: let
pname = "pscand";
version = "0.1.0";
src = let
fs = lib.fileset;
s = ../.;
in
lib.cleanSourceWith {
src = fs.toSource {
root = s;
fileset = fs.unions [
(s + /crates)
(s + /scanners)
(s + /Cargo.lock)
(s + /Cargo.toml)
];
};
};
in
rustPlatform.buildRustPackage {
inherit pname version src;
cargoLock.lockFile = ../Cargo.lock;
nativeBuildInputs = [
makeWrapper
];
postFixup = let
scannerDir = "${placeholder "out"}/lib/pscand/scanners";
in ''
mkdir -p ${scannerDir}
for scanner in scanners/**/target/release/*.so; do
if [ -f "$scanner" ]; then
install -Dm755 "$scanner" "${scannerDir}/$(basename "$scanner")"
fi
done
wrapProgram "$out/bin/pscand" \
--set PSCAND_SCANNER_DIRS "${scannerDir}"
'';
meta = {
description = "Pluggable System Condition Monitoring Daemon";
homepage = "https://github.com/notashelf/pscand";
license = lib.licenses.mpl20;
maintainers = with lib.maintainers; [NotAShelf];
platforms = lib.platforms.linux;
};
}