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 <aszlig@redmoonstudios.org>
This commit is contained in:
parent
513de0ff57
commit
ad9af11c1a
@ -1,7 +1,12 @@
|
|||||||
{ stdenv, fetchurl, buildPythonPackage, pykickstart, pyparted, pyblock
|
{ 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
|
let
|
||||||
pyenable = { enablePython = true; };
|
pyenable = { enablePython = true; };
|
||||||
selinuxWithPython = libselinux.override pyenable;
|
selinuxWithPython = libselinux.override pyenable;
|
||||||
@ -17,9 +22,6 @@ in buildPythonPackage rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
postPatch = ''
|
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"|' \
|
sed -i -e 's|"multipath"|"${multipath_tools}/sbin/multipath"|' \
|
||||||
blivet/devicelibs/mpath.py blivet/devices.py
|
blivet/devicelibs/mpath.py blivet/devices.py
|
||||||
sed -i -e '/"wipefs"/ {
|
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 -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 -r -e 's|"(u?mount)"|"${utillinux}/bin/\1"|' blivet/util.py
|
||||||
sed -i '/pvscan/s/, *"--cache"//' blivet/devicelibs/lvm.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 = [
|
propagatedBuildInputs = [
|
||||||
pykickstart pyparted pyblock udev selinuxWithPython cryptsetupWithPython
|
pykickstart pyparted pyblock selinuxWithPython cryptsetupWithPython
|
||||||
];
|
] ++ stdenv.lib.optional useNixUdev udev;
|
||||||
|
|
||||||
# tests are currently _heavily_ broken upstream
|
# tests are currently _heavily_ broken upstream
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user