lol

Merge pull request #218459 from R-VdP/fwupd-1-8-12

fwupd: 1.8.10 -> 1.8.12

authored by

Jan Tojnar and committed by
GitHub
a1cbe948 8281752e

+257 -235
+1 -1
pkgs/development/libraries/libjcat/default.nix
··· 71 71 description = "Library for reading and writing Jcat files"; 72 72 homepage = "https://github.com/hughsie/libjcat"; 73 73 license = licenses.lgpl21Plus; 74 - maintainers = with maintainers; [ jtojnar ]; 74 + maintainers = with maintainers; [ ]; 75 75 platforms = platforms.all; 76 76 }; 77 77 }
+1 -1
pkgs/development/libraries/libxmlb/default.nix
··· 71 71 description = "A library to help create and query binary XML blobs"; 72 72 homepage = "https://github.com/hughsie/libxmlb"; 73 73 license = licenses.lgpl21Plus; 74 - maintainers = with maintainers; [ jtojnar ]; 74 + maintainers = with maintainers; [ ]; 75 75 platforms = platforms.unix; 76 76 }; 77 77 }
+255 -233
pkgs/os-specific/linux/firmware/fwupd/default.nix
··· 28 28 , ninja 29 29 , gcab 30 30 , gnutls 31 + , pandoc 31 32 , protobufc 32 33 , python3 33 34 , wrapGAppsNoGuiHook ··· 79 80 # Experimental 80 81 haveFlashrom = isx86 && enableFlashrom; 81 82 82 - runPythonCommand = name: buildCommandPython: runCommand name { 83 - nativeBuildInputs = [ python3 ]; 84 - inherit buildCommandPython; 85 - } '' 86 - exec python3 -c "$buildCommandPython" 87 - ''; 83 + runPythonCommand = 84 + name: 85 + buildCommandPython: 86 + 87 + runCommand 88 + name 89 + { 90 + nativeBuildInputs = [ python3 ]; 91 + inherit buildCommandPython; 92 + } 93 + '' 94 + exec python3 -c "$buildCommandPython" 95 + ''; 88 96 89 97 test-firmware = 90 98 let ··· 103 111 }; 104 112 }; 105 113 in 106 - src // { 107 - meta = src.meta // { 108 - # For update script 109 - position = 110 - let 111 - pos = builtins.unsafeGetAttrPos "updateScript" test-firmware; 112 - in 113 - pos.file + ":" + toString pos.line; 114 - }; 114 + src // { 115 + meta = src.meta // { 116 + # For update script 117 + position = 118 + let 119 + pos = builtins.unsafeGetAttrPos "updateScript" test-firmware; 120 + in 121 + pos.file + ":" + toString pos.line; 115 122 }; 116 - 123 + }; 124 + in 125 + stdenv.mkDerivation (finalAttrs: { 126 + pname = "fwupd"; 127 + version = "1.8.10"; 117 128 118 - self = stdenv.mkDerivation rec { 119 - pname = "fwupd"; 120 - version = "1.8.10"; 129 + # libfwupd goes to lib 130 + # daemon, plug-ins and libfwupdplugin go to out 131 + # CLI programs go to out 132 + outputs = [ "out" "lib" "dev" "devdoc" "man" "installedTests" ]; 121 133 122 - # libfwupd goes to lib 123 - # daemon, plug-ins and libfwupdplugin go to out 124 - # CLI programs go to out 125 - outputs = [ "out" "lib" "dev" "devdoc" "man" "installedTests" ]; 134 + src = fetchFromGitHub { 135 + owner = "fwupd"; 136 + repo = "fwupd"; 137 + rev = finalAttrs.version; 138 + hash = "sha256-a4F7skyukl4jW3apGi1ie/EcuGlkZoszyZdtLFuJewA="; 139 + }; 126 140 127 - src = fetchurl { 128 - url = "https://people.freedesktop.org/~hughsient/releases/fwupd-${version}.tar.xz"; 129 - hash = "sha256-vvNUidNdhW9xeksjEVnkIR7CZ4oBQizZJRMFtZUq6Ow="; 130 - }; 141 + patches = [ 142 + # Since /etc is the domain of NixOS, not Nix, 143 + # we cannot install files there. 144 + # Let’s install the files to $prefix/etc 145 + # while still reading them from /etc. 146 + # NixOS module for fwupd will take take care of copying the files appropriately. 147 + ./add-option-for-installation-sysconfdir.patch 131 148 132 - patches = [ 133 - # Since /etc is the domain of NixOS, not Nix, 134 - # we cannot install files there. 135 - # Let’s install the files to $prefix/etc 136 - # while still reading them from /etc. 137 - # NixOS module for fwupd will take take care of copying the files appropriately. 138 - ./add-option-for-installation-sysconfdir.patch 149 + # Install plug-ins and libfwupdplugin to $out output, 150 + # they are not really part of the library. 151 + ./install-fwupdplugin-to-out.patch 139 152 140 - # Install plug-ins and libfwupdplugin to $out output, 141 - # they are not really part of the library. 142 - ./install-fwupdplugin-to-out.patch 153 + # Installed tests are installed to different output 154 + # we also cannot have fwupd-tests.conf in $out/etc since it would form a cycle. 155 + ./installed-tests-path.patch 143 156 144 - # Installed tests are installed to different output 145 - # we also cannot have fwupd-tests.conf in $out/etc since it would form a cycle. 146 - ./installed-tests-path.patch 157 + # EFI capsule is located in fwupd-efi now. 158 + ./efi-app-path.patch 159 + ]; 147 160 148 - # EFI capsule is located in fwupd-efi now. 149 - ./efi-app-path.patch 150 - ]; 161 + nativeBuildInputs = [ 162 + # required for firmware zipping 163 + ensureNewerSourcesForZipFilesHook 164 + meson 165 + ninja 166 + gi-docgen 167 + pkg-config 168 + gobject-introspection 169 + gettext 170 + shared-mime-info 171 + valgrind 172 + gcab 173 + gnutls 174 + pandoc 175 + protobufc # for protoc 176 + python 177 + wrapGAppsNoGuiHook 178 + vala 179 + ]; 151 180 152 - nativeBuildInputs = [ 153 - # required for firmware zipping 154 - ensureNewerSourcesForZipFilesHook 155 - meson 156 - ninja 157 - gi-docgen 158 - pkg-config 159 - gobject-introspection 160 - gettext 161 - shared-mime-info 162 - valgrind 163 - gcab 164 - gnutls 165 - protobufc # for protoc 166 - python 167 - wrapGAppsNoGuiHook 168 - vala 169 - ]; 181 + buildInputs = [ 182 + polkit 183 + libxmlb 184 + gusb 185 + sqlite 186 + libarchive 187 + curl 188 + elfutils 189 + libgudev 190 + colord 191 + libjcat 192 + libuuid 193 + json-glib 194 + umockdev 195 + bash-completion 196 + pango 197 + tpm2-tss 198 + efivar 199 + fwupd-efi 200 + protobufc 201 + modemmanager 202 + libmbim 203 + libcbor 204 + libqmi 205 + xz # for liblzma 206 + ] ++ lib.optionals haveDell [ 207 + libsmbios 208 + ] ++ lib.optionals haveFlashrom [ 209 + flashrom 210 + ]; 170 211 171 - buildInputs = [ 172 - polkit 173 - libxmlb 174 - gusb 175 - sqlite 176 - libarchive 177 - curl 178 - elfutils 179 - libgudev 180 - colord 181 - libjcat 182 - libuuid 183 - json-glib 184 - umockdev 185 - bash-completion 186 - pango 187 - tpm2-tss 188 - efivar 189 - fwupd-efi 190 - protobufc 191 - modemmanager 192 - libmbim 193 - libcbor 194 - libqmi 195 - xz # for liblzma 196 - ] ++ lib.optionals haveDell [ 197 - libsmbios 198 - ] ++ lib.optionals haveFlashrom [ 199 - flashrom 200 - ]; 212 + mesonFlags = [ 213 + "-Ddocs=enabled" 214 + "-Dplugin_dummy=true" 215 + # We are building the official releases. 216 + "-Dsupported_build=enabled" 217 + # Would dlopen libsoup to preserve compatibility with clients linking against older fwupd. 218 + # https://github.com/fwupd/fwupd/commit/173d389fa59d8db152a5b9da7cc1171586639c97 219 + "-Dsoup_session_compat=false" 220 + "-Dudevdir=lib/udev" 221 + "-Dsystemd_root_prefix=${placeholder "out"}" 222 + "-Dinstalled_test_prefix=${placeholder "installedTests"}" 223 + "--localstatedir=/var" 224 + "--sysconfdir=/etc" 225 + "-Dsysconfdir_install=${placeholder "out"}/etc" 226 + "-Defi_os_dir=nixos" 227 + "-Dplugin_modem_manager=enabled" 201 228 202 - mesonFlags = [ 203 - "-Ddocs=enabled" 204 - "-Dplugin_dummy=true" 205 - # We are building the official releases. 206 - "-Dsupported_build=enabled" 207 - # Would dlopen libsoup to preserve compatibility with clients linking against older fwupd. 208 - # https://github.com/fwupd/fwupd/commit/173d389fa59d8db152a5b9da7cc1171586639c97 209 - "-Dsoup_session_compat=false" 210 - "-Dudevdir=lib/udev" 211 - "-Dsystemd_root_prefix=${placeholder "out"}" 212 - "-Dinstalled_test_prefix=${placeholder "installedTests"}" 213 - "--localstatedir=/var" 214 - "--sysconfdir=/etc" 215 - "-Dsysconfdir_install=${placeholder "out"}/etc" 216 - "-Defi_os_dir=nixos" 217 - "-Dplugin_modem_manager=enabled" 229 + # We do not want to place the daemon into lib (cyclic reference) 230 + "--libexecdir=${placeholder "out"}/libexec" 231 + ] ++ lib.optionals (!haveDell) [ 232 + "-Dplugin_dell=disabled" 233 + "-Dplugin_synaptics_mst=disabled" 234 + ] ++ lib.optionals (!haveRedfish) [ 235 + "-Dplugin_redfish=disabled" 236 + ] ++ lib.optionals (!haveFlashrom) [ 237 + "-Dplugin_flashrom=disabled" 238 + ] ++ lib.optionals (!haveMSR) [ 239 + "-Dplugin_msr=disabled" 240 + ]; 218 241 219 - # We do not want to place the daemon into lib (cyclic reference) 220 - "--libexecdir=${placeholder "out"}/libexec" 221 - ] ++ lib.optionals (!haveDell) [ 222 - "-Dplugin_dell=disabled" 223 - "-Dplugin_synaptics_mst=disabled" 224 - ] ++ lib.optionals (!haveRedfish) [ 225 - "-Dplugin_redfish=disabled" 226 - ] ++ lib.optionals (!haveFlashrom) [ 227 - "-Dplugin_flashrom=disabled" 228 - ] ++ lib.optionals (!haveMSR) [ 229 - "-Dplugin_msr=disabled" 230 - ]; 242 + # TODO: wrapGAppsHook wraps efi capsule even though it is not ELF 243 + dontWrapGApps = true; 231 244 232 - # TODO: wrapGAppsHook wraps efi capsule even though it is not ELF 233 - dontWrapGApps = true; 245 + doCheck = true; 234 246 235 - doCheck = true; 247 + # Environment variables 236 248 237 - # Environment variables 249 + # Fontconfig error: Cannot load default config file 250 + FONTCONFIG_FILE = 251 + let 252 + fontsConf = makeFontsConf { 253 + fontDirectories = [ freefont_ttf ]; 254 + }; 255 + in 256 + fontsConf; 238 257 239 - # Fontconfig error: Cannot load default config file 240 - FONTCONFIG_FILE = 241 - let 242 - fontsConf = makeFontsConf { 243 - fontDirectories = [ freefont_ttf ]; 244 - }; 245 - in fontsConf; 258 + # error: “PolicyKit files are missing” 259 + # https://github.com/NixOS/nixpkgs/pull/67625#issuecomment-525788428 260 + PKG_CONFIG_POLKIT_GOBJECT_1_ACTIONDIR = "/run/current-system/sw/share/polkit-1/actions"; 246 261 247 - # error: “PolicyKit files are missing” 248 - # https://github.com/NixOS/nixpkgs/pull/67625#issuecomment-525788428 249 - PKG_CONFIG_POLKIT_GOBJECT_1_ACTIONDIR = "/run/current-system/sw/share/polkit-1/actions"; 262 + # Phase hooks 250 263 251 - # Phase hooks 264 + postPatch = '' 265 + patchShebangs \ 266 + contrib/generate-version-script.py \ 267 + po/test-deps 252 268 253 - postPatch = '' 254 - patchShebangs \ 255 - contrib/generate-version-script.py \ 256 - po/test-deps 269 + substituteInPlace data/installed-tests/fwupdmgr-p2p.sh \ 270 + --replace "gdbus" ${glib.bin}/bin/gdbus 257 271 258 - substituteInPlace data/installed-tests/fwupdmgr-p2p.sh \ 259 - --replace "gdbus" ${glib.bin}/bin/gdbus 272 + # tests fail with: Failed to load SMBIOS: neither SMBIOS or DT found 273 + sed -i 's/test(.*)//' plugins/lenovo-thinklmi/meson.build 274 + sed -i 's/test(.*)//' plugins/mtd/meson.build 275 + # fails on amd cpu 276 + sed -i 's/test(.*)//' libfwupdplugin/meson.build 277 + # in nixos test tries to chmod 0777 $out/share/installed-tests/fwupd/tests/redfish.conf 278 + sed -i "s/get_option('tests')/false/" plugins/redfish/meson.build 260 279 261 - # tests fail with: Failed to load SMBIOS: neither SMBIOS or DT found 262 - sed -i 's/test(.*)//' plugins/lenovo-thinklmi/meson.build 263 - sed -i 's/test(.*)//' plugins/mtd/meson.build 264 - # fails on amd cpu 265 - sed -i 's/test(.*)//' libfwupdplugin/meson.build 266 - # in nixos test tries to chmod 0777 $out/share/installed-tests/fwupd/tests/redfish.conf 267 - sed -i "s/get_option('tests')/false/" plugins/redfish/meson.build 268 - ''; 280 + # Device tests use device emulation and need to download emulation data from 281 + # the internet, which does not work on our test VMs. 282 + # It's probably better to disable these tests for NixOS by setting 283 + # the device-tests directory to /dev/null. 284 + # For more info on device emulation, see: 285 + # https://github.com/fwupd/fwupd/blob/eeeac4e9ba8a6513428b456a551bffd95d533e50/docs/device-emulation.md 286 + substituteInPlace data/installed-tests/meson.build \ 287 + --replace "join_paths(datadir, 'fwupd', 'device-tests')" "'/dev/null'" 288 + ''; 269 289 270 - preBuild = '' 271 - # jcat-tool at buildtime requires a home directory 272 - export HOME="$(mktemp -d)" 273 - ''; 290 + preBuild = '' 291 + # jcat-tool at buildtime requires a home directory 292 + export HOME="$(mktemp -d)" 293 + ''; 274 294 275 - preCheck = '' 276 - addToSearchPath XDG_DATA_DIRS "${shared-mime-info}/share" 295 + preCheck = '' 296 + addToSearchPath XDG_DATA_DIRS "${shared-mime-info}/share" 277 297 278 - echo "12345678901234567890123456789012" > machine-id 279 - export NIX_REDIRECTS=/etc/machine-id=$(realpath machine-id) \ 280 - LD_PRELOAD=${libredirect}/lib/libredirect.so 281 - ''; 298 + echo "12345678901234567890123456789012" > machine-id 299 + export NIX_REDIRECTS=/etc/machine-id=$(realpath machine-id) \ 300 + LD_PRELOAD=${libredirect}/lib/libredirect.so 301 + ''; 282 302 283 - preInstall = '' 284 - # We have pkexec on PATH so Meson will try to use it when installation fails 285 - # due to being unable to write to e.g. /etc. 286 - # Let’s pretend we already ran pkexec – 287 - # the pkexec on PATH would complain it lacks setuid bit, 288 - # obscuring the underlying error. 289 - # https://github.com/mesonbuild/meson/blob/492cc9bf95d573e037155b588dc5110ded4d9a35/mesonbuild/minstall.py#L558 290 - export PKEXEC_UID=-1 291 - ''; 303 + preInstall = '' 304 + # We have pkexec on PATH so Meson will try to use it when installation fails 305 + # due to being unable to write to e.g. /etc. 306 + # Let’s pretend we already ran pkexec – 307 + # the pkexec on PATH would complain it lacks setuid bit, 308 + # obscuring the underlying error. 309 + # https://github.com/mesonbuild/meson/blob/492cc9bf95d573e037155b588dc5110ded4d9a35/mesonbuild/minstall.py#L558 310 + export PKEXEC_UID=-1 311 + ''; 292 312 293 - postInstall = '' 294 - # These files have weird licenses so they are shipped separately. 295 - cp --recursive --dereference "${test-firmware}/installed-tests/tests" "$installedTests/libexec/installed-tests/fwupd" 296 - ''; 313 + postInstall = '' 314 + # These files have weird licenses so they are shipped separately. 315 + cp --recursive --dereference "${test-firmware}/installed-tests/tests" "$installedTests/libexec/installed-tests/fwupd" 316 + ''; 297 317 298 - preFixup = let 318 + preFixup = 319 + let 299 320 binPath = [ 300 321 efibootmgr 301 322 bubblewrap 302 323 tpm2-tools 303 324 ]; 304 - in '' 325 + in 326 + '' 305 327 gappsWrapperArgs+=( 306 328 --prefix XDG_DATA_DIRS : "${shared-mime-info}/share" 307 329 # See programs reached with fu_common_find_program_in_path in source ··· 309 331 ) 310 332 ''; 311 333 312 - postFixup = '' 313 - # Since we had to disable wrapGAppsHook, we need to wrap the executables manually. 314 - find -L "$out/bin" "$out/libexec" -type f -executable -print0 \ 315 - | while IFS= read -r -d ''' file; do 316 - if [[ "$file" != *.efi ]]; then 317 - echo "Wrapping program $file" 318 - wrapGApp "$file" 319 - fi 320 - done 334 + postFixup = '' 335 + # Since we had to disable wrapGAppsHook, we need to wrap the executables manually. 336 + find -L "$out/bin" "$out/libexec" -type f -executable -print0 \ 337 + | while IFS= read -r -d ''' file; do 338 + if [[ "$file" != *.efi ]]; then 339 + echo "Wrapping program $file" 340 + wrapGApp "$file" 341 + fi 342 + done 321 343 322 - # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. 323 - moveToOutput "share/doc" "$devdoc" 324 - ''; 344 + # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. 345 + moveToOutput "share/doc" "$devdoc" 346 + ''; 325 347 326 - separateDebugInfo = true; 348 + separateDebugInfo = true; 327 349 328 - passthru = { 329 - filesInstalledToEtc = [ 330 - "fwupd/bios-settings.d/README.md" 331 - "fwupd/daemon.conf" 332 - "fwupd/remotes.d/lvfs-testing.conf" 333 - "fwupd/remotes.d/lvfs.conf" 334 - "fwupd/remotes.d/vendor.conf" 335 - "fwupd/remotes.d/vendor-directory.conf" 336 - "fwupd/uefi_capsule.conf" 337 - "pki/fwupd/GPG-KEY-Linux-Foundation-Firmware" 338 - "pki/fwupd/GPG-KEY-Linux-Vendor-Firmware-Service" 339 - "pki/fwupd/LVFS-CA.pem" 340 - "pki/fwupd-metadata/GPG-KEY-Linux-Foundation-Metadata" 341 - "pki/fwupd-metadata/GPG-KEY-Linux-Vendor-Firmware-Service" 342 - "pki/fwupd-metadata/LVFS-CA.pem" 343 - "grub.d/35_fwupd" 344 - ] ++ lib.optionals haveDell [ 345 - "fwupd/remotes.d/dell-esrt.conf" 346 - ] ++ lib.optionals haveRedfish [ 347 - "fwupd/redfish.conf" 348 - ] ++ lib.optionals haveMSR [ 349 - "fwupd/msr.conf" 350 - ] ++ lib.optionals isx86 [ 351 - "fwupd/thunderbolt.conf" 352 - ]; 350 + passthru = { 351 + filesInstalledToEtc = [ 352 + "fwupd/bios-settings.d/README.md" 353 + "fwupd/daemon.conf" 354 + "fwupd/remotes.d/lvfs-testing.conf" 355 + "fwupd/remotes.d/lvfs.conf" 356 + "fwupd/remotes.d/vendor.conf" 357 + "fwupd/remotes.d/vendor-directory.conf" 358 + "fwupd/uefi_capsule.conf" 359 + "pki/fwupd/GPG-KEY-Linux-Foundation-Firmware" 360 + "pki/fwupd/GPG-KEY-Linux-Vendor-Firmware-Service" 361 + "pki/fwupd/LVFS-CA.pem" 362 + "pki/fwupd-metadata/GPG-KEY-Linux-Foundation-Metadata" 363 + "pki/fwupd-metadata/GPG-KEY-Linux-Vendor-Firmware-Service" 364 + "pki/fwupd-metadata/LVFS-CA.pem" 365 + "grub.d/35_fwupd" 366 + ] ++ lib.optionals haveDell [ 367 + "fwupd/remotes.d/dell-esrt.conf" 368 + ] ++ lib.optionals haveRedfish [ 369 + "fwupd/redfish.conf" 370 + ] ++ lib.optionals haveMSR [ 371 + "fwupd/msr.conf" 372 + ] ++ lib.optionals isx86 [ 373 + "fwupd/thunderbolt.conf" 374 + ]; 353 375 354 - # DisabledPlugins key in fwupd/daemon.conf 355 - defaultDisabledPlugins = [ 356 - "test" 357 - "test_ble" 358 - ]; 376 + # DisabledPlugins key in fwupd/daemon.conf 377 + defaultDisabledPlugins = [ 378 + "test" 379 + "test_ble" 380 + ]; 359 381 360 - # For updating. 361 - inherit test-firmware; 382 + # For updating. 383 + inherit test-firmware; 362 384 363 - tests = let 385 + tests = 386 + let 364 387 listToPy = list: "[${lib.concatMapStringsSep ", " (f: "'${f}'") list}]"; 365 - in { 388 + in 389 + { 366 390 installedTests = nixosTests.installed-tests.fwupd; 367 391 368 392 passthruMatches = runPythonCommand "fwupd-test-passthru-matches" '' ··· 371 395 import os 372 396 import pathlib 373 397 374 - etc = '${self}/etc' 398 + etc = '${finalAttrs.finalPackage}/etc' 375 399 package_etc = set(itertools.chain.from_iterable([[os.path.relpath(os.path.join(prefix, file), etc) for file in files] for (prefix, dirs, files) in os.walk(etc)])) 376 - passthru_etc = set(${listToPy passthru.filesInstalledToEtc}) 400 + passthru_etc = set(${listToPy finalAttrs.passthru.filesInstalledToEtc}) 377 401 assert len(package_etc - passthru_etc) == 0, f'fwupd package contains the following paths in /etc that are not listed in passthru.filesInstalledToEtc: {package_etc - passthru_etc}' 378 402 assert len(passthru_etc - package_etc) == 0, f'fwupd package lists the following paths in passthru.filesInstalledToEtc that are not contained in /etc: {passthru_etc - package_etc}' 379 403 380 404 config = configparser.RawConfigParser() 381 - config.read('${self}/etc/fwupd/daemon.conf') 405 + config.read('${finalAttrs.finalPackage}/etc/fwupd/daemon.conf') 382 406 package_disabled_plugins = config.get('fwupd', 'DisabledPlugins').rstrip(';').split(';') 383 - passthru_disabled_plugins = ${listToPy passthru.defaultDisabledPlugins} 407 + passthru_disabled_plugins = ${listToPy finalAttrs.passthru.defaultDisabledPlugins} 384 408 assert package_disabled_plugins == passthru_disabled_plugins, f'Default disabled plug-ins in the package {package_disabled_plugins} do not match those listed in passthru.defaultDisabledPlugins {passthru_disabled_plugins}' 385 409 386 410 pathlib.Path(os.getenv('out')).touch() 387 411 ''; 388 412 }; 389 - }; 413 + }; 390 414 391 - meta = with lib; { 392 - homepage = "https://fwupd.org/"; 393 - maintainers = with maintainers; [ jtojnar ]; 394 - license = licenses.lgpl21Plus; 395 - platforms = platforms.linux; 396 - }; 415 + meta = with lib; { 416 + homepage = "https://fwupd.org/"; 417 + maintainers = with maintainers; [ ]; 418 + license = licenses.lgpl21Plus; 419 + platforms = platforms.linux; 397 420 }; 398 - 399 - in self 421 + })