linux-firmware: 20220815 -> 20220913, add overengineered update script

This commit is contained in:
K900 2022-09-18 19:37:06 +03:00
parent 4f9f63fb88
commit ee024891bd
3 changed files with 50 additions and 4 deletions

View file

@ -1,12 +1,18 @@
{ stdenvNoCC, fetchzip, lib }: let
source = import ./source.nix;
in {
stdenvNoCC,
fetchzip,
lib,
}:
stdenvNoCC.mkDerivation rec { stdenvNoCC.mkDerivation rec {
pname = "linux-firmware"; pname = "linux-firmware";
version = "20220815"; version = source.version;
src = fetchzip { src = fetchzip {
url = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-${version}.tar.gz"; url = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-${version}.tar.gz";
sha256 = "sha256-StPlnwn4KOvOf4fRblDzJQqyI8iIz8e9fo/BsTyCKjI="; hash = source.sourceHash;
}; };
installFlags = [ "DESTDIR=$(out)" ]; installFlags = [ "DESTDIR=$(out)" ];
@ -16,7 +22,7 @@ stdenvNoCC.mkDerivation rec {
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHashAlgo = "sha256"; outputHashAlgo = "sha256";
outputHash = "sha256-VTRrOOkdWepUCKAkziO/0egb3oaQEOJCtsuDEgs/W78="; outputHash = source.outputHash;
meta = with lib; { meta = with lib; {
description = "Binary firmware collection packaged by kernel.org"; description = "Binary firmware collection packaged by kernel.org";

View file

@ -0,0 +1,6 @@
# This file is autogenerated! Run ./update.sh to regenerate.
{
version = "20220913";
sourceHash = "sha256-qxSgkytJBW9ux95tEOHfz/4pvOp5TII3ICAY7dg5UC8=";
outputHash = "sha256-eVDXNyx9gwa46pBmsoTU9bQ2XBzkjVocIHydieJ9ruU=";
}

View file

@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$(readlink -f "$0")")" || exit
# step 1: figure out the latest version from the tags
repo="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"
latestTag="$(git ls-remote --refs --tags --sort refname "$repo" | tail -n1 | cut -f2 | cut -d '/' -f3)"
# step 2: prefetch the source tarball
snapshotUrl="$repo/snapshot/linux-firmware-$latestTag.tar.gz"
hash="$(nix-prefetch-url --unpack "$snapshotUrl")"
sriHash="$(nix --experimental-features nix-command hash to-sri "sha256:$hash")"
# step 3: rebuild as a non-FO derivation to get the right hash
cat > source.nix << EOF
{
version = "$latestTag";
sourceHash = "$sriHash";
outputHash = null;
}
EOF
outPath="$(nix --experimental-features "nix-command flakes" build ".#linux-firmware" --no-link --print-out-paths)"
outHash="$(nix --experimental-features nix-command hash path "$outPath")"
# step 4: generate the final file
cat > source.nix << EOF
# This file is autogenerated! Run ./update.sh to regenerate.
{
version = "$latestTag";
sourceHash = "$sriHash";
outputHash = "$outHash";
}
EOF