Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made nix flake work for darwin #2902

Merged
merged 6 commits into from
May 23, 2022
Merged

made nix flake work for darwin #2902

merged 6 commits into from
May 23, 2022

Conversation

Anton-4
Copy link
Collaborator

@Anton-4 Anton-4 commented Apr 20, 2022

No description provided.

@Anton-4 Anton-4 added the nix label Apr 20, 2022
@Anton-4 Anton-4 changed the title made nix flake work for darwin-aarch64(M1) WIP made nix flake work for darwin Apr 21, 2022
@Anton-4
Copy link
Collaborator Author

Anton-4 commented Apr 21, 2022

Closes #2734

flake.nix Outdated
@@ -4,67 +4,83 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
# zig = { url = "github:roarkanize/zig-overlay"; };
zig = { url = "github:roarkanize/zig-overlay"; };
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zig in pkgs is broken for M1 macs.

flake.nix Outdated
@@ -4,67 +4,83 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
# zig = { url = "github:roarkanize/zig-overlay"; };
zig = { url = "github:roarkanize/zig-overlay"; };
flake-utils.url = "github:numtide/flake-utils";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flake-utils is used to support all "default systems" aarch64 darwin, x86 darwin, aarch64 linux...

@Anton-4 Anton-4 changed the title WIP made nix flake work for darwin made nix flake work for darwin Apr 23, 2022
bhansconnect
bhansconnect previously approved these changes May 12, 2022
Copy link
Contributor

@bhansconnect bhansconnect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. General question. Should we deprecate shell.nix and force everyone to use flakes just to keep things simple? That way we don't have to deal with versioning twice.

Theoretically we can change shell.nix to this: target/lorri#460 (comment)

flake.nix Outdated Show resolved Hide resolved
@Anton-4
Copy link
Collaborator Author

Anton-4 commented May 13, 2022

Sounds good 👍 I'd like to do that in a follow-up PR to keep them "atomic" if that's alright?

@Anton-4 Anton-4 requested a review from bhansconnect May 13, 2022 11:15
@Anton-4 Anton-4 requested a review from rtfeldman May 23, 2022 09:36
Copy link
Contributor

@rtfeldman rtfeldman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well for me on M1! 🎉

@Anton-4 Anton-4 merged commit 3caa39f into trunk May 23, 2022
@Anton-4 Anton-4 deleted the nix_flake_M1 branch May 23, 2022 12:47
@dvic
Copy link

dvic commented Jan 25, 2023

Does this still work? I just tried nix shell github:roc-lang/roc/ac45fa2bba87f46a30394293dcd13556f7cdebf4

and got

❯ nix shell github:roc-lang/roc/ac45fa2bba87f46a30394293dcd13556f7cdebf4
error: builder for '/nix/store/h9z2plxdnzig87zkm14v2qc2vkqwgw80-zig-0.9.1.drv' failed with exit code 134;
       last 10 log lines:
       > [ 98%] Built target zig0
       > [ 99%] Building self-hosted component /tmp/nix-build-zig-0.9.1.drv-0/source/build/zig1.o
       > [ 99%] Building CXX object CMakeFiles/zig.dir/src/stage1/empty.cpp.o
       > [100%] Linking CXX executable zig
       > [100%] Built target zig
       > buildPhase completed in 1 minutes 42 seconds
       > running tests
       > thread 175698 panic: Darwin is handled separately via std.zig.system.darwin module
       > Unable to dump stack trace: debug info stripped
       > /nix/store/gn9v8p0m68wj3ss5lyz1pq8s568l8w4a-stdenv-darwin/setup: line 1407: 44423 Abort trap: 6           ./zig test --cache-dir "$TMPDIR" -I $src/test $src/test/behavior.zig
       For full logs, run 'nix log /nix/store/h9z2plxdnzig87zkm14v2qc2vkqwgw80-zig-0.9.1.drv'.
error: 1 dependencies of derivation '/nix/store/g9dk4hqv9d4z4vcpxsd26wdgc1s2lswp-roc-0.0.1.drv' failed to build

@Anton-4
Copy link
Collaborator Author

Anton-4 commented Jan 25, 2023

Hi @dvic, it looks like you're encountering this zig issue because you are on macos 13. You should be able to use the macos nightly as long as you're not building custom zig platforms or using wasm.

@Anton-4
Copy link
Collaborator Author

Anton-4 commented Jan 25, 2023

The latest macos nightlies are broken so you'll want to use the 01-17. I'm working on fixing them now.

@dvic
Copy link

dvic commented Jan 25, 2023

Hi @dvic, it looks like you're encountering this ziglang/zig#10478 because you are on macos 13.

The latest macos nightlies are broken so you'll want to use the 01-17. I'm working on fixing them now.

nice 👍, thanks for the prompt response!

Running nix shell github:roc-lang/roc/7b8783ae0d4c2a51b3b53535a4c9683f2f6ca0f3 (latest commit of 01-17) gives the same error.

You should be able to use the macos nightly as long as you're not building custom zig platforms or using wasm.

Did you mean that I have to change something in the nix config file? Or that I have to wait for a fix in zig itself?

@Anton-4
Copy link
Collaborator Author

Anton-4 commented Jan 25, 2023

Apolagies, for the 01-17 nightly I did not mean the commit but meant from the prebuilt tar.gz here.

To be able to build from source again on macos 13, we are waiting on zig 10 to be available on nix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants