]> git.sesse.net Git - bcachefs-tools-debian/blob - build.nix
Disable pristine-tar option in gbp.conf, since there is no pristine-tar branch.
[bcachefs-tools-debian] / build.nix
1 { lib, stdenv, pkg-config, attr, libuuid, libsodium, keyutils, liburcu, zlib
2 , libaio, udev, zstd, lz4, nix-gitignore, rustPlatform, rustc, cargo, fuse3
3 , fuseSupport ? false, }:
4 let
5   src = nix-gitignore.gitignoreSource [ ] ./.;
6
7   commit = lib.strings.substring 0 7 (builtins.readFile ./.bcachefs_revision);
8   version = "git-${commit}";
9 in stdenv.mkDerivation {
10   inherit src version;
11
12   pname = "bcachefs-tools";
13
14   nativeBuildInputs = [
15     pkg-config
16     cargo
17     rustc
18     rustPlatform.cargoSetupHook
19     rustPlatform.bindgenHook
20   ];
21
22   buildInputs = [
23     libaio
24     keyutils # libkeyutils
25     lz4 # liblz4
26
27     libsodium
28     liburcu
29     libuuid
30     zstd # libzstd
31     zlib # zlib1g
32     attr
33     udev
34   ] ++ lib.optional fuseSupport fuse3;
35
36   ${if fuseSupport then "BCACHEFS_FUSE" else null} = "1";
37
38   cargoRoot = ".";
39   # when git-based crates are updated, run:
40   # nix run github:Mic92/nix-update -- --version=skip --flake default
41   # to update the hashes
42   cargoDeps = rustPlatform.importCargoLock {
43     lockFile = "${src}/Cargo.lock";
44   };
45
46   makeFlags = [ "DESTDIR=${placeholder "out"}" "PREFIX=" "VERSION=${commit}" ];
47
48   dontStrip = true;
49   checkPhase = "./target/release/bcachefs version";
50   doCheck = true;
51
52   meta = {
53     mainProgram = "bcachefs";
54     license = lib.licenses.gpl2Only;
55   };
56 }