1{ stdenv
2, lib
3, fetchFromGitHub
4, gitUpdater
5, makeBinaryWrapper
6, pkg-config
7, asciidoc
8, libxslt
9, docbook_xsl
10, bash
11, kmod
12, binutils
13, bzip2
14, coreutils
15, cpio
16, findutils
17, gnugrep
18, gnused
19, gnutar
20, gzip
21, lz4
22, lzop
23, squashfsTools
24, util-linux
25, xz
26, zstd
27}:
28
29stdenv.mkDerivation rec {
30 pname = "dracut";
31 version = "059";
32
33 src = fetchFromGitHub {
34 owner = "dracutdevs";
35 repo = "dracut";
36 rev = version;
37 hash = "sha256-zSyC2SnSQkmS/mDpBXG2DtVVanRRI9COKQJqYZZCPJM=";
38 };
39
40 strictDeps = true;
41
42 buildInputs = [
43 bash
44 kmod
45 ];
46
47 nativeBuildInputs = [
48 makeBinaryWrapper
49 pkg-config
50 asciidoc
51 libxslt
52 docbook_xsl
53 ];
54
55 postPatch = ''
56 substituteInPlace dracut.sh \
57 --replace 'dracutbasedir="$dracutsysrootdir"/usr/lib/dracut' 'dracutbasedir="$dracutsysrootdir"'"$out/lib/dracut"
58 substituteInPlace lsinitrd.sh \
59 --replace 'dracutbasedir=/usr/lib/dracut' "dracutbasedir=$out/lib/dracut"
60
61 echo 'DRACUT_VERSION=${version}' >dracut-version.sh
62 '';
63
64 preConfigure = ''
65 patchShebangs ./configure
66 '';
67
68 postFixup = ''
69 wrapProgram $out/bin/dracut --prefix PATH : ${lib.makeBinPath [
70 coreutils
71 util-linux
72 ]} --suffix DRACUT_PATH : ${lib.makeBinPath [
73 bash
74 binutils
75 coreutils
76 findutils
77 gnugrep
78 gnused
79 gnutar
80 stdenv.cc.libc # for ldd command
81 util-linux
82 ]}
83 wrapProgram $out/bin/dracut-catimages --set PATH ${lib.makeBinPath [
84 coreutils
85 cpio
86 findutils
87 gzip
88 ]}
89 wrapProgram $out/bin/lsinitrd --set PATH ${lib.makeBinPath [
90 binutils
91 bzip2
92 coreutils
93 cpio
94 gnused
95 gzip
96 lz4
97 lzop
98 squashfsTools
99 util-linux
100 xz
101 zstd
102 ]}
103 '';
104
105 passthru.updateScript = gitUpdater { };
106
107 meta = with lib; {
108 homepage = "https://github.com/dracutdevs/dracut/wiki";
109 description = "An event driven initramfs infrastructure";
110 license = licenses.gpl2Plus;
111 maintainers = with maintainers; [ lilyinstarlight ];
112 platforms = platforms.linux;
113 };
114}