summaryrefslogtreecommitdiff
path: root/base.nix
diff options
context:
space:
mode:
authorDaniel Hill <daniel@gluo.nz>2022-11-25 12:47:29 +1300
committerDaniel Hill <daniel@gluo.nz>2023-01-03 16:58:55 +1300
commit9a44c6d4d020035f25baf74b1f7986b3221a274e (patch)
tree5d40fc996aa15176c9f75e45fc738200f25eb27a /base.nix
parent9d6040c8b60d10f901141df9d739005f3fe0326e (diff)
nix: overhaul build system.
Removed outdated overlay. Simply build tooling using bingenHook and propagated*Inputs Signed-off-by: Daniel Hill <daniel@gluo.nz>
Diffstat (limited to 'base.nix')
-rw-r--r--base.nix65
1 files changed, 65 insertions, 0 deletions
diff --git a/base.nix b/base.nix
new file mode 100644
index 00000000..29c86ac8
--- /dev/null
+++ b/base.nix
@@ -0,0 +1,65 @@
+{ lib
+, doCheck ? true
+, stdenvNoCC
+, callPackage
+, nixosTests
+, autoPatchelfHook
+, binary
+, mount
+, versionString ? "0.1"
+, inShell ? false
+, debugMode ? inShell
+, testWithValgrind ? true
+, fuseSupport ? false
+, fuse3 ? null }:
+
+stdenvNoCC.mkDerivation {
+ pname = "bcachefs-tools";
+
+ version = "v0.1-flake-${versionString}";
+
+ nativeBuildInputs = [
+ binary
+ mount
+ ];
+
+ buildInputs = mount.propagatedBuildInputs;
+
+ phases = [ "installPhase" ];
+
+ installPhase = ''
+ mkdir $out
+ mkdir $out/bin
+ mkdir $out/lib
+ mkdir $out/share
+ mkdir $out/etc
+ cp -pr "${binary}/bin/"* $out/bin
+ cp -pr "${binary}/lib/"* $out/lib
+ cp -pr "${binary}/share/"* $out/share
+ cp -pr "${binary}/etc/"* $out/etc
+ cp -pr "${mount}/bin/"* $out/bin/
+ chmod u+w $out/bin/*
+ patchelf --add-rpath $out/lib $out/bin/bcachefs-mount
+ ln -s "$out/bin/bcachefs-mount" "$out/bin/mount.bcachefs"
+ ln -s "$out/bin" "$out/sbin"
+ '';
+ doCheck = doCheck; # needs bcachefs module loaded on builder
+
+ passthru = {
+ tests = {
+ smoke-test = nixosTests.bcachefs;
+ };
+ };
+
+ enableParallelBuilding = true;
+ meta = with lib; {
+ description = "Userspace tools for bcachefs";
+ homepage = http://bcachefs.org;
+ license = licenses.gpl2;
+ platforms = platforms.linux;
+ maintainers =
+ [ "Kent Overstreet <kent.overstreet@gmail.com>"
+ ];
+
+ };
+}