summaryrefslogtreecommitdiff
path: root/build.nix
diff options
context:
space:
mode:
authorDaniel Hill <daniel@gluo.nz>2023-02-27 16:34:06 +1300
committerDaniel Hill <daniel@gluo.nz>2023-02-27 16:39:46 +1300
commitbf359ac1ad97929e1023632aafb272d655504516 (patch)
tree4ed1729ae4f3bbc562aed99f208cc4e238af6afb /build.nix
parent203e40fcf5a11a4bfb29d758ae065445c6e766d5 (diff)
nix fix up! Rust now integrated into bcachefs binary
Heavily simplified to just call make with the required rust dependencies. Signed-off-by: Daniel Hill <daniel@gluo.nz>
Diffstat (limited to 'build.nix')
-rw-r--r--build.nix64
1 files changed, 64 insertions, 0 deletions
diff --git a/build.nix b/build.nix
new file mode 100644
index 00000000..7d2c2276
--- /dev/null
+++ b/build.nix
@@ -0,0 +1,64 @@
+{ lib
+, stdenv
+, pkg-config
+, attr
+, libuuid
+, libsodium
+, keyutils
+, liburcu
+, zlib
+, libaio
+, udev
+, zstd
+, lz4
+, nix-gitignore
+, rustPlatform
+ }:
+
+let
+ src = nix-gitignore.gitignoreSource [] ./. ;
+
+ commit = lib.strings.substring 0 7 (builtins.readFile ./.bcachefs_revision);
+ version = "git-${commit}";
+
+in stdenv.mkDerivation {
+ inherit src version;
+
+ pname = "bcachefs-tools";
+
+ nativeBuildInputs = [
+ pkg-config
+ rustPlatform.cargoSetupHook
+ rustPlatform.rust.cargo
+ rustPlatform.rust.rustc
+ rustPlatform.bindgenHook
+ ];
+
+ buildInputs = [
+ libaio
+ keyutils # libkeyutils
+ lz4 # liblz4
+
+ libsodium
+ liburcu
+ libuuid
+ zstd # libzstd
+ zlib # zlib1g
+ attr
+ udev
+ ];
+
+ cargoRoot = "rust-src";
+ cargoDeps = rustPlatform.importCargoLock {
+ lockFile = "${src}/rust-src/Cargo.lock";
+ };
+
+ makeFlags = [
+ "PREFIX=${placeholder "out"}"
+ "VERSION=${commit}"
+ ];
+
+ dontStrip = true;
+ checkPhase = "./bcachefs version";
+ doCheck = true;
+}