]> git.sesse.net Git - bcachefs-tools-debian/blob - base.nix
nix: overhaul build system.
[bcachefs-tools-debian] / base.nix
1 { lib
2 , doCheck ? true
3 , stdenvNoCC
4 , callPackage
5 , nixosTests
6 , autoPatchelfHook
7 , binary
8 , mount
9 , versionString ? "0.1"
10 , inShell ? false
11 , debugMode ? inShell
12 , testWithValgrind ? true
13 , fuseSupport ? false
14 , fuse3 ? null }:
15
16 stdenvNoCC.mkDerivation {
17   pname = "bcachefs-tools";
18
19   version = "v0.1-flake-${versionString}";
20
21   nativeBuildInputs = [
22     binary
23     mount
24   ];
25
26   buildInputs = mount.propagatedBuildInputs;
27
28   phases = [ "installPhase" ];
29
30   installPhase = ''
31     mkdir $out
32     mkdir $out/bin
33     mkdir $out/lib
34     mkdir $out/share
35     mkdir $out/etc
36     cp -pr "${binary}/bin/"* $out/bin
37     cp -pr "${binary}/lib/"* $out/lib
38     cp -pr "${binary}/share/"* $out/share
39     cp -pr "${binary}/etc/"* $out/etc
40     cp -pr "${mount}/bin/"* $out/bin/
41     chmod u+w $out/bin/*
42     patchelf --add-rpath $out/lib $out/bin/bcachefs-mount
43     ln -s "$out/bin/bcachefs-mount" "$out/bin/mount.bcachefs"
44     ln -s "$out/bin" "$out/sbin"
45   '';
46   doCheck = doCheck; # needs bcachefs module loaded on builder
47
48   passthru = {
49     tests = {
50       smoke-test = nixosTests.bcachefs;
51     };
52   };
53
54   enableParallelBuilding = true;
55   meta = with lib; {
56     description = "Userspace tools for bcachefs";
57     homepage    = http://bcachefs.org;
58     license     = licenses.gpl2;
59     platforms   = platforms.linux;
60     maintainers =
61       [ "Kent Overstreet <kent.overstreet@gmail.com>"
62       ];
63
64   };
65 }