1
0
forked from M-Labs/artiq

flake: fix rust overlay unpack

This commit is contained in:
2025-11-01 23:43:47 +08:00
parent 3b5934af5f
commit bcd56c5d58
2 changed files with 36 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
diff --git a/lib/rust-bin.nix b/lib/rust-bin.nix
index 1f5de03f..54ba8d29 100644
--- a/lib/rust-bin.nix
+++ b/lib/rust-bin.nix
@@ -132,9 +132,22 @@ let
url' = replaceStrings [" "] ["%20"] url; # This is required or download will fail.
# Filter names like `llvm-tools-1.34.2 (6c2484dc3 2019-05-13)-aarch64-unknown-linux-gnu.tar.xz`
matchParenPart = match ".*/([^ /]*) [(][^)]*[)](.*)" url;
- name = if matchParenPart == null then "" else (elemAt matchParenPart 0) + (elemAt matchParenPart 1);
in
- fetchurl { inherit name sha256; url = url'; };
+ # NB: This seems verbose, but we do not know the default special-cased `name` is.
+ # It used to be "", but changed to `null` later. We also do not know the exact
+ # revision of nixpkgs we are currently using.
+ # See: <http://github.com/NixOS/nixpkgs/commit/1ec0227cc062251c36140ef1e7c37b1cd1b370f1>
+ if matchParenPart != null then
+ fetchurl {
+ name = (elemAt matchParenPart 0) + (elemAt matchParenPart 1);
+ inherit sha256;
+ url = url';
+ }
+ else
+ fetchurl {
+ inherit sha256;
+ url = url';
+ };
# Resolve final components to install from mozilla-overlay style `extensions`, `targets` and `targetExtensions`.
#

View File

@@ -54,9 +54,15 @@
src-migen,
src-misoc,
}: let
pkgs' = import nixpkgs { system = "x86_64-linux"; };
rust-overlay-patched = pkgs'.applyPatches {
name = "rust-overlay-patched";
src = rust-overlay;
patches = [ ./fix-rust-overlay-unpack.diff ];
};
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [(import rust-overlay)];
overlays = [(import rust-overlay-patched)];
};
pkgs-aarch64 = import nixpkgs {system = "aarch64-linux";};