Skip to content

Commit

Permalink
compressFirmwareXz: never compress lib/firmware/edid
Browse files Browse the repository at this point in the history
this allows us not to pass `compressFirmware = false;`
 inside EDID derivations as this mechanic very tricky to discover.

related to NixOS#279789
  • Loading branch information
nazarewk committed Jan 9, 2024
1 parent 44b70eb commit 6ed1933
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 7 additions & 3 deletions pkgs/build-support/kernel/compress-firmware-xz.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ let
in

runCommand "${firmware.name}-xz" args ''
edids=(-path 'lib/firmware/edid/*')
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 -0 mkdir -pv --)
(cd ${firmware} && find lib/firmware -type f -not "''${edids[@]}" -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
(cd ${firmware} && find lib/firmware -type l -not "''${edids[@]}") | while read link; do
target="$(readlink "${firmware}/$link")"
ln -vs -- "''${target/^${firmware}/$out}.xz" "$out/$link.xz"
done
(cd ${firmware} && find lib/firmware -type f "''${edids[@]}" -print0) |
(cd $out && xargs -0rtP "$NIX_BUILD_CORES" -n1 \
sh -c 'ln -vs -- "${firmware}/$1" "$out/$1"' --)
''
3 changes: 0 additions & 3 deletions pkgs/tools/misc/edid-generator/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ stdenv.mkDerivation {
pname = "edid-generator";
version = "master-2023-11-20";

# so `hardware.firmware` doesn't compress it
compressFirmware = false;

src = fetchFromGitHub {
owner = "akatrevorjay";
repo = "edid-generator";
Expand Down

0 comments on commit 6ed1933

Please sign in to comment.