especially for macOS

sat-benchのバージョン上げる際にRust 1.41での新しい構文を使ったせいでrustc-1.41が必須になってしまった。 そんなことは全然問題ないかと思ったらnixpkgsでの標準のRustPlatformの使用バージョンが1.37だったのでま ずrustc-1.41を指定することが必要になった。ところがrustc-1.41がコンパイルできない。 llvmのリンカがAMDGPUなんたらが見つからないというエラーが出る。時間を作って調べてみた。

結論から言うと、

  1. nixpkgsをcloneして適当な新しめのブランチ(例えばnixpkgs-unstable)をcheckout。
  2. top directoryで nix-build -A rustc-1.41 を実行すると問題なく生成できる
  3. なので pkgs/development/compilers/rust/1_41_0.nixrustcVersionを"1.41.1"に変更(rustcSha256は変更してないのだが。。。)してbuildする
  4. 生成できたら同じディレクトリでnix-build -A sat-bench
  5. 生成できたら nix-env -i path-to-the-derivationを実行してインストール

これでOK。これまでNIXPKGS環境変数とかで指定したつもりだったのだがnix-buildの利用が正解だったようだ。

参考

2020-03-19: スナップショット

Rust-1.42にバージョンアップ。

diff --git a/pkgs/development/compilers/rust/1_41_0.nix b/pkgs/development/compilers/rust/1_41_0.nix
deleted file mode 100644
index b73d9b8ef26..00000000000
--- a/pkgs/development/compilers/rust/1_41_0.nix
+++ /dev/null
@@ -1,48 +0,0 @@
-# New rust versions should first go to staging.
-# Things to check after updating:
-# 1. Rustc should produce rust binaries on x86_64-linux, aarch64-linux and x86_64-darwin:
-#    i.e. nix-shell -p fd or @GrahamcOfBorg build fd on github
-#    This testing can be also done by other volunteers as part of the pull
-#    request review, in case platforms cannot be covered.
-# 2. The LLVM version used for building should match with rust upstream.
-# 3. Firefox and Thunderbird should still build on x86_64-linux.
-
-{ stdenv, lib
-, buildPackages
-, newScope, callPackage
-, CoreFoundation, Security
-, llvmPackages_5
-, pkgsBuildTarget, pkgsBuildBuild
-, fetchpatch
-} @ args:
-
-import ./default.nix {
-  rustcVersion = "1.41.0";
-  rustcSha256 = "0jypz2mrzac41sj0zh07yd1z36g2s2rvgsb8g624sk4l14n84ijm";
-
-  # Note: the version MUST be one version prior to the version we're
-  # building
-  bootstrapVersion = "1.40.0";
-
-  # fetch hashes by running `print-hashes.sh 1.40.0`
-  bootstrapHashes = {
-    i686-unknown-linux-gnu = "d050d3a1c7c45ba9c50817d45bf6d7dd06e1a4d934f633c8096b7db6ae27adc1";
-    x86_64-unknown-linux-gnu = "fc91f8b4bd18314e83a617f2389189fc7959146b7177b773370d62592d4b07d0";
-    arm-unknown-linux-gnueabihf = "4be9949c4d3c572b69b1df61c3506a3a3ac044851f025d38599612e7caa933c5";
-    armv7-unknown-linux-gnueabihf = "ebfe3978e12ffe34276272ee6d0703786249a9be80ca50617709cbfdab557306";
-    aarch64-unknown-linux-gnu = "639271f59766d291ebdade6050e7d05d61cb5c822a3ef9a1e2ab185fed68d729";
-    i686-apple-darwin = "ea189b1fb0bfda367cde6d43c18863ab4c64ffca04265e5746bf412a186fe1a2";
-    x86_64-apple-darwin = "749ca5e0b94550369cc998416b8854c13157f5d11d35e9b3276064b6766bcb83";
-  };
-
-  selectRustPackage = pkgs: pkgs.rust_1_41_0;
-
-  rustcPatches = [
-    (fetchpatch {
-      url = "https://github.com/QuiltOS/rust/commit/f1803452b9e95bfdbc3b8763138b9f92c7d12b46.diff";
-      sha256 = "1mzxaj46bq7ll617wg0mqnbnwr1da3hd4pbap8bjwhs3kfqnr7kk";
-    })
-  ];
-}
-
-(builtins.removeAttrs args [ "fetchpatch" ])
diff --git a/pkgs/development/compilers/rust/1_42_0.nix b/pkgs/development/compilers/rust/1_42_0.nix
new file mode 100644
index 00000000000..fd2eaa79868
--- /dev/null
+++ b/pkgs/development/compilers/rust/1_42_0.nix
@@ -0,0 +1,48 @@
+# New rust versions should first go to staging.
+# Things to check after updating:
+# 1. Rustc should produce rust binaries on x86_64-linux, aarch64-linux and x86_64-darwin:
+#    i.e. nix-shell -p fd or @GrahamcOfBorg build fd on github
+#    This testing can be also done by other volunteers as part of the pull
+#    request review, in case platforms cannot be covered.
+# 2. The LLVM version used for building should match with rust upstream.
+# 3. Firefox and Thunderbird should still build on x86_64-linux.
+
+{ stdenv, lib
+, buildPackages
+, newScope, callPackage
+, CoreFoundation, Security
+, llvmPackages_5
+, pkgsBuildTarget, pkgsBuildBuild
+, fetchpatch
+} @ args:
+
+import ./default.nix {
+  rustcVersion = "1.42.0";
+  rustcSha256 = "0x9lxs82may6c0iln0b908cxyn1cv7h03n5cmbx3j1bas4qzks6j";
+
+  # Note: the version MUST be one version prior to the version we're
+  # building
+  bootstrapVersion = "1.41.1";
+
+  # fetch hashes by running `print-hashes.sh 1.41.1`
+  bootstrapHashes = {
+    i686-unknown-linux-gnu = "085c8880ee635c2182504a1f2aaa2865455f9ff43511b3976a2140a8bfcce6f3";
+    x86_64-unknown-linux-gnu = "a6d5a3b3f574aafc8f787fea37aad9fb8a7946b383ae5348146927192ff0bef0";
+    arm-unknown-linux-gnueabihf = "210090e13970646707325fc0270ef368cde3e2a4a7671f2cf374f57fcc8e3770";
+    armv7-unknown-linux-gnueabihf = "531e4006fee503ba1581c3feca2932f99d0df97bc2361e33fa028e3d7060ccc1";
+    aarch64-unknown-linux-gnu = "d54c0f9165b86216b6f1b499f451141407939c5dc6b36c89a3772895a1370242";
+    i686-apple-darwin = "727cbbfa58a2698d577c99f2a221512bff6ba07ca98ec47cf7ec5043eca60c81";
+    x86_64-apple-darwin = "16615288cf74239783de1b435d329f3d56ed13803c7c10cd4b207d7c8ffa8f67";
+  };
+
+  selectRustPackage = pkgs: pkgs.rust_1_42_0;
+
+#  rustcPatches = [
+#    (fetchpatch {
+#      url = "https://github.com/QuiltOS/rust/commit/f1803452b9e95bfdbc3b8763138b9f92c7d12b46.diff";
+#      sha256 = "1mzxaj46bq7ll617wg0mqnbnwr1da3hd4pbap8bjwhs3kfqnr7kk";
+#    })
+#  ];
+}
+
+(builtins.removeAttrs args [ "fetchpatch" ])
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 60da1eeaf5b..2d435f022e4 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -8846,13 +8846,13 @@ in
     inherit (darwin) apple_sdk;
   };
 
-  rust_1_41_0 = callPackage ../development/compilers/rust/1_41_0.nix {
+  rust_1_42_0 = callPackage ../development/compilers/rust/1_42_0.nix {
     inherit (darwin.apple_sdk.frameworks) CoreFoundation Security;
   };
-  rust = rust_1_41_0;
+  rust = rust_1_42_0;
 
-  rustPackages_1_41_0 = rust_1_41_0.packages.stable;
-  rustPackages = rustPackages_1_41_0;
+  rustPackages_1_42_0 = rust_1_42_0.packages.stable;
+  rustPackages = rustPackages_1_42_0;
 
   inherit (rustPackages) cargo clippy rustc rustPlatform;
   inherit (rust) makeRustPlatform;
@@ -21946,6 +21946,7 @@ in
 
   thunderbird = callPackage ../applications/networking/mailreaders/thunderbird {
     inherit (gnome2) libIDL;
+    inherit (rustPackages_1_42_0) cargo rustc;
     libpng = libpng_apng;
     gtk3Support = true;
   };