2023-11-04 11:40:16 +03:00
|
|
|
{ lib, stdenv, pkg-config, attr, libuuid, libsodium, keyutils, liburcu, zlib
|
2023-11-20 00:13:14 +03:00
|
|
|
, libaio, udev, zstd, lz4, nix-gitignore, rustPlatform, rustc, cargo, fuse3
|
|
|
|
, fuseSupport ? false, }:
|
2023-02-27 06:34:06 +03:00
|
|
|
let
|
2023-11-04 11:40:16 +03:00
|
|
|
src = nix-gitignore.gitignoreSource [ ] ./.;
|
2023-02-27 06:34:06 +03:00
|
|
|
|
|
|
|
commit = lib.strings.substring 0 7 (builtins.readFile ./.bcachefs_revision);
|
|
|
|
version = "git-${commit}";
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
inherit src version;
|
|
|
|
|
|
|
|
pname = "bcachefs-tools";
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
2023-06-16 09:17:00 +03:00
|
|
|
cargo
|
|
|
|
rustc
|
2023-02-27 06:34:06 +03:00
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
rustPlatform.bindgenHook
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libaio
|
|
|
|
keyutils # libkeyutils
|
|
|
|
lz4 # liblz4
|
|
|
|
|
|
|
|
libsodium
|
|
|
|
liburcu
|
|
|
|
libuuid
|
|
|
|
zstd # libzstd
|
|
|
|
zlib # zlib1g
|
|
|
|
attr
|
|
|
|
udev
|
2023-11-20 00:13:14 +03:00
|
|
|
] ++ lib.optional fuseSupport fuse3;
|
|
|
|
|
|
|
|
BCACHEFS_FUSE = if fuseSupport then "1" else "";
|
2023-02-27 06:34:06 +03:00
|
|
|
|
|
|
|
cargoRoot = "rust-src";
|
2023-06-16 14:57:35 +03:00
|
|
|
# when git-based crates are updated, run:
|
|
|
|
# nix run github:Mic92/nix-update -- --version=skip --flake default
|
|
|
|
# to update the hashes
|
2023-02-27 06:34:06 +03:00
|
|
|
cargoDeps = rustPlatform.importCargoLock {
|
|
|
|
lockFile = "${src}/rust-src/Cargo.lock";
|
2023-06-15 20:05:45 +03:00
|
|
|
outputHashes = {
|
|
|
|
"bindgen-0.64.0" = "sha256-GNG8as33HLRYJGYe0nw6qBzq86aHiGonyynEM7gaEE4=";
|
|
|
|
};
|
2023-02-27 06:34:06 +03:00
|
|
|
};
|
|
|
|
|
2023-11-04 11:40:16 +03:00
|
|
|
makeFlags = [ "DESTDIR=${placeholder "out"}" "PREFIX=" "VERSION=${commit}" ];
|
2023-02-27 06:34:06 +03:00
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
checkPhase = "./bcachefs version";
|
|
|
|
doCheck = true;
|
2023-11-04 11:40:16 +03:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
mainProgram = "bcachefs";
|
|
|
|
license = lib.licenses.gpl2Only;
|
|
|
|
};
|
2023-02-27 06:34:06 +03:00
|
|
|
}
|