]> git.sesse.net Git - bcachefs-tools-debian/blob - build.nix
packaging: Update RPM spec to use %_libexecdir for libexec files
[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   BCACHEFS_FUSE = if fuseSupport then "1" else "";
37
38   cargoRoot = "rust-src";
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}/rust-src/Cargo.lock";
44     outputHashes = {
45       "bindgen-0.64.0" = "sha256-GNG8as33HLRYJGYe0nw6qBzq86aHiGonyynEM7gaEE4=";
46     };
47   };
48
49   makeFlags = [ "DESTDIR=${placeholder "out"}" "PREFIX=" "VERSION=${commit}" ];
50
51   dontStrip = true;
52   checkPhase = "./bcachefs version";
53   doCheck = true;
54
55   meta = {
56     mainProgram = "bcachefs";
57     license = lib.licenses.gpl2Only;
58   };
59 }