Skip to content
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,32 @@ Official binaries for the Redot editor and the export templates will be found

### Compiling from source

[For the time being, see the official Godot docs](https://docs.godotengine.org/en/latest/contributing/development/compiling)
for compilation instructions for every supported platform.
#### Using Nix (recommended)

If you have the Nix package manager installed, you can build and run the editor in one command:

```bash
nix run .
```

This will automatically install all build dependencies and compile Redot if the binary doesn't exist.

For manual control over the build process:

```bash
# Enter the Nix development environment
nix develop

# Build Redot (use 'macos' on macOS, 'linuxbsd' on Linux)
scons platform=linuxbsd # or: scons platform=macos

# Run the editor - binary name reflects your platform and architecture
# Examples: redot.linuxbsd.editor.x86_64, redot.macos.editor.arm64
./bin/redot.<platform>.editor.<arch>
```

Nix works on Linux and macOS, and is available at [nixos.org/download.html](https://nixos.org/download.html). The `nix run .` command automatically detects your platform and architecture.


## Community and contributing

Expand Down
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

112 changes: 112 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
description = "A Nix-flake-based C/C++ development environment";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

outputs = {
self,
nixpkgs,
}: let
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "flake.nix" -type f

Repository: Redot-Engine/redot-engine

Length of output: 80


🏁 Script executed:

cat -n flake.nix | head -30

Repository: Redot-Engine/redot-engine

Length of output: 1113


🏁 Script executed:

# Search for any PR description or comments mentioning macOS/Darwin
git log --oneline -20

Repository: Redot-Engine/redot-engine

Length of output: 135


🏁 Script executed:

# Look for dependencies related to X11, Wayland
rg -i "x11|wayland" flake.nix -A 3 -B 3

Repository: Redot-Engine/redot-engine

Length of output: 589


🏁 Script executed:

# See more of flake.nix to understand the complete structure
cat -n flake.nix

Repository: Redot-Engine/redot-engine

Length of output: 2276


🏁 Script executed:

# Search for any PR context - check PR files or recent commits
git log --oneline --all -30 | grep -i "mac\|darwin\|nix"

Repository: Redot-Engine/redot-engine

Length of output: 135


🏁 Script executed:

# Check if there are any references to macOS or Darwin support in comments
rg "macos|darwin|mac support" -i flake.nix

Repository: Redot-Engine/redot-engine

Length of output: 158


🏁 Script executed:

# Look for any platform-specific conditionals
rg "lib\.hasSuffix.*darwin|system ==" flake.nix -A 3 -B 3

Repository: Redot-Engine/redot-engine

Length of output: 51


🏁 Script executed:

# Look for PR description or comments
find . -name "*.md" -o -name "*.txt" | head -20

Repository: Redot-Engine/redot-engine

Length of output: 601


🏁 Script executed:

# Search for any README or documentation mentioning macOS
rg "macos|darwin|apple" -i . --type md --type txt | head -20

Repository: Redot-Engine/redot-engine

Length of output: 3097


🏁 Script executed:

# Check git log for PR or commit messages
git log --all --pretty=format:"%h %s" | head -30

Repository: Redot-Engine/redot-engine

Length of output: 206


🏁 Script executed:

# Look for any issue or PR context in the repo
find . -name ".github" -type d

Repository: Redot-Engine/redot-engine

Length of output: 78


🏁 Script executed:

# Check the PR template and any related issues
cat ./.github/PULL_REQUEST_TEMPLATE.md

Repository: Redot-Engine/redot-engine

Length of output: 394


🏁 Script executed:

# Search for any flake.nix related issues or PRs
git log --all --format="%h %s %b" | grep -i "flake\|nix" -A 5 | head -40

Repository: Redot-Engine/redot-engine

Length of output: 136


🏁 Script executed:

# Check if there's any discussion in recent commits about macOS
git show 7d7283ec89 --stat

Repository: Redot-Engine/redot-engine

Length of output: 50382


🏁 Script executed:

# Look for any documentation about the flake in the repo
rg "flake" -i . --type md | head -20

Repository: Redot-Engine/redot-engine

Length of output: 51


🏁 Script executed:

# Look for any branch or PR related messages
git log --all --grep="macos\|darwin\|nix" -i --oneline | head -20

Repository: Redot-Engine/redot-engine

Length of output: 135


🏁 Script executed:

# Check the actual changes made to flake.nix in recent commits
git log --all -p -- flake.nix | head -100

Repository: Redot-Engine/redot-engine

Length of output: 2200


🏁 Script executed:

# Look for any discussions or comments in the repository
find . -name "*.md" -o -name "*.txt" | xargs grep -l "macos\|darwin.*support\|planned" 2>/dev/null | head -10

Repository: Redot-Engine/redot-engine

Length of output: 95


🏁 Script executed:

# Check if there's any environment or conditional logic for Darwin
rg "stdenvNoCC|mkShell|pkgs\." flake.nix -A 5 -B 5

Repository: Redot-Engine/redot-engine

Length of output: 947


🏁 Script executed:

# Let's verify if autoPatchelfHook is Linux-specific
rg "autoPatchelfHook" . --type nix | head -5

Repository: Redot-Engine/redot-engine

Length of output: 109


🏁 Script executed:

# Check if there's any way this flake could handle Darwin gracefully
# Look for mkShell or other derivations that might conditionally handle platforms
rg "system ==" flake.nix -A 3 -B 3

Repository: Redot-Engine/redot-engine

Length of output: 51


🏁 Script executed:

# See what happens when unsupported packages are referenced on Darwin
# Check if there's any Nix documentation references or similar patterns
find . -name "*.nix" -type f | head -10

Repository: Redot-Engine/redot-engine

Length of output: 80


🏁 Script executed:

# Verify if the LD_LIBRARY_PATH is set unconditionally for all systems
cat -n flake.nix | grep -A 10 "mkShell"

Repository: Redot-Engine/redot-engine

Length of output: 411


🏁 Script executed:

# Verify if autoPatchelfHook is actually available for Darwin in nixpkgs
web_search "autoPatchelfHook nixpkgs darwin macos available"

Repository: Redot-Engine/redot-engine

Length of output: 119


🏁 Script executed:

# Check what happens when Nix evaluates unsupported packages for a system
# Look for any error handling or documentation
rg "skipBuildInputs|optional|lib\." flake.nix | head -20

Repository: Redot-Engine/redot-engine

Length of output: 180


🌐 Web query:

autoPatchelfHook nixpkgs darwin macos availability

💡 Result:

Short answer: autoPatchelfHook is for ELF binaries (Linux) and is not applicable to native macOS (Darwin) Mach-O binaries — so it’s not used on darwin/stdenv. Use macOS tools (install_name_tool/otool) or nix/darwin-specific packaging helpers instead. [1][2][3]

Sources

  • autoPatchelfHook (works on ELF files). [1]
  • Mach‑O is the native macOS binary format (not ELF). [2]
  • Nixpkgs Darwin platform notes (darwin/stdenv differences). [3]

🏁 Script executed:

# Check if there's any conditional logic or system-specific handling in the flake
# Look for lib.optionals or similar patterns
rg "optionals|mkIf|system" flake.nix

Repository: Redot-Engine/redot-engine

Length of output: 172


🏁 Script executed:

# Verify the actual behavior - does nixpkgs provide autoPatchelfHook for Darwin?
# Check if there are any .override or conditionals we missed
cat flake.nix | grep -E "system|darwin|linux|condition" -i

Repository: Redot-Engine/redot-engine

Length of output: 336


Remove Darwin systems until macOS/Nix compatibility is properly implemented.

The flake declares x86_64-darwin and aarch64-darwin support but includes unconditional Linux-specific dependencies:

  • autoPatchelfHook is for ELF binaries only (not applicable to macOS Mach-O format)
  • xorg.* packages (X11), wayland-scanner, wayland, libdecor (Wayland) are Linux-only
  • alsa-lib, libpulseaudio, udev, dbus are Linux-only

There are no platform-specific conditionals (system == "darwin" or lib.optionals) to handle these differences. The flake will fail to evaluate on macOS. Users attempting to use this on Darwin will encounter build failures, making the declared support misleading.

Remove Darwin systems from supportedSystems and add them back in a future PR once macOS compatibility is properly implemented with platform-specific package selection and environment variables (DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH).

🤖 Prompt for AI Agents
In flake.nix around line 10, supportedSystems incorrectly lists x86_64-darwin
and aarch64-darwin while the flake unconditionally includes Linux-only
dependencies (autoPatchelfHook, xorg/*, wayland-*, libdecor, alsa-lib,
libpulseaudio, udev, dbus); remove the Darwin entries from supportedSystems to
prevent evaluation/build failures on macOS, and plan a follow-up PR to
reintroduce Darwin with proper platform-specific conditionals and
Darwin-specific environment handling (e.g., DYLD_LIBRARY_PATH) once
compatibility is implemented.

forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
f rec {
pkgs = import nixpkgs {inherit system;};
isDarwin = pkgs.lib.hasSuffix system "darwin";
arch = if pkgs.stdenv.hostPlatform.isAarch64 then "arm64" else "x86_64";

linuxDeps = with pkgs; [
autoPatchelfHook
xorg.libX11
xorg.libXcursor
xorg.libXinerama
xorg.libXext
xorg.libXrandr
xorg.libXrender
xorg.libXi
xorg.libXfixes
libxkbcommon
wayland-scanner
wayland
libdecor
alsa-lib
libpulseaudio
udev
dbus
dbus.lib
];

darwinDeps = with pkgs; [
Foundation
Cocoa
AudioToolbox
CoreAudio
CoreVideo
AVFoundation
];

commonDeps = with pkgs; [
pkg-config
installShellFiles
python3
speechd
makeWrapper
mono
dotnet-sdk_8
dotnet-runtime_8
vulkan-loader
libGL
fontconfig
fontconfig.lib
scons
];

deps = if isDarwin then darwinDeps ++ commonDeps else linuxDeps ++ commonDeps;
libraryPathVar = if isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
platform = if isDarwin then "macos" else "linuxbsd";
binary = if isDarwin then "redot.macos.editor.${arch}" else "redot.linuxbsd.editor.${arch}";
});
in {
apps = forEachSupportedSystem ({
pkgs,
deps,
libraryPathVar,
platform,
binary,
arch,
...
}: let
script = pkgs.writeShellScript "redot" ''
export ${libraryPathVar}=${pkgs.lib.makeLibraryPath deps}
if [ ! -f ./bin/${binary} ]; then
echo "Building Redot..."
scons platform=${platform}
fi
exec ./bin/${binary} "$@"
'';
in {
default = {
type = "app";
program = "${script}";
};
});

devShells = forEachSupportedSystem ({
pkgs,
deps,
libraryPathVar,
...
}: {
default =
pkgs.mkShell.override
{
# Override stdenv in order to change compiler:
# stdenv = pkgs.clangStdenv;
}
{
packages = deps;
${libraryPathVar} = pkgs.lib.makeLibraryPath deps;
};
});
};
}
Loading