variety of things to work on soon
A message was moved here from #general > (no topic) by dezren39.
I finally got to this @Luke Boswell, this flake.nix makes just dev examples/pong.roc
work :)
{
description = "Roc Ray platform flake";
inputs = {
roc.url = "github:roc-lang/roc";
nixpkgs.follows = "roc/nixpkgs";
# rust from nixpkgs has some libc problems, this is patched in the rust-overlay
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
# to easily make configs for multiple architectures
flake-utils.url = "github:numtide/flake-utils";
# to make graphics work with nix
nixgl = {
url = "github:guibou/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = { self, roc, nixpkgs, rust-overlay, flake-utils, nixgl }:
let supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
in flake-utils.lib.eachSystem supportedSystems (system:
let
overlays = [ (import rust-overlay) ]
++ (if system == "x86_64-linux" then [ nixgl.overlay ] else [ ]);
pkgs = import nixpkgs { inherit system overlays; };
rocPkgs = roc.packages.${system};
# llvmPkgs = pkgs.llvmPackages_16;
rust = pkgs.rust-bin.fromRustupToolchainFile "${toString ./rust-toolchain.toml}";
linuxDeps = with pkgs;
lib.optionals stdenv.isLinux [
libglvnd
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
xorg.libxcb
xorg.libXinerama
];
macosDeps = if pkgs.stdenv.isDarwin then [
pkgs.libiconv
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
pkgs.darwin.apple_sdk.frameworks.CoreGraphics
pkgs.darwin.apple_sdk.frameworks.AppKit
] else [];
in {
devShell = if pkgs.stdenv.isDarwin then
throw ''
HELP WANTED FOR ROC RAY NIX CONFIGURATION
Darwin/macOS is not currently supported due to framework linking issues.
If you'd like to help fix this, please check:
https://github.com/your-repo/roc-ray/issues
The main issue is with linking Objective-C runtime and macOS frameworks
correctly within the Nix environment. I can't find the right incantation
to make it work. If you have experience with this, please help! :smile:
''
else pkgs.mkShell {
packages = [
rocPkgs.cli
rust
pkgs.zig # For Web support, used to build roc wasm static library
pkgs.emscripten
pkgs.simple-http-server
pkgs.just # For dev command
] ++ linuxDeps ++ macosDeps;
shellHook = ''
if [ "$(uname)" = "Darwin" ]; then
export SDKROOT=$(xcrun --show-sdk-path)
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath macosDeps}:$LD_LIBRARY_PATH
fi
if [ "$(uname)" = "Linux" ]; then
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath linuxDeps}:$LD_LIBRARY_PATH
fi
'';
};
formatter = pkgs.nixpkgs-fmt;
});
}
Last updated: Sep 16 2025 at 22:42 UTC