linux-firmware: 20220815 -> 20220913, add overengineered update script
This commit is contained in:
parent
4f9f63fb88
commit
ee024891bd
3 changed files with 50 additions and 4 deletions
|
@ -1,12 +1,18 @@
|
|||
{ stdenvNoCC, fetchzip, lib }:
|
||||
let
|
||||
source = import ./source.nix;
|
||||
in {
|
||||
stdenvNoCC,
|
||||
fetchzip,
|
||||
lib,
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "linux-firmware";
|
||||
version = "20220815";
|
||||
version = source.version;
|
||||
|
||||
src = fetchzip {
|
||||
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)" ];
|
||||
|
@ -16,7 +22,7 @@ stdenvNoCC.mkDerivation rec {
|
|||
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
outputHash = "sha256-VTRrOOkdWepUCKAkziO/0egb3oaQEOJCtsuDEgs/W78=";
|
||||
outputHash = source.outputHash;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Binary firmware collection packaged by kernel.org";
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# This file is autogenerated! Run ./update.sh to regenerate.
|
||||
{
|
||||
version = "20220913";
|
||||
sourceHash = "sha256-qxSgkytJBW9ux95tEOHfz/4pvOp5TII3ICAY7dg5UC8=";
|
||||
outputHash = "sha256-eVDXNyx9gwa46pBmsoTU9bQ2XBzkjVocIHydieJ9ruU=";
|
||||
}
|
34
pkgs/os-specific/linux/firmware/linux-firmware/update.sh
Executable file
34
pkgs/os-specific/linux/firmware/linux-firmware/update.sh
Executable 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
|
Loading…
Reference in a new issue