summary refs log tree commit diff
path: root/pkgs/os-specific/linux/drbd/default.nix
blob: bbf2535ce3d6d8e770efb3c1a23d925e5f0cf994 (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
46
47
48
{ stdenv, fetchurl, flex, systemd, perl }:

stdenv.mkDerivation rec {
  name = "drbd-8.4.4";

  src = fetchurl {
    url = "http://oss.linbit.com/drbd/8.4/${name}.tar.gz";
    sha256 = "1w4889h1ak7gy9w33kd4fgjlfpgmp6hzfya16p1pkc13bjf22mm0";
  };

  patches = [ ./pass-force.patch ./fix-glibc-compilation.patch ];

  nativeBuildInputs = [ flex ];
  buildInputs = [ perl ];

  configureFlags = [
    "--without-distro"
    "--without-pacemaker"
    "--localstatedir=/var"
    "--sysconfdir=/etc"
  ];

  preConfigure =
    ''
      export PATH=${systemd}/sbin:$PATH
      substituteInPlace user/Makefile.in \
        --replace /sbin '$(sbindir)'
      substituteInPlace user/legacy/Makefile.in \
        --replace '$(DESTDIR)/lib/drbd' '$(DESTDIR)$(LIBDIR)'
      substituteInPlace user/drbdadm_usage_cnt.c --replace /lib/drbd $out/lib/drbd
      substituteInPlace scripts/drbd.rules --replace /usr/sbin/drbdadm $out/sbin/drbdadm
    '';

  makeFlags = [ "SHELL=${stdenv.shell}" ];

  installFlags = [
    "localstatedir=$(TMPDIR)/var"
    "sysconfdir=$(out)/etc"
    "INITDIR=$(out)/etc/init.d"
  ];

  meta = with stdenv.lib; {
    homepage = "http://www.drbd.org/";
    description = "Distributed Replicated Block Device, a distributed storage system for Linux";
    license = licenses.gpl2;
    platforms = platforms.linux;
  };
}