From 0d7dc0efc540648d7052b4e7cbb0b14c454e7206 Mon Sep 17 00:00:00 2001 From: annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com> Date: Fri, 5 Apr 2024 02:30:31 +0000 Subject: [PATCH] treewide: throw on unsupported system src access --- pkgs/applications/audio/renoise/default.nix | 2 +- pkgs/applications/gis/udig/default.nix | 2 +- pkgs/applications/graphics/sane/backends/brscan4/default.nix | 2 +- pkgs/applications/misc/1password-gui/default.nix | 2 +- pkgs/applications/networking/cluster/hadoop/default.nix | 2 +- .../networking/instant-messengers/discord/default.nix | 2 +- pkgs/applications/science/electronics/picoscope/default.nix | 2 +- .../version-management/radicle-upstream/default.nix | 2 +- pkgs/applications/virtualization/firecracker/default.nix | 2 +- pkgs/development/compilers/oraclejdk/jdk-linux-base.nix | 2 +- pkgs/development/compilers/temurin-bin/jdk-darwin-base.nix | 2 +- pkgs/development/libraries/libcef/default.nix | 2 +- pkgs/servers/meteor/default.nix | 2 +- pkgs/tools/archivers/rar/default.nix | 2 +- pkgs/tools/misc/geekbench/5.nix | 2 +- pkgs/tools/misc/geekbench/6.nix | 2 +- pkgs/tools/misc/hakuneko/default.nix | 2 +- pkgs/tools/security/sonar-scanner-cli/default.nix | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pkgs/applications/audio/renoise/default.nix b/pkgs/applications/audio/renoise/default.nix index d3462ecc6ad5..a56d43876fb0 100644 --- a/pkgs/applications/audio/renoise/default.nix +++ b/pkgs/applications/audio/renoise/default.nix @@ -39,7 +39,7 @@ in stdenv.mkDerivation rec { releasePath else let - platform = platforms.${stdenv.system}; + platform = platforms.${stdenv.system} or (throw "unsupported system ${stdenv.hostPlatform.system}"); urlVersion = lib.replaceStrings [ "." ] [ "_" ] version; in fetchurl { url = diff --git a/pkgs/applications/gis/udig/default.nix b/pkgs/applications/gis/udig/default.nix index 8510918d4cab..264445336cd3 100644 --- a/pkgs/applications/gis/udig/default.nix +++ b/pkgs/applications/gis/udig/default.nix @@ -13,7 +13,7 @@ let hash = "sha256-Ihk3InHB3/tEYRqH2ozhokz2GN8Gfig5DJkO/8P1LJs="; }; }; - src = srcs.${stdenv.hostPlatform.system}; + src = srcs.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}"); meta = with lib; { description = "User-friendly Desktop Internet GIS"; diff --git a/pkgs/applications/graphics/sane/backends/brscan4/default.nix b/pkgs/applications/graphics/sane/backends/brscan4/default.nix index ec8efcc27c2a..c15b3033a265 100644 --- a/pkgs/applications/graphics/sane/backends/brscan4/default.nix +++ b/pkgs/applications/graphics/sane/backends/brscan4/default.nix @@ -21,7 +21,7 @@ stdenv.mkDerivation rec { url = "https://download.brother.com/welcome/dlf006645/${pname}-${version}.amd64.deb"; sha256 = "sha256-Gpr5456MCNpyam3g2qPo7S3aEZFMaUGR8bu7YmRY8xk="; }; - }."${stdenv.hostPlatform.system}"; + }."${stdenv.hostPlatform.system}" or (throw "unsupported system ${stdenv.hostPlatform.system}"); unpackPhase = '' ar x $src diff --git a/pkgs/applications/misc/1password-gui/default.nix b/pkgs/applications/misc/1password-gui/default.nix index 33a8328d688b..5f8b7c9068ac 100644 --- a/pkgs/applications/misc/1password-gui/default.nix +++ b/pkgs/applications/misc/1password-gui/default.nix @@ -51,7 +51,7 @@ let }; src = fetchurl { - inherit (sources.${channel}.${stdenv.system}) url hash; + inherit (sources.${channel}.${stdenv.system} or (throw "unsupported system ${stdenv.hostPlatform.system}")) url hash; }; meta = with lib; { diff --git a/pkgs/applications/networking/cluster/hadoop/default.nix b/pkgs/applications/networking/cluster/hadoop/default.nix index d5bae9ad885b..5f44e39d008c 100644 --- a/pkgs/applications/networking/cluster/hadoop/default.nix +++ b/pkgs/applications/networking/cluster/hadoop/default.nix @@ -35,7 +35,7 @@ let src = fetchurl { url = "mirror://apache/hadoop/common/hadoop-${finalAttrs.version}/hadoop-${finalAttrs.version}" + optionalString stdenv.isAarch64 "-aarch64" + ".tar.gz"; - inherit (platformAttrs.${stdenv.system}) hash; + inherit (platformAttrs.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}")) hash; }; doCheck = true; diff --git a/pkgs/applications/networking/instant-messengers/discord/default.nix b/pkgs/applications/networking/instant-messengers/discord/default.nix index 40e9c77e57a7..423f6cb2f1db 100644 --- a/pkgs/applications/networking/instant-messengers/discord/default.nix +++ b/pkgs/applications/networking/instant-messengers/discord/default.nix @@ -52,7 +52,7 @@ let }; aarch64-darwin = x86_64-darwin; }; - src = srcs.${stdenv.hostPlatform.system}.${branch}; + src = srcs.${stdenv.hostPlatform.system}.${branch} or (throw "${stdenv.hostPlatform.system} not supported on ${branch}"); meta = with lib; { description = "All-in-one cross-platform voice and text chat for gamers"; diff --git a/pkgs/applications/science/electronics/picoscope/default.nix b/pkgs/applications/science/electronics/picoscope/default.nix index c7242117b68c..3aa5cb22aa52 100644 --- a/pkgs/applications/science/electronics/picoscope/default.nix +++ b/pkgs/applications/science/electronics/picoscope/default.nix @@ -49,7 +49,7 @@ let # If we don't have a platform available, put a dummy version here, so at # least evaluation succeeds. sources = - (lib.importJSON ./sources.json).${stdenv.system} or { picoscope.version = "unknown"; }; + (lib.importJSON ./sources.json).${stdenv.system} or (throw "unsupported system ${stdenv.system}"); scopePkg = name: { url, version, sha256 }: diff --git a/pkgs/applications/version-management/radicle-upstream/default.nix b/pkgs/applications/version-management/radicle-upstream/default.nix index 97fec6257dd1..69c960ed78e8 100644 --- a/pkgs/applications/version-management/radicle-upstream/default.nix +++ b/pkgs/applications/version-management/radicle-upstream/default.nix @@ -15,7 +15,7 @@ let sha256 = "sha256-EuWGbn6qggi8/9Rci8iaXfuVKE+QXb1BHEYDvotR/q4="; }; }; - src = srcs.${stdenv.hostPlatform.system}; + src = srcs.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}"); contents = appimageTools.extract { inherit name src; }; diff --git a/pkgs/applications/virtualization/firecracker/default.nix b/pkgs/applications/virtualization/firecracker/default.nix index d9bab2169623..2c3ec6c9a75b 100644 --- a/pkgs/applications/virtualization/firecracker/default.nix +++ b/pkgs/applications/virtualization/firecracker/default.nix @@ -13,7 +13,7 @@ let dlbin = sha256: fetchurl { url = "${baseurl}/v${version}/firecracker-v${version}-${suffix}.tgz"; - sha256 = sha256."${stdenv.hostPlatform.system}"; + sha256 = sha256."${stdenv.hostPlatform.system}"or (throw "unsupported system ${stdenv.hostPlatform.system}"); }; in diff --git a/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix b/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix index 40681faae8ae..d03419e96570 100644 --- a/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix +++ b/pkgs/development/compilers/oraclejdk/jdk-linux-base.nix @@ -80,7 +80,7 @@ let result = stdenv.mkDerivation rec { in requireFile { name = "jdk-${productVersion}u${patchVersion}-${platformName}.tar.gz"; url = "http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html"; - sha256 = sha256.${stdenv.hostPlatform.system}; + sha256 = sha256.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}"); }; nativeBuildInputs = [ file makeWrapper ] diff --git a/pkgs/development/compilers/temurin-bin/jdk-darwin-base.nix b/pkgs/development/compilers/temurin-bin/jdk-darwin-base.nix index 14871813273d..8f6831a7907c 100644 --- a/pkgs/development/compilers/temurin-bin/jdk-darwin-base.nix +++ b/pkgs/development/compilers/temurin-bin/jdk-darwin-base.nix @@ -24,7 +24,7 @@ let sourcePerArch.${cpuName}.version or (throw "unsupported CPU ${cpuName}"); src = fetchurl { - inherit (sourcePerArch.${cpuName}) url sha256; + inherit (sourcePerArch.${cpuName} or (throw "unsupported system ${stdenv.hostPlatform.system}")) url sha256; }; # See: https://github.com/NixOS/patchelf/issues/10 diff --git a/pkgs/development/libraries/libcef/default.nix b/pkgs/development/libraries/libcef/default.nix index d6d098110af8..ce83c3c22cd4 100644 --- a/pkgs/development/libraries/libcef/default.nix +++ b/pkgs/development/libraries/libcef/default.nix @@ -73,7 +73,7 @@ let platforms."aarch64-linux".sha256 = "16sbfk599h96wcsmpbxlwsvq0n1pssmm8dpwmjsqfrn1464dvs68"; platforms."x86_64-linux".sha256 = "1wa4nv28saz96kar9svdarfz6c4rnbcqz0rqxzl9zclnhfzhqdiw"; - platformInfo = builtins.getAttr stdenv.hostPlatform.system platforms; + platformInfo = platforms.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}"); in stdenv.mkDerivation rec { pname = "cef-binary"; diff --git a/pkgs/servers/meteor/default.nix b/pkgs/servers/meteor/default.nix index 0ce2189568cb..7830d309b082 100644 --- a/pkgs/servers/meteor/default.nix +++ b/pkgs/servers/meteor/default.nix @@ -20,7 +20,7 @@ in stdenv.mkDerivation { inherit version; pname = "meteor"; - src = srcs.${system}; + src = srcs.${system} or (throw "unsupported system ${system}"); #dontStrip = true; diff --git a/pkgs/tools/archivers/rar/default.nix b/pkgs/tools/archivers/rar/default.nix index 3799afd736ef..fabcfde887e0 100644 --- a/pkgs/tools/archivers/rar/default.nix +++ b/pkgs/tools/archivers/rar/default.nix @@ -37,7 +37,7 @@ stdenv.mkDerivation { pname = "rar"; inherit version; - src = fetchurl (srcs.${stdenv.hostPlatform.system}); + src = fetchurl (srcs.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}")); dontBuild = true; diff --git a/pkgs/tools/misc/geekbench/5.nix b/pkgs/tools/misc/geekbench/5.nix index 7784b3632a73..49efe2ea0bf9 100644 --- a/pkgs/tools/misc/geekbench/5.nix +++ b/pkgs/tools/misc/geekbench/5.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation { inherit version; pname = "geekbench"; - src = fetchurl (sources.${stdenv.system}); + src = fetchurl (sources.${stdenv.system} or (throw "unsupported system ${stdenv.hostPlatform.system}")); dontConfigure = true; dontBuild = true; diff --git a/pkgs/tools/misc/geekbench/6.nix b/pkgs/tools/misc/geekbench/6.nix index 4ac5f1d0e49a..373d93dc193c 100644 --- a/pkgs/tools/misc/geekbench/6.nix +++ b/pkgs/tools/misc/geekbench/6.nix @@ -27,7 +27,7 @@ stdenv.mkDerivation { inherit version; pname = "geekbench"; - src = fetchurl (sources.${stdenv.system}); + src = fetchurl (sources.${stdenv.system} or (throw "unsupported system ${stdenv.hostPlatform.system}")); dontConfigure = true; dontBuild = true; diff --git a/pkgs/tools/misc/hakuneko/default.nix b/pkgs/tools/misc/hakuneko/default.nix index 0ad8c5907a70..0359da603ccb 100644 --- a/pkgs/tools/misc/hakuneko/default.nix +++ b/pkgs/tools/misc/hakuneko/default.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation rec { url = "https://github.com/manga-download/hakuneko/releases/download/v${version}/hakuneko-desktop_${version}_linux_i386.deb"; sha256 = "32017d26bafffaaf0a83dd6954d3926557014af4022a972371169c56c0e3d98b"; }; - }."${stdenv.hostPlatform.system}"; + }."${stdenv.hostPlatform.system}" or (throw "unsupported system ${stdenv.hostPlatform.system}"); dontBuild = true; dontConfigure = true; diff --git a/pkgs/tools/security/sonar-scanner-cli/default.nix b/pkgs/tools/security/sonar-scanner-cli/default.nix index 553019299ba7..b97a2bc3a105 100644 --- a/pkgs/tools/security/sonar-scanner-cli/default.nix +++ b/pkgs/tools/security/sonar-scanner-cli/default.nix @@ -19,7 +19,7 @@ in stdenv.mkDerivation rec { inherit version; pname = "sonar-scanner-cli"; - src = fetchurl sonarScannerArchPackage.${stdenv.hostPlatform.system}; + src = fetchurl sonarScannerArchPackage.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}"); nativeBuildInputs = [ unzip ];