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