1{
2 lib,
3 pkgs,
4 python,
5 buildPythonPackage,
6 fetchFromGitHub,
7 pygobject3,
8 libblockdev,
9 bytesize,
10 pyudev,
11 dbus-python,
12 util-linux,
13 kmod,
14 libndctl,
15 nvme-cli,
16 dosfstools,
17 e2fsprogs,
18 hfsprogs,
19 xfsprogs,
20 f2fs-tools,
21 ntfs3g,
22 btrfs-progs,
23 reiserfsprogs,
24 mdadm,
25 lvm2,
26 gfs2-utils,
27 cryptsetup,
28 multipath-tools,
29 dracut,
30 stratisd,
31}:
32
33let
34 libblockdevPython = (libblockdev.override { python3 = python; }).python;
35in
36buildPythonPackage rec {
37 pname = "blivet";
38 version = "3.12.1";
39 format = "setuptools";
40
41 src = fetchFromGitHub {
42 owner = "storaged-project";
43 repo = "blivet";
44 tag = "blivet-${version}";
45 hash = "sha256-ppX2rd1rFkRhca7F56JVQUDEQzW7Cg8ifV60URs2IMY=";
46 };
47
48 postPatch = ''
49 find blivet -name '*.py' | while IFS= read -r i ; do
50 substituteInPlace "$i" \
51 --replace \
52 'gi.require_version("BlockDev",' \
53 'import gi.repository
54 gi.require_version("GIRepository", "2.0")
55 from gi.repository import GIRepository
56 GIRepository.Repository.prepend_search_path("${libblockdev}/lib/girepository-1.0")
57 gi.require_version("BlockDev",'
58 done
59 '';
60
61 propagatedBuildInputs = [
62 pygobject3
63 libblockdevPython
64 bytesize
65 pyudev
66 dbus-python
67 util-linux
68 kmod
69 libndctl
70 nvme-cli
71 pkgs.systemd
72 dosfstools
73 e2fsprogs
74 hfsprogs
75 xfsprogs
76 f2fs-tools
77 ntfs3g
78 btrfs-progs
79 reiserfsprogs
80 mdadm
81 lvm2
82 gfs2-utils
83 cryptsetup
84 multipath-tools
85 dracut
86 stratisd
87 ];
88
89 pythonImportsCheck = [ "blivet" ];
90
91 # Even unit tests require a system D-Bus.
92 # TODO: Write a NixOS VM test?
93 doCheck = false;
94
95 meta = {
96 description = "Python module for system storage configuration";
97 homepage = "https://github.com/storaged-project/blivet";
98 license = [
99 lib.licenses.gpl2Plus
100 lib.licenses.lgpl2Plus
101 ];
102 maintainers = with lib.maintainers; [ cybershadow ];
103 platforms = lib.platforms.linux;
104 };
105}