]> git.sesse.net Git - bcachefs-tools-debian/blob - build.nix
New upstream release
[bcachefs-tools-debian] / build.nix
1 { lib
2 , stdenv
3 , pkg-config
4 , attr
5 , libuuid
6 , libsodium
7 , keyutils
8 , liburcu
9 , zlib
10 , libaio
11 , udev
12 , zstd
13 , lz4
14 , nix-gitignore
15 , rustPlatform
16 , rustc
17 , cargo
18  }:
19
20 let
21   src = nix-gitignore.gitignoreSource [] ./. ;
22
23   commit = lib.strings.substring 0 7 (builtins.readFile ./.bcachefs_revision);
24   version = "git-${commit}";
25
26 in stdenv.mkDerivation {
27   inherit src version;
28
29   pname = "bcachefs-tools";
30
31   nativeBuildInputs = [
32     pkg-config
33     cargo
34     rustc
35     rustPlatform.cargoSetupHook
36     rustPlatform.bindgenHook
37   ];
38
39   buildInputs = [
40     libaio
41     keyutils # libkeyutils
42     lz4 # liblz4
43
44     libsodium
45     liburcu
46     libuuid
47     zstd # libzstd
48     zlib # zlib1g
49     attr
50     udev
51   ];
52
53   cargoRoot = "rust-src";
54   # when git-based crates are updated, run:
55   # nix run github:Mic92/nix-update -- --version=skip --flake default
56   # to update the hashes
57   cargoDeps = rustPlatform.importCargoLock {
58     lockFile = "${src}/rust-src/Cargo.lock";
59     outputHashes = {
60       "bindgen-0.64.0" = "sha256-GNG8as33HLRYJGYe0nw6qBzq86aHiGonyynEM7gaEE4=";
61     };
62   };
63
64   makeFlags = [
65     "PREFIX=${placeholder "out"}"
66     "VERSION=${commit}"
67   ];
68
69   dontStrip = true;
70   checkPhase = "./bcachefs version";
71   doCheck = true;
72 }