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