From cd53a63c4fa348fe54827789f883f71b923f83d9 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Sat, 24 Feb 2024 17:35:17 -0600 Subject: [PATCH 1/3] nix: s/rust-version/ourRustVersion/g This naming is just more consistent with the surrounding code. Signed-off-by: Austin Seipp --- flake.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index cdbf1e785b..9a1caa8ee6 100644 --- a/flake.nix +++ b/flake.nix @@ -35,11 +35,11 @@ pkgs.lib.all (re: builtins.match re relPath == null) regexes; }; - rust-version = pkgs.rust-bin.stable."1.76.0".default; + ourRustVersion = pkgs.rust-bin.stable."1.76.0".default; ourRustPlatform = pkgs.makeRustPlatform { - rustc = rust-version; - cargo = rust-version; + rustc = ourRustVersion; + cargo = ourRustVersion; }; # these are needed in both devShell and buildInputs @@ -137,14 +137,14 @@ devShells.default = pkgs.mkShell { buildInputs = with pkgs; [ # The CI checks against the latest nightly rustfmt, so we should too. - # NOTE (aseipp): include this FIRST before the rust-version override - # below; otherwise, it will be overridden by the rust-version and + # NOTE (aseipp): include this FIRST before the ourRustVersion override + # below; otherwise, it will be overridden by the ourRustVersion and # we'll get stable rustfmt instead. (rust-bin.selectLatestNightlyWith (toolchain: toolchain.rustfmt)) # Using the minimal profile with explicit "clippy" extension to avoid # two versions of rustfmt - (rust-version.override { + (ourRustVersion.override { extensions = [ "rust-src" # for rust-analyzer "clippy" From 84b6ce53ba06f522db00f947fec62c018c54b7de Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Sat, 24 Feb 2024 17:41:50 -0600 Subject: [PATCH 2/3] nix: fix nix-on-macOS build When the `jj-proc-macros` crate was introduced, it triggered an underlying bug in `nextest`, which is the test harness we use in the Nix build. This is upstream Nextest bug 267. The long and short of it is that `rustc` fails to find needed libraries whenever the proc macros are loaded. This can easily be worked around however, by setting `DYLD_FALLBACK_LIBRARY_PATH` to an appropriate value in the devShell and in the `preCheck` phase of the main expression. Signed-off-by: Austin Seipp --- flake.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 9a1caa8ee6..5a0544268f 100644 --- a/flake.nix +++ b/flake.nix @@ -49,6 +49,12 @@ libiconv ]; + # work around https://github.com/nextest-rs/nextest/issues/267 + # this needs to exist in both the devShell and preCheck phase! + darwinNextestHack = pkgs.lib.optionalString pkgs.stdenv.isDarwin '' + export DYLD_FALLBACK_LIBRARY_PATH=$(${ourRustVersion}/bin/rustc --print sysroot)/lib + ''; + # NOTE (aseipp): on Linux, go ahead and use mold by default to improve # link times a bit; mostly useful for debug build speed, but will help # over time if we ever get more dependencies, too @@ -97,7 +103,10 @@ NIX_JJ_GIT_HASH = self.rev or ""; CARGO_INCREMENTAL = "0"; - preCheck = "export RUST_BACKTRACE=1"; + preCheck = '' + export RUST_BACKTRACE=1 + '' + darwinNextestHack; + postInstall = '' $out/bin/jj util mangen > ./jj.1 installManPage ./jj.1 @@ -181,7 +190,7 @@ export LIBSSH2_SYS_USE_PKG_CONFIG=1 '' + pkgs.lib.optionalString useMoldLinker '' export RUSTFLAGS="-C link-arg=-fuse-ld=mold" - ''; + '' + darwinNextestHack; }; })); } From a4321d80f6ab5d0a00152e7273ca7239934c1fc1 Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Sat, 24 Feb 2024 17:55:58 -0600 Subject: [PATCH 3/3] github: add nix-on-macOS to the CI matrix The aarch64-darwin macOS runners are actually quite speedy, often the fastest builders anyway. With the recent improvements to the Nix CI speed in 3f7b5a75e, this shouldn't be a bottleneck, and will catch build regressions. --- .github/workflows/{nix-linux.yml => build-nix.yml} | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) rename .github/workflows/{nix-linux.yml => build-nix.yml} (78%) diff --git a/.github/workflows/nix-linux.yml b/.github/workflows/build-nix.yml similarity index 78% rename from .github/workflows/nix-linux.yml rename to .github/workflows/build-nix.yml index 288ef4be22..2b805b86ad 100644 --- a/.github/workflows/nix-linux.yml +++ b/.github/workflows/build-nix.yml @@ -1,4 +1,4 @@ -name: Nix on Linux +name: nix on: push: @@ -10,9 +10,14 @@ permissions: read-all jobs: nix: - runs-on: ubuntu-latest - name: nix-build + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-14] + runs-on: ${{ matrix.os }} timeout-minutes: 15 # NOTE (aseipp): keep in-sync with the build.yml timeout limit + + name: flake check steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: