From ad9af11c1a0338d9d03d5c8267b0d367e9c9a7d6 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 2 Jul 2013 17:16:19 +0200 Subject: [PATCH] python-blivet: Allow to use external udev. This allows blivet to be used outside of NixOS and with a different udev SO major number. Particularily, this is needed for the NixOps Hetzner backend which is coming soon :-) Signed-off-by: aszlig --- .../python-modules/blivet/default.nix | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/blivet/default.nix b/pkgs/development/python-modules/blivet/default.nix index 00018893eea..564b89347b5 100644 --- a/pkgs/development/python-modules/blivet/default.nix +++ b/pkgs/development/python-modules/blivet/default.nix @@ -1,7 +1,12 @@ { stdenv, fetchurl, buildPythonPackage, pykickstart, pyparted, pyblock -, libselinux, cryptsetup, multipath_tools, lsof, utillinux, udev +, libselinux, cryptsetup, multipath_tools, lsof, utillinux +, useNixUdev ? true, udev ? null +# This is only used when useNixUdev is false +, udevSoMajor ? 1 }: +assert useNixUdev -> udev != null; + let pyenable = { enablePython = true; }; selinuxWithPython = libselinux.override pyenable; @@ -17,9 +22,6 @@ in buildPythonPackage rec { }; postPatch = '' - sed -i -e '/find_library/,/find_library/ { - c libudev = "${udev}/lib/libudev.so.1" - }' blivet/pyudev.py sed -i -e 's|"multipath"|"${multipath_tools}/sbin/multipath"|' \ blivet/devicelibs/mpath.py blivet/devices.py sed -i -e '/"wipefs"/ { @@ -29,11 +31,18 @@ in buildPythonPackage rec { sed -i -e 's|"lsof"|"${lsof}/bin/lsof"|' blivet/formats/fs.py sed -i -r -e 's|"(u?mount)"|"${utillinux}/bin/\1"|' blivet/util.py sed -i '/pvscan/s/, *"--cache"//' blivet/devicelibs/lvm.py - ''; + '' + (if useNixUdev then '' + sed -i -e '/find_library/,/find_library/ { + c libudev = "${udev}/lib/libudev.so.1" + }' blivet/pyudev.py + '' else '' + sed -i -e '/^somajor *=/s/=.*/= ${toString udevSoMajor}/p' \ + blivet/pyudev.py + ''); propagatedBuildInputs = [ - pykickstart pyparted pyblock udev selinuxWithPython cryptsetupWithPython - ]; + pykickstart pyparted pyblock selinuxWithPython cryptsetupWithPython + ] ++ stdenv.lib.optional useNixUdev udev; # tests are currently _heavily_ broken upstream doCheck = false;