resurrecting previous nix changes

This commit is contained in:
Anton-4 2023-07-10 18:46:41 +02:00
parent 2d616d1fe9
commit 03c517dcfc
No known key found for this signature in database
GPG Key ID: 0971D718C0A9B937
2 changed files with 93 additions and 77 deletions

View File

@ -10,10 +10,26 @@
let
rustPlatform = pkgs.rustPlatform;
desiredRustVersion = (builtins.fromTOML (builtins.readFile (./rust-toolchain.toml))).toolchain.channel;
actualRustVersion = rustPlatform.rust.rustc;
rustVersionsMatch = pkgs.lib.strings.hasSuffix desiredRustVersion actualRustVersion;
llvmPkgs = pkgs.llvmPackages_13;
# nix does not store libs in /usr/lib or /lib
nixGlibcPath = if pkgs.stdenv.isLinux then "${pkgs.glibc.out}/lib" else "";
in
assert pkgs.lib.assertMsg rustVersionsMatch ''
The rust version changed in rust-toolchain.toml but the rev(commit) in nixpkgs.url in flake.nix was not updated.
1. clone the nixpkgs repo: `git clone --depth 60000 git@github.com:NixOS/nixpkgs.git`
2. `cd nixpkgs`
3. `git log --oneline | rg -A 1 "rustc: <RUST_VERSION_IN_RUST_TOOLCHAIN_TOML>"`
4. Copy the short SHA from the line **after** the commit with the message of for example `rustc: 1.67.1 -> 1.68.0`
5. Find the long SHA by executing `git rev-parse <PASTE>`
6. Copy the long SHA
7. Paste it in place of the old SHA(rev) in flake.nix:inputs:nixpkgs.url
'';
rustPlatform.buildRustPackage {
pname = "roc";
version = "0.0.1";
@ -51,7 +67,7 @@ rustPlatform.buildRustPackage {
python3
llvmPkgs.clang
llvmPkgs.llvm.dev
zig
zig_0_9
]);
buildInputs = (with pkgs;

View File

@ -2,7 +2,7 @@
description = "Roc flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?rev=9f4346eac544cc0db5eb7d889e71eac0f9c8b9eb";
nixpkgs.url = "github:nixos/nixpkgs?rev=d7887373fe0731719365831cd254c1e5948307d3";
# rust from nixpkgs has some libc problems, this is patched in the rust-overlay
rust-overlay = {
@ -90,7 +90,7 @@
llvmPkgs.clang
libxkbcommon
pkg-config
zig # roc builtins are implemented in zig, see compiler/builtins/bitcode/
zig_0_9 # roc builtins are implemented in zig, see compiler/builtins/bitcode/
# lib deps
libffi