compressFirmwareXz: preserve meta attributes

Among other things, this preserves the package priority, which is
important when building the `hardware.firmware` environment in NixOS.
This commit is contained in:
rnhmjoj 2023-06-24 23:08:28 +02:00
parent 1c9db9710c
commit 4124eb7bd5
No known key found for this signature in database
GPG Key ID: BFBAF4C975F76450

View File

@ -1,8 +1,12 @@
{ runCommand }:
{ runCommand, lib }:
firmware:
runCommand "${firmware.name}-xz" {} ''
let
args = lib.optionalAttrs (firmware ? meta) { inherit (firmware) meta; };
in
runCommand "${firmware.name}-xz" args ''
mkdir -p $out/lib
(cd ${firmware} && find lib/firmware -type d -print0) |
(cd $out && xargs -0 mkdir -v --)