diff options
Diffstat (limited to 'pkgs/python-packages/blivet/default.nix')
-rw-r--r-- | pkgs/python-packages/blivet/default.nix | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/pkgs/python-packages/blivet/default.nix b/pkgs/python-packages/blivet/default.nix deleted file mode 100644 index 108d548..0000000 --- a/pkgs/python-packages/blivet/default.nix +++ /dev/null | |||
@@ -1,118 +0,0 @@ | |||
1 | { lib, writeText, poetry2nix, python, pythonPackages, | ||
2 | gobject-introspection, libblockdev, libbytesize, fetchFromGitHub, | ||
3 | pkg-config, parted, systemd, | ||
4 | with_dmraid ? false, | ||
5 | with_fs_btrfs ? false, | ||
6 | with_fs_fat ? false, | ||
7 | with_fs_f2fs ? false, | ||
8 | with_fs_hfs_plus ? false, | ||
9 | with_fs_jfs ? false, | ||
10 | with_fs_nfs ? false, | ||
11 | with_fs_nfsv4 ? false, | ||
12 | with_fs_ntfs ? false, | ||
13 | with_fs_reiserfs ? false, | ||
14 | with_fs_xfs ? false, | ||
15 | with_luks ? false, | ||
16 | with_lvm ? false, | ||
17 | with_mdadm ? false, | ||
18 | with_multipath ? false, | ||
19 | with_optical ? false, | ||
20 | with_iscsi ? false, | ||
21 | dmraid, multipath_tools, lvm2, eject, kmod, utillinux, lsof, | ||
22 | openiscsi, coreutils, dosfstools, e2fsprogs, jfsutils, btrfs-progs, | ||
23 | xfsprogs, f2fs-tools, hfsprogs, nfs-utils, ntfs3g, ntfsprogs, | ||
24 | reiserfsprogs, devicemapper, cryptsetup, mdadm | ||
25 | }@args: | ||
26 | let | ||
27 | # FIXME: blivet/tasks/fsmount.py links to /sbin | ||
28 | additionalPackages = | ||
29 | lib.optionals with_dmraid [ dmraid ] | ||
30 | ++ lib.optionals with_fs_btrfs [ btrfs-progs ] | ||
31 | ++ lib.optionals with_fs_fat [ dosfstools ] | ||
32 | ++ lib.optionals with_fs_f2fs [ f2fs-tools ] | ||
33 | ++ lib.optionals with_fs_hfs_plus [ hfsprogs ] | ||
34 | ++ lib.optionals with_fs_jfs [ jfsutils ] | ||
35 | ++ lib.optionals with_fs_nfs [ nfs-utils ] | ||
36 | ++ lib.optionals with_fs_ntfs [ ntfs3g ntfsprogs ] | ||
37 | ++ lib.optionals with_fs_reiserfs [ reiserfsprogs ] | ||
38 | ++ lib.optionals with_fs_xfs [ xfsprogs.bin ] | ||
39 | ++ lib.optionals with_luks [ devicemapper cryptsetup ] | ||
40 | ++ lib.optionals with_lvm [ lvm2 ] | ||
41 | ++ lib.optionals with_mdadm [ mdadm ] | ||
42 | ++ lib.optionals with_multipath [ multipath_tools ] | ||
43 | ++ lib.optionals with_optical [ eject ] | ||
44 | ++ lib.optionals with_iscsi [ openiscsi ]; | ||
45 | in | ||
46 | # nix-shell -E "with import <nixpkgs> {}; pkgs.mkShell { buildInputs = [ python3 python3Packages.blivet3 ]; }" | ||
47 | # nix-shell -E "with import <nixpkgs> {}; pkgs.mkShell { buildInputs = [ (python3.withPackages(p: [ p.blivet3 ])) ]; }" | ||
48 | poetry2nix.mkPoetryApplication { | ||
49 | inherit python; | ||
50 | propagatedBuildInputs = [ | ||
51 | gobject-introspection | ||
52 | (pythonPackages.toPythonModule libblockdev) | ||
53 | (pythonPackages.toPythonModule libbytesize) | ||
54 | ]; | ||
55 | src = fetchFromGitHub { | ||
56 | owner = "storaged-project"; | ||
57 | repo = "blivet"; | ||
58 | rev = "blivet-3.3.0"; | ||
59 | sha256 = "0ynxm37cxxr2sf2hj18hrdxs1qfw6dgdagkvv5f6g4fmp51m7c3c"; | ||
60 | }; | ||
61 | overrides = poetry2nix.overrides.withDefaults (self: super: { | ||
62 | pyparted = super.pyparted.overridePythonAttrs (old: { | ||
63 | buildInputs = old.buildInputs ++ [ parted ]; | ||
64 | nativeBuildInputs = old.nativeBuildInputs ++ [ pkg-config ]; | ||
65 | }); | ||
66 | selinux = super.selinux.overridePythonAttrs (old: { | ||
67 | buildInputs = old.buildInputs ++ [ self.setuptools-scm-git-archive ]; | ||
68 | nativeBuildInputs = old.nativeBuildInputs ++ [ pkg-config ]; | ||
69 | }); | ||
70 | }); | ||
71 | patches = [ ./fix_path.patch ]; | ||
72 | postPatch = let | ||
73 | runtimePaths = lib.makeBinPath ([ | ||
74 | systemd utillinux kmod e2fsprogs mdadm lsof coreutils | ||
75 | ] ++ additionalPackages); | ||
76 | libraryPath = builtins.concatStringsSep " " (map (v: "-rpath ${v}/lib -L ${v}/lib") [ systemd.lib ]); | ||
77 | giLibraryPath = lib.makeSearchPath "lib/girepository-1.0" [libblockdev gobject-introspection]; | ||
78 | addGiPath = writeText "add-gi-path" '' | ||
79 | import os | ||
80 | newGiPath = "${giLibraryPath}" | ||
81 | if newGiPath not in os.environ.get("GI_TYPELIB_PATH", ""): | ||
82 | os.environ["GI_TYPELIB_PATH"] = os.environ.get("GI_TYPELIB_PATH", "") + ":" + newGiPath | ||
83 | ''; | ||
84 | addPath = writeText "add-path" '' | ||
85 | import os | ||
86 | newPath = "${runtimePaths}" | ||
87 | newLibraryPath = "${libraryPath}" | ||
88 | if newPath not in os.environ.get("PATH", ""): | ||
89 | os.environ["PATH"] = os.environ.get("PATH", "") + ":" + newPath | ||
90 | os.environ["NIX_LDFLAGS"] = os.environ.get("NIX_LDFLAGS", "") + " " + newLibraryPath | ||
91 | ''; | ||
92 | in | ||
93 | '' | ||
94 | prepend() { | ||
95 | mv "$1" "$1.bak" | ||
96 | cat ${addPath} "$1.bak" > $1 | ||
97 | rm -f "$1.bak" | ||
98 | } | ||
99 | prepend "blivet/__init__.py" | ||
100 | prepend "blivet/iscsi.py" | ||
101 | prepend "blivet/tasks/availability.py" | ||
102 | prepend "blivet/util.py" | ||
103 | prepend "blivet/udev.py" | ||
104 | prependGi() { | ||
105 | mv "$1" "$1.bak" | ||
106 | cat ${addGiPath} "$1.bak" > $1 | ||
107 | rm -f "$1.bak" | ||
108 | } | ||
109 | grep -rl require_version blivet/ | while read i; do prependGi "$i"; done | ||
110 | sed -i -e "s@/lib/modules@/run/booted-system/kernel-modules/lib/modules/@" blivet/tasks/fsmount.py | ||
111 | ''; | ||
112 | postInstall = let | ||
113 | in '' | ||
114 | rm -rf $out/lib/python*/site-packages/{etc,usr} | ||
115 | ''; | ||
116 | pyproject = ./pyproject.toml; | ||
117 | poetrylock = ./poetry.lock; | ||
118 | } | ||