summary refs log tree commit diff
path: root/pkgs/tools/filesystems/btrfsprogs/default.nix
blob: 75f155fd0ddfddd42536eed4152df6aa3e534cb6 (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-20120328" a;
  buildInputs = with a; [
    zlib libuuid acl attr e2fsprogs
  ];
in

assert a.libuuid != null;

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

  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];
  };
}