]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - build.nix
nix: fix build
[bcachefs-tools-debian] / build.nix
index efb5d7359040d5a88fd0701ff0ebf06bee84d054..a7383d1b418b4a832d472ce8e33af044092b55e6 100644 (file)
--- a/build.nix
+++ b/build.nix
@@ -1,28 +1,11 @@
-{ lib
-, stdenv
-, pkg-config
-, attr
-, libuuid
-, libsodium
-, keyutils
-, liburcu
-, zlib
-, libaio
-, udev
-, zstd
-, lz4
-, nix-gitignore
-, rustPlatform
-, rustc
-, cargo
- }:
-
+{ lib, stdenv, pkg-config, attr, libuuid, libsodium, keyutils, liburcu, zlib
+, libaio, udev, zstd, lz4, nix-gitignore, rustPlatform, rustc, cargo, fuse3
+, fuseSupport ? false, }:
 let
-  src = nix-gitignore.gitignoreSource [] ./. ;
+  src = nix-gitignore.gitignoreSource [ ] ./.;
 
   commit = lib.strings.substring 0 7 (builtins.readFile ./.bcachefs_revision);
   version = "git-${commit}";
-
 in stdenv.mkDerivation {
   inherit src version;
 
@@ -48,22 +31,29 @@ in stdenv.mkDerivation {
     zlib # zlib1g
     attr
     udev
-  ];
+  ] ++ lib.optional fuseSupport fuse3;
+
+  ${if fuseSupport then "BCACHEFS_FUSE" else null} = "1";
 
-  cargoRoot = "rust-src";
+  cargoRoot = ".";
+  # when git-based crates are updated, run:
+  # nix run github:Mic92/nix-update -- --version=skip --flake default
+  # to update the hashes
   cargoDeps = rustPlatform.importCargoLock {
-    lockFile = "${src}/rust-src/Cargo.lock";
+    lockFile = "${src}/Cargo.lock";
     outputHashes = {
       "bindgen-0.64.0" = "sha256-GNG8as33HLRYJGYe0nw6qBzq86aHiGonyynEM7gaEE4=";
     };
   };
 
-  makeFlags = [
-    "PREFIX=${placeholder "out"}"
-    "VERSION=${commit}"
-  ];
+  makeFlags = [ "DESTDIR=${placeholder "out"}" "PREFIX=" "VERSION=${commit}" ];
 
   dontStrip = true;
-  checkPhase = "./bcachefs version";
+  checkPhase = "./target/release/bcachefs version";
   doCheck = true;
+
+  meta = {
+    mainProgram = "bcachefs";
+    license = lib.licenses.gpl2Only;
+  };
 }