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 pname = "blivet";
11 version = "0.67";
12
13 src = fetchFromGitHub {
14 owner = "dwlehman";
15 repo = "blivet";
16 rev = "${pname}-${version}";
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 '';
32
33 propagatedBuildInputs = [
34 pykickstart pyparted pyblock pyudev selinuxWithPython cryptsetupWithPython
35 six
36 ];
37
38 # Tests are in nixos/tests/blivet.nix.
39 doCheck = false;
40
41 meta = with stdenv.lib; {
42 homepage = https://fedoraproject.org/wiki/Blivet;
43 description = "Module for management of a system's storage configuration";
44 license = with licenses; [ gpl2Plus lgpl21Plus ];
45 platforms = platforms.linux;
46 };
47}