summary refs log tree commit diff
path: root/pkgs/tools/filesystems/btrfsprogs/default.nix
blob: 68139f416ebb42cc62ac68bda7622a8275e68aa9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
a :
let
  fetchurl = a.fetchurl;
  fetchgit = a.fetchgit;

  version = a.lib.attrByPath ["version"] "0.19" a;
  buildInputs = with a; [
    zlib libuuid acl attr
  ];
in

assert a.libuuid != null;

rec {
  srcDrv = fetchgit {
    url="git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git" ;
    rev="fdb6c0402337d9607c7a39155088eaf033742752" ;
    sha256="de7f9e04401bd747a831c48d312106e188adb32f32b6d64078ae6d2aab45b1f8" ;
  };

  src = srcDrv + "/";

  inherit buildInputs;
  configureFlags = [];
  makeFlags = ["prefix=$out CFLAGS=-Os"];

  patches = [];
  phaseNames = ["fixMakefile" "doEnsureBtrfsImage" "doMakeInstall"];

  fixMakefile = a.fullDepEntry ''
    sed -e 's@^progs = @progs=@g' -i Makefile
  '' ["minInit" "doUnpack"];

  doEnsureBtrfsImage = a.fullDepEntry (''
    if ! grep 'progs = ' Makefile | grep btrfs-image; then
      sed -e 's/progs = \(.*\)\\/progs = \1btrfs-image \\/' -i Makefile
    fi
  '') ["minInit" "doUnpack"];

  name = "btrfs-progs-" + version;
  meta = {
    description = "BTRFS utilities";
    maintainers = [a.lib.maintainers.raskin];
  };
}