mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 06:45:16 +01:00
76405e3077
Fixes: 8aa8e0ce7f
("nixos/udev: compress all firmware if supported")
16 lines
579 B
Nix
16 lines
579 B
Nix
{ runCommand }:
|
|
|
|
firmware:
|
|
|
|
runCommand "${firmware.name}-xz" {} ''
|
|
mkdir -p $out/lib
|
|
(cd ${firmware} && find lib/firmware -type d -print0) |
|
|
(cd $out && xargs -0 mkdir -v --)
|
|
(cd ${firmware} && find lib/firmware -type f -print0) |
|
|
(cd $out && xargs -0rtP "$NIX_BUILD_CORES" -n1 \
|
|
sh -c 'xz -9c -T1 -C crc32 --lzma2=dict=2MiB "${firmware}/$1" > "$1.xz"' --)
|
|
(cd ${firmware} && find lib/firmware -type l) | while read link; do
|
|
target="$(readlink "${firmware}/$link")"
|
|
ln -vs -- "''${target/^${firmware}/$out}.xz" "$out/$link.xz"
|
|
done
|
|
''
|