Skip to content

fix(nix): make flake.nix work on macOS#29

Open
XerWandeRer wants to merge 1 commit intoWenSimEHRP:mainfrom
XerWandeRer:fix/flake-macos-compat
Open

fix(nix): make flake.nix work on macOS#29
XerWandeRer wants to merge 1 commit intoWenSimEHRP:mainfrom
XerWandeRer:fix/flake-macos-compat

Conversation

@XerWandeRer
Copy link

Summary

nix develop 在 macOS 上会失败,因为 runtimeLibs 无条件引入了 Linux-only 的依赖(vulkan-loader、wayland、libudev-zero 等),导致 nix 拒绝 evaluate。

本 PR 用 isLinux 条件守卫将 Linux-only 的部分隔离:

  • runtimeLibs 整体用 pkgs.lib.optionals isLinux 包裹
  • moldclangstdenv.cc.cc 仅在 Linux 下加入 buildInputs
  • LD_LIBRARY_PATH 仅在 Linux 下设置
  • x86_64-unknown-linux-gnu rust target 仅在 Linux 下添加

macOS 用户现在可以直接 nix develop 进入开发环境。Linux 行为不变。

Guard Linux-only dependencies (Vulkan, X11, Wayland, mold, libudev,
LD_LIBRARY_PATH) behind `isLinux` checks so `nix develop` works on
macOS without `allowUnsupportedSystem`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@WenSimEHRP
Copy link
Owner

Does it work on your machine?

@XerWandeRer
Copy link
Author

Yes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants