X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=build.nix;h=4a4b7b069c8b6e1aacb27aae6d29d9aaaf3a1b7d;hb=HEAD;hp=7d2c2276171b3ffbebafb994bb37f9ad4bf694a0;hpb=bf359ac1ad97929e1023632aafb272d655504516;p=bcachefs-tools-debian diff --git a/build.nix b/build.nix index 7d2c227..4a4b7b0 100644 --- a/build.nix +++ b/build.nix @@ -1,26 +1,11 @@ -{ lib -, stdenv -, pkg-config -, attr -, libuuid -, libsodium -, keyutils -, liburcu -, zlib -, libaio -, udev -, zstd -, lz4 -, nix-gitignore -, rustPlatform - }: - +{ 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; @@ -28,9 +13,9 @@ in stdenv.mkDerivation { nativeBuildInputs = [ pkg-config + cargo + rustc rustPlatform.cargoSetupHook - rustPlatform.rust.cargo - rustPlatform.rust.rustc rustPlatform.bindgenHook ]; @@ -46,19 +31,26 @@ 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"; }; - 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; + }; }