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 name = "${pname}-${version}";
12 version = "0.67";
13
14 src = fetchFromGitHub {
15 owner = "dwlehman";
16 repo = "blivet";
17 rev = name;
18 sha256 = "1gk94ghjrxfqnx53hph1j2s7qcv86fjz48is7l099q9c24rjv8ky";
19 };
20
21 postPatch = ''
22 sed -i \
23 -e 's|"multipath"|"${multipath-tools}/sbin/multipath"|' \
24 -e '/^def set_friendly_names/a \ return False' \
25 blivet/devicelibs/mpath.py
26 sed -i -e '/"wipefs"/ {
27 s|wipefs|${utillinux}/sbin/wipefs|
28 s/-f/--force/
29 }' blivet/formats/__init__.py
30 sed -i -e 's|"lsof"|"${lsof}/bin/lsof"|' blivet/formats/fs.py
31 sed -i -r -e 's|"(u?mount)"|"${utillinux}/bin/\1"|' blivet/util.py
32 '';
33
34 propagatedBuildInputs = [
35 pykickstart pyparted pyblock pyudev selinuxWithPython cryptsetupWithPython
36 six
37 ];
38
39 # Tests are in 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}