1{ stdenv, fetchFromGitHub, buildPythonPackage, pykickstart, pyparted, pyblock
2, pyudev, six, libselinux, cryptsetup, multipath_tools, lsof, utillinux
3}:
4
5let
6 pyenable = { enablePython = true; };
7 selinuxWithPython = libselinux.override pyenable;
8 cryptsetupWithPython = cryptsetup.override pyenable;
9in buildPythonPackage rec {
10 name = "blivet-${version}";
11 version = "0.67";
12
13 src = fetchFromGitHub {
14 owner = "dwlehman";
15 repo = "blivet";
16 rev = name;
17 sha256 = "1gk94ghjrxfqnx53hph1j2s7qcv86fjz48is7l099q9c24rjv8ky";
18 };
19
20 postPatch = ''
21 sed -i \
22 -e 's|"multipath"|"${multipath_tools}/sbin/multipath"|' \
23 -e '/^def set_friendly_names/a \ return False' \
24 blivet/devicelibs/mpath.py
25 sed -i -e '/"wipefs"/ {
26 s|wipefs|${utillinux}/sbin/wipefs|
27 s/-f/--force/
28 }' blivet/formats/__init__.py
29 sed -i -e 's|"lsof"|"${lsof}/bin/lsof"|' blivet/formats/fs.py
30 sed -i -r -e 's|"(u?mount)"|"${utillinux}/bin/\1"|' blivet/util.py
31 sed -i -e '/pvscan/s/, *"--cache"//' blivet/devicelibs/lvm.py
32 '';
33
34 propagatedBuildInputs = [
35 pykickstart pyparted pyblock pyudev selinuxWithPython cryptsetupWithPython
36 six
37 ];
38
39 # Tests are in <nixpkgs/nixos/tests/blivet.nix>.
40 doCheck = false;
41
42 meta = with stdenv.lib; {
43 homepage = "https://fedoraproject.org/wiki/Blivet";
44 description = "Module for management of a system's storage configuration";
45 license = with licenses; [ gpl2Plus lgpl21Plus ];
46 platforms = platforms.linux;
47 };
48}