nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 replaceVars,
6 pkg-config,
7 gnused,
8 autoreconfHook,
9 gtk-doc,
10 acl,
11 systemd,
12 glib,
13 libatasmart,
14 polkit,
15 coreutils,
16 bash,
17 which,
18 expat,
19 libxslt,
20 docbook_xsl,
21 util-linux,
22 mdadm,
23 libgudev,
24 libblockdev,
25 parted,
26 gobject-introspection,
27 docbook_xml_dtd_412,
28 docbook_xml_dtd_43,
29 xfsprogs,
30 f2fs-tools,
31 dosfstools,
32 e2fsprogs,
33 btrfs-progs,
34 exfat,
35 nilfs-utils,
36 ntfs3g,
37 nixosTests,
38 udevCheckHook,
39 libiscsi,
40 libconfig,
41}:
42
43stdenv.mkDerivation (finalAttrs: {
44 pname = "udisks";
45 version = "2.11.0";
46
47 src = fetchFromGitHub {
48 owner = "storaged-project";
49 repo = "udisks";
50 tag = "udisks-${finalAttrs.version}";
51 hash = "sha256-G3qE4evcn5gtsd8Lrj6vjxCsAl/2LCdqdtaqLFFadMw=";
52 };
53
54 outputs = [
55 "out"
56 "man"
57 "dev"
58 ]
59 ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "devdoc";
60
61 patches = [
62 (replaceVars ./fix-paths.patch {
63 false = "${coreutils}/bin/false";
64 mdadm = "${mdadm}/bin/mdadm";
65 sed = "${gnused}/bin/sed";
66 sh = "${bash}/bin/sh";
67 sleep = "${coreutils}/bin/sleep";
68 true = "${coreutils}/bin/true";
69 })
70 (replaceVars ./force-path.patch {
71 path = lib.makeBinPath [
72 btrfs-progs
73 coreutils
74 dosfstools
75 e2fsprogs
76 exfat
77 f2fs-tools
78 nilfs-utils
79 xfsprogs
80 ntfs3g
81 parted
82 util-linux
83 ];
84 })
85 ];
86
87 strictDeps = true;
88 # pkg-config had to be in both to find gtk-doc and gobject-introspection
89 depsBuildBuild = [ pkg-config ];
90 nativeBuildInputs = [
91 autoreconfHook
92 which
93 gobject-introspection
94 pkg-config
95 gtk-doc
96 libxslt
97 docbook_xml_dtd_412
98 docbook_xml_dtd_43
99 docbook_xsl
100 udevCheckHook
101 ];
102
103 postPatch = lib.optionalString stdenv.hostPlatform.isMusl ''
104 substituteInPlace udisks/udisksclient.c \
105 --replace 'defined( __GNUC_PREREQ)' 1 \
106 --replace '__GNUC_PREREQ(4,6)' 1
107 '';
108
109 buildInputs = [
110 expat
111 libgudev
112 libblockdev
113 acl
114 systemd
115 glib
116 libatasmart
117 polkit
118 util-linux
119 libiscsi
120 libconfig
121 ];
122
123 preConfigure = "NOCONFIGURE=1 ./autogen.sh";
124
125 configureFlags = [
126 (lib.enableFeature (stdenv.buildPlatform == stdenv.hostPlatform) "gtk-doc")
127 "--sysconfdir=/etc"
128 "--localstatedir=/var"
129 "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
130 "--with-udevdir=$(out)/lib/udev"
131 "--with-tmpfilesdir=no"
132 "--enable-all-modules"
133 "--enable-btrfs"
134 "--enable-lvm2"
135 "--enable-smart"
136 ];
137
138 makeFlags = [
139 "INTROSPECTION_GIRDIR=$(dev)/share/gir-1.0"
140 "INTROSPECTION_TYPELIBDIR=$(out)/lib/girepository-1.0"
141 ];
142
143 installFlags = [
144 "sysconfdir=${placeholder "out"}/etc"
145 ];
146
147 enableParallelBuilding = true;
148
149 doCheck = true;
150 doInstallCheck = true;
151
152 passthru = {
153 inherit libblockdev;
154 tests.vm = nixosTests.udisks2;
155 };
156
157 meta = {
158 description = "Daemon, tools and libraries to access and manipulate disks, storage devices and technologies";
159 homepage = "https://www.freedesktop.org/wiki/Software/udisks/";
160 license = with lib.licenses; [
161 lgpl2Plus
162 gpl2Plus
163 ]; # lgpl2Plus for the library, gpl2Plus for the tools & daemon
164 maintainers = with lib.maintainers; [ johnazoidberg ];
165 teams = [ lib.teams.freedesktop ];
166 platforms = lib.platforms.linux;
167 };
168})