@@ -5,7 +5,7 @@
55, fetchpatch
66, substituteAll
77, gtk-doc
8−, pkgconfig
8+, pkg-config
99, gobject-introspection
1010, intltool
1111, libgudev
@@ -29,7 +29,7 @@
2929, libuuid
3030, colord
3131, docbook_xml_dtd_43
32−, docbook_xsl
32+, docbook-xsl-nons
3333, ninja
3434, gcab
3535, python3
@@ -67,10 +67,6 @@ let
6767 requests
6868 ]);
6969
70− fontsConf = makeFontsConf {
71− fontDirectories = [ freefont_ttf ];
72− };
73−
7470 isx86 = stdenv.isx86_64 || stdenv.isi686;
7571
7672 # Dell isn't supported on Aarch64
@@ -95,28 +91,53 @@ let
9591 pname = "fwupd";
9692 version = "1.4.5";
9793
94+ # libfwupd goes to lib
95+ # daemon, plug-ins and libfwupdplugin go to out
96+ # CLI programs go to out
97+ outputs = [ "out" "lib" "dev" "devdoc" "man" "installedTests" ];
98+
9899 src = fetchurl {
99100 url = "https://people.freedesktop.org/~hughsient/releases/fwupd-${version}.tar.xz";
100101 sha256 = "0hpqxwqbbqn440c2swpnc06z8dskisrli4ynsxrzzqyp0dan46xw";
101102 };
102103
103− # libfwupd goes to lib
104− # daemon, plug-ins and libfwupdplugin go to out
105− # CLI programs go to out
106− outputs = [ "out" "lib" "dev" "devdoc" "man" "installedTests" ];
104+ patches = [
105+ # Do not try to create useless paths in /var.
106+ ./fix-paths.patch
107+
108+ # Allow installing
109+ ./add-option-for-installation-sysconfdir.patch
110+
111+ # Install plug-ins and libfwupdplugin to out,
112+ # they are not really part of the library.
113+ ./install-fwupdplugin-to-out.patch
114+
115+ # Installed tests are installed to different output
116+ # we also cannot have fwupd-tests.conf in $out/etc since it would form a cycle.
117+ (substituteAll {
118+ src = ./installed-tests-path.patch;
119+ # Needs a different set of modules than po/make-images.
120+ inherit installedTestsPython;
121+ })
122+
123+ (fetchpatch {
124+ url = "https://github.com/fwupd/fwupd/commit/3e82beeddac31292c50229e59e2404865edee5ad.patch";
125+ sha256 = "17p9r8qddqkrnhy9bvp9207afh5fcl1whn79nqcp57b4q4c17zgk";
126+ })
127+ ];
107128
108129 nativeBuildInputs = [
109130 meson
110131 ninja
111132 gtk-doc
112− pkgconfig
133+ pkg-config
113134 gobject-introspection
114135 intltool
115136 shared-mime-info
116137 valgrind
117138 gcab
118139 docbook_xml_dtd_43
119− docbook_xsl
140+ docbook-xsl-nons
120141 help2man
121142 libxslt
122143 python
@@ -152,55 +173,6 @@ let
152173 libsmbios
153174 ];
154175
155− patches = [
156− ./fix-paths.patch
157− ./add-option-for-installation-sysconfdir.patch
158−
159− # Install plug-ins and libfwupdplugin to out,
160− # they are not really part of the library.
161− ./install-fwupdplugin-to-out.patch
162−
163− # Installed tests are installed to different output
164− # we also cannot have fwupd-tests.conf in $out/etc since it would form a cycle.
165− (substituteAll {
166− src = ./installed-tests-path.patch;
167− # Needs a different set of modules than po/make-images.
168− inherit installedTestsPython;
169− })
170−
171− (fetchpatch {
172− url = "https://github.com/fwupd/fwupd/commit/3e82beeddac31292c50229e59e2404865edee5ad.patch";
173− sha256 = "17p9r8qddqkrnhy9bvp9207afh5fcl1whn79nqcp57b4q4c17zgk";
174− })
175− ];
176−
177− postPatch = ''
178− patchShebangs \
179− contrib/get-version.py \
180− contrib/generate-version-script.py \
181− meson_post_install.sh \
182− po/make-images \
183− po/make-images.sh \
184− po/test-deps
185− '';
186−
187− # /etc/os-release not available in sandbox
188− # doCheck = true;
189−
190− preFixup = let
191− binPath = [
192− efibootmgr
193− bubblewrap
194− tpm2-tools
195− ] ++ stdenv.lib.optional haveFlashrom flashrom;
196− in ''
197− gappsWrapperArgs+=(
198− --prefix XDG_DATA_DIRS : "${shared-mime-info}/share"
199− # See programs reached with fu_common_find_program_in_path in source
200− --prefix PATH : "${stdenv.lib.makeBinPath binPath}"
201− )
202− '';
203−
204176 mesonFlags = [
205177 "-Dgtkdoc=true"
206178 "-Dplugin_dummy=true"
@@ -228,20 +200,57 @@ let
228200 "-Dplugin_flashrom=true"
229201 ];
230202
231− FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file
203+ # TODO: wrapGAppsHook wraps efi capsule even though it is not ELF
204+ dontWrapGApps = true;
205+
206+ # /etc/os-release not available in sandbox
207+ # doCheck = true;
208+
209+ # Environment variables
210+
211+ # Fontconfig error: Cannot load default config file
212+ FONTCONFIG_FILE =
213+ let
214+ fontsConf = makeFontsConf {
215+ fontDirectories = [ freefont_ttf ];
216+ };
217+ in fontsConf;
232218
233219 # error: “PolicyKit files are missing”
234220 # https://github.com/NixOS/nixpkgs/pull/67625#issuecomment-525788428
235221 PKG_CONFIG_POLKIT_GOBJECT_1_ACTIONDIR = "/run/current-system/sw/share/polkit-1/actions";
236222
237− # TODO: wrapGAppsHook wraps efi capsule even though it is not elf
238− dontWrapGApps = true;
223+ # Phase hooks
224+
225+ postPatch = ''
226+ patchShebangs \
227+ contrib/get-version.py \
228+ contrib/generate-version-script.py \
229+ meson_post_install.sh \
230+ po/make-images \
231+ po/make-images.sh \
232+ po/test-deps
233+ '';
239234
240235 preCheck = ''
241236 addToSearchPath XDG_DATA_DIRS "${shared-mime-info}/share"
242237 '';
243238
244− # so we need to wrap the executables manually
239+ preFixup = let
240+ binPath = [
241+ efibootmgr
242+ bubblewrap
243+ tpm2-tools
244+ ] ++ stdenv.lib.optional haveFlashrom flashrom;
245+ in ''
246+ gappsWrapperArgs+=(
247+ --prefix XDG_DATA_DIRS : "${shared-mime-info}/share"
248+ # See programs reached with fu_common_find_program_in_path in source
249+ --prefix PATH : "${stdenv.lib.makeBinPath binPath}"
250+ )
251+ '';
252+
253+ # Since we had to disable wrapGAppsHook, we need to wrap the executables manually.
245254 postFixup = ''
246255 find -L "$out/bin" "$out/libexec" -type f -executable -print0 \
247256 | while IFS= read -r -d ''' file; do
@@ -312,7 +321,7 @@ let
312321 meta = with stdenv.lib; {
313322 homepage = "https://fwupd.org/";
314323 maintainers = with maintainers; [ jtojnar ];
315− license = [ licenses.gpl2 ];
324+ license = licenses.lgpl21Plus;
316325 platforms = platforms.linux;
317326 };
318327 };