12 rustPlatform.buildRustPackage rec {
13 pname = "zram-generator";
16 src = fetchFromGitHub {
20 hash = "sha256-n+ZOWU+sPq9DcHgzQWTxxfMmiz239qdetXypqdy33cM=";
23 # RFE: Include Cargo.lock in sources
24 # https://github.com/systemd/zram-generator/issues/65
25 cargoLock.lockFile = ./Cargo.lock;
28 cp ${./Cargo.lock} Cargo.lock
29 substituteInPlace Makefile \
30 --replace 'target/$(BUILDTYPE)' 'target/${stdenv.hostPlatform.rust.rustcTargetSpec}/$(BUILDTYPE)'
31 substituteInPlace src/generator.rs \
32 --replace 'Command::new("systemd-detect-virt")' 'Command::new("${systemd}/bin/systemd-detect-virt")' \
33 --replace 'Command::new("modprobe")' 'Command::new("${kmod}/bin/modprobe")'
46 # embedded into the binary at build time
47 # https://github.com/systemd/zram-generator/blob/v1.1.2/Makefile#LL11-L11C56
48 export SYSTEMD_UTIL_DIR=$($PKG_CONFIG --variable=systemdutildir systemd)
51 dontCargoInstall = true;
54 "-o program" # already built by cargoBuildHook
56 "SYSTEMD_SYSTEM_UNIT_DIR=$(out)/lib/systemd/system"
57 "SYSTEMD_SYSTEM_GENERATOR_DIR=$(out)/lib/systemd/system-generators"
62 inherit (nixosTests) zram-generator;
64 updateScript = ./update.sh;
68 homepage = "https://github.com/systemd/zram-generator";
69 license = licenses.mit;
70 description = "Systemd unit generator for zram devices";
71 maintainers = with maintainers; [ nickcao ];