diff options
author | Florian Klink <flokli@flokli.de> | 2024-07-07 19:08:29 +0300 |
---|---|---|
committer | Florian Klink <flokli@flokli.de> | 2024-07-07 19:16:43 +0300 |
commit | 6f2d668db6157ec8de08a4fad3d6af98eeaa8e57 (patch) | |
tree | 49d57a5775656e684fa8b0ea74c22c6e14e872a6 /pkgs/os-specific | |
parent | ab82a9612aa45284d4adf69ee81871a389669a9e (diff) |
linux-firmware: remove FOD
This being a FOD seems to only have historical reasons. Remove the source.nix file, as well as the custom update script, and FOD. Simply making this a normal input-addressed derivation, with a version being interpolated makes this easy to update with update-source-version.
Diffstat (limited to 'pkgs/os-specific')
3 files changed, 14 insertions, 66 deletions
diff --git a/pkgs/os-specific/linux/firmware/linux-firmware/default.nix b/pkgs/os-specific/linux/firmware/linux-firmware/default.nix index ae04c6a9ce32a..33a1fe6e1ed73 100644 --- a/pkgs/os-specific/linux/firmware/linux-firmware/default.nix +++ b/pkgs/os-specific/linux/firmware/linux-firmware/default.nix @@ -1,20 +1,17 @@ -let - source = import ./source.nix; -in { - stdenvNoCC, - fetchzip, - lib, - rdfind, - which, +{ stdenvNoCC +, fetchzip +, lib +, rdfind +, which }: stdenvNoCC.mkDerivation rec { pname = "linux-firmware"; - version = source.version; + version = "20240610"; src = fetchzip { - url = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-${source.revision}.tar.gz"; - hash = source.sourceHash; + url = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-${version}.tar.gz"; + hash = "sha256-tjDqviOMvrBoEG8+Yn+XqdBlIDfQUX0KK2kpW6/jed8="; }; nativeBuildInputs = [ @@ -27,10 +24,6 @@ stdenvNoCC.mkDerivation rec { # Firmware blobs do not need fixing and should not be modified dontFixup = true; - outputHashMode = "recursive"; - outputHashAlgo = "sha256"; - outputHash = source.outputHash; - meta = with lib; { description = "Binary firmware collection packaged by kernel.org"; homepage = "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"; @@ -39,6 +32,5 @@ stdenvNoCC.mkDerivation rec { maintainers = with maintainers; [ fpletz ]; priority = 6; # give precedence to kernel firmware }; - passthru.updateScript = ./update.sh; } diff --git a/pkgs/os-specific/linux/firmware/linux-firmware/source.nix b/pkgs/os-specific/linux/firmware/linux-firmware/source.nix deleted file mode 100644 index adaa4968fd565..0000000000000 --- a/pkgs/os-specific/linux/firmware/linux-firmware/source.nix +++ /dev/null @@ -1,7 +0,0 @@ -# This file is autogenerated! Run ./update.sh to regenerate. -{ - version = "20240610"; - revision = "20240610"; - sourceHash = "sha256-tjDqviOMvrBoEG8+Yn+XqdBlIDfQUX0KK2kpW6/jed8="; - outputHash = "sha256-2VxzN778TLov5N1DPSnnkT7wQnLg85PyKsljZOoSoNM="; -} diff --git a/pkgs/os-specific/linux/firmware/linux-firmware/update.sh b/pkgs/os-specific/linux/firmware/linux-firmware/update.sh index 4b28d6e1374f4..7886e93571ab4 100755 --- a/pkgs/os-specific/linux/firmware/linux-firmware/update.sh +++ b/pkgs/os-specific/linux/firmware/linux-firmware/update.sh @@ -1,47 +1,10 @@ -#!/usr/bin/env bash -set -euo pipefail -cd "$(dirname "$(readlink -f "$0")")" || exit +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p git -p common-updater-scripts -repo="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git" - -# step 1: figure out the latest version from the tags -if [ -z "${1:-}" ]; then - revision="$(git ls-remote --refs --tags --sort refname "$repo" | tail -n1 | cut -f2 | cut -d '/' -f3)" - version=$revision -else - revision=$1 - if [ -z "${2:-}" ]; then - version="unstable-$(date "+%Y-%m-%d")" - else - version=$2 - fi -fi +set -eu -o pipefail -# step 2: prefetch the source tarball -snapshotUrl="$repo/snapshot/linux-firmware-$revision.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 = "$version"; - revision = "$revision"; - sourceHash = "$sriHash"; - outputHash = null; -} -EOF +repo="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git" -outPath="$(nix --experimental-features "nix-command flakes" build ".#linux-firmware" --no-link --print-out-paths)" -outHash="$(nix --experimental-features nix-command hash path "$outPath")" +revision="$(git ls-remote --refs --tags --sort refname "$repo" | tail -n1 | cut -f2 | cut -d '/' -f3)" -# step 4: generate the final file -cat > source.nix << EOF -# This file is autogenerated! Run ./update.sh to regenerate. -{ - version = "$version"; - revision = "$revision"; - sourceHash = "$sriHash"; - outputHash = "$outHash"; -} -EOF +update-source-version linux-firmware "$revision" |