nixpkgs-suyu/pkgs/os-specific/linux/drbd/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

48 lines
1.3 KiB
Nix

{ lib, 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 lib; {
homepage = "http://www.drbd.org/";
description = "Distributed Replicated Block Device, a distributed storage system for Linux";
license = licenses.gpl2;
platforms = platforms.linux;
};
}