flake reorg

This commit is contained in:
Robin Appelman 2024-01-06 23:35:55 +01:00
commit bc6b1b1c8f
4 changed files with 177 additions and 125 deletions

25
package.nix Normal file
View file

@ -0,0 +1,25 @@
{
stdenv,
rustPlatform,
coreutils,
lib,
}: let
inherit (lib.sources) sourceByRegex;
src = sourceByRegex ./. ["Cargo.*" "(src|benches)(/.*)?"];
in
rustPlatform.buildRustPackage rec {
name = "palantir";
version = "0.1.0";
inherit src;
cargoLock = {
lockFile = ./Cargo.lock;
};
postInstall = ''
mkdir -p $out/lib/udev/rules.d/
echo 'SUBSYSTEM=="powercap", ACTION=="add", RUN+="${coreutils}/bin/chgrp -R powermonitoring /sys%p", RUN+="${coreutils}/bin/chmod -R g=u /sys%p"' >> $out/lib/udev/rules.d/51-palantir.rules
echo 'SUBSYSTEM=="powercap", ACTION=="change", ENV{TRIGGER}!="none", RUN+="${coreutils}/bin/chgrp -R powermonitoring /sys%p", RUN+="${coreutils}/bin/chmod -R g=u /sys%p"' >> $out/lib/udev/rules.d/51-palantir.rules
'';
}