diff --git a/nix/shell.nix b/nix/shell.nix index b6f1efd366b32cdb246f3884856643977d1b3552..0c67ebbc3b7b676f8dd75b517f63c9cf2e78a1ff 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -1,6 +1,7 @@ { mkShell, makeFontsConf, + lib, zed-editor, @@ -11,6 +12,7 @@ nixfmt-rfc-style, protobuf, nodejs_22, + cowsay, }: (mkShell.override { inherit (zed-editor) stdenv; }) { inputsFrom = [ zed-editor ]; @@ -52,4 +54,19 @@ }; PROTOC = "${protobuf}/bin/protoc"; }; + + shellHook = lib.optionalString zed-editor.stdenv.hostPlatform.isDarwin '' + set -x + metal_compiler="$(env -u SDKROOT /usr/bin/xcrun -f metal)" + if ! $("$metal_compiler" --help &> /dev/null); then + { + echo 'Leave the devshell and run `xcodebuild -downloadComponent MetalToolchain`' + echo "to download the (proprietary 😤) metal compiler, or you'll need to pass" + echo '`--features gpui/runtime_shaders` to cargo.' + } | + ${lib.getExe cowsay} -W 80 + else + XCRUN_PATH=/usr/bin/xcrun + fi; + ''; }