mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-11 10:55:31 +03:00
resurrecting previous nix changes
This commit is contained in:
parent
2d616d1fe9
commit
03c517dcfc
22
default.nix
22
default.nix
@ -10,11 +10,27 @@
|
||||
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
|
||||
rustPlatform.buildRustPackage {
|
||||
|
||||
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;
|
||||
@ -97,4 +113,4 @@ rustPlatform.buildRustPackage {
|
||||
pkgs.lib.makeBinPath [ pkgs.stdenv.cc ]
|
||||
}
|
||||
'';
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user