Skip to content

Commit

Permalink
Fix empty firmware derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbaur committed Feb 12, 2025
1 parent 0e22f93 commit a694f89
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions compress-firmware.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,31 @@ runCommand "firmware-xz"
inherit (compressor) nativeBuildInputs;
}
(
lib.concatLines (
map (firmware: ''
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 '${compressor.cmd "${firmware}/$1" "$1.${compressor.ext}"}' --)
(cd ${firmware} && find lib/firmware -type l) | while read link; do
target="$(readlink "${firmware}/$link")"
if [ -f "${firmware}/$link" ]; then
cp -vL -- "''${target/^${firmware}/$out}.${compressor.ext}" "$out/$link.${compressor.ext}"
else
echo HI
cp -vrL -- "''${target/^${firmware}/$out}" "$out/$link"
fi
done
''
mkdir -p $out/lib/firmware
''
lib.concatLines
(
map (firmware: ''
(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 '${compressor.cmd "${firmware}/$1" "$1.${compressor.ext}"}' --)
(cd ${firmware} && find lib/firmware -type l) | while read link; do
target="$(readlink "${firmware}/$link")"
if [ -f "${firmware}/$link" ]; then
cp -vL -- "''${target/^${firmware}/$out}.${compressor.ext}" "$out/$link.${compressor.ext}"
else
echo HI
cp -vrL -- "''${target/^${firmware}/$out}" "$out/$link"
fi
done
find $out
find $out
echo "Checking for broken symlinks:"
find -L $out -type l -print -execdir false -- '{}' '+'
'') firmwares
)
echo "Checking for broken symlinks:"
find -L $out -type l -print -execdir false -- '{}' '+'
'') firmwares
)
)

0 comments on commit a694f89

Please sign in to comment.