]> git.sesse.net Git - bcachefs-tools-debian/blob - default.nix
nix: add nix expressions for development
[bcachefs-tools-debian] / default.nix
1 { nixpkgs ? (import ./nix/nixpkgs.nix)
2 }:
3
4 with nixpkgs;
5
6 stdenv.mkDerivation rec {
7   name = "bcachefs-tools-${version}";
8   version = "git";
9
10   src = lib.cleanSource ./.; # NOTE: ignore .git, otherwise things get weird!
11
12   nativeBuildInputs = [ git pkgconfig ];
13   buildInputs =
14     [ liburcu libuuid libaio zlib attr keyutils
15       libsodium libscrypt
16     ];
17
18   patchPhase = ''
19     # ensure the mkfs and fsck scripts, which are just wrappers around
20     # 'bcachefs', are patched to refer to the right location inside the
21     # nix store. (you wouldn't expect built tools to call random outside
22     # utilities, in general, but the exact tools they were built with.)
23     #
24     # TODO FIXME: it would be better to fix this in the 'install' target,
25     # however, so this works with any bog-standard installation
26
27     substituteInPlace fsck.bcachefs --replace bcachefs $out/bin/bcachefs
28     substituteInPlace mkfs.bcachefs --replace bcachefs $out/bin/bcachefs
29   '';
30
31   enableParallelBuilding = true;
32   makeFlags =
33     [ "PREFIX=$(out)"
34     ];
35
36   meta = with stdenv.lib; {
37     description = "Userspace tools for bcachefs";
38     homepage    = http://bcachefs.org;
39     license     = licenses.gpl2;
40     platforms   = platforms.linux;
41     maintainers =
42       [ "Kent Overstreet <kent.overstreet@gmail.com>"
43       ];
44   };
45 }