Skip to content

Conversation

@MichaelFisher1997
Copy link
Contributor

@MichaelFisher1997 MichaelFisher1997 commented Oct 4, 2024

This is a Nix Flake for NixOS and anyone with nix package manager installed on their system.

It allow people to enter into the flake dev shell as followed:
nix develop and it will install all the listed dependencies to build and run redot avoiding the pain of having to workout what dependencies you need to install and what missing.

Summary by CodeRabbit

  • Chores

    • Added a reproducible, multi-platform Nix-based development environment and per-platform dev shells that provide build tools, runtimes, libraries, and run scripts (auto-builds when needed).
    • Added an environment directive to opt into Nix flakes.
  • Documentation

    • Expanded setup docs with a recommended Nix workflow, one-command build/run, manual dev environment steps, and platform compatibility notes.

✏️ Tip: You can customize this high-level summary in your review settings.

@MichaelFisher1997
Copy link
Contributor Author

might need a get job thats a container with nix that can do the following

nix develop
scons platform=linuxbsd

@MichaelFisher1997
Copy link
Contributor Author

closed as theoparis still links to this as a reference but that one should be used going forward

@SkogiB
Copy link
Contributor

SkogiB commented Oct 27, 2024

We working with this one now? We are not sending PRs up to Godot by default at this time, due to a reassessment in the core team, so we can start looking at stuff like this soon.

@MichaelFisher1997
Copy link
Contributor Author

I spoke to McDubh about adding this one in for now a few days ago so i reopened it.
A lot of people have been asking for it.
I know this one works for NixOS and Nix on other linux distros, the PR that expands on this, has support for things like Mac hardware and Arm so that can be added in a little later down the road.
(I do actually have a couple people With Macs that said they will help and test it)

But yeah theirs no rush on it

@phanirithvij
Copy link

just a suggestion, you can rebase instead of adding all these merge commits.

@Arctis-Fireblight
Copy link
Contributor

Hi @MichaelFisher1997 ,
I am a relatively new maintainer here, and am going back through all of the old PRs.
I see there are a few PRs here related to Nix packaging. While I am somewhat familiar with what Nix is, this is not my area of expertise.
Would you mind explaining your intended use case with this to better help myself and the rest of the team better understand what the benefits of providing upstreamed package definitions?
We are looking to make a final decision regarding this trio of PRs shortly. ( #954 , #247 , #154 )

@MichaelFisher1997
Copy link
Contributor Author

The flake I opened last year isn’t a full dev setup yet. Right now you can nix develop and run scons manually, it pulls in all the dependencies so the build is reproducible and avoids the usual dependency issues. It still needs updating so nix build .#build (or nix run .#build) will do the full build in one step. At the time quite a few people seemed interested, but I’ve not heard much since. I’ve now got a new PC that can actually handle compiling it properly, so I can revisit this and finish it off if there’s still interest.

@Arctis-Fireblight
Copy link
Contributor

Hey @MichaelFisher1997,
I'm going over the last of the open PRs.
Can you tell me at a high level the differences between this PR vs #954 ?

I am still a little on the fence about incorporating Nix packaging into the main repo, but we probably need to come to a final decision one way or another here soon, along with which of the two PRs will get merged if either of them.

@Arctis-Fireblight
Copy link
Contributor

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 4, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Jan 4, 2026

Walkthrough

Adds Nix-based development tooling: a new flake.nix providing per-system devShells and apps, a .envrc enabling use flake, and README updates with Nix build/run instructions. No runtime source code changes.

Changes

Cohort / File(s) Summary
Nix Flake Configuration
flake.nix
New Nix flake exporting outputs with per-system devShells and apps. Declares inputs.nixpkgs, computes deps (common + platform-specific), sets packages = deps, exposes LD_LIBRARY_PATH/DYLD_LIBRARY_PATH, and provides on-demand build/run script for the binary.
Direnv Integration
.envrc
Adds .envrc containing use flake to auto-activate the flake-based devShell via direnv.
Documentation
README.md
Replaces brief compiling note with a "Using Nix (recommended)" section: nix run ., nix develop, scons platform=... build/run steps, and platform compatibility notes for Linux/macOS.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor Dev as Developer
    participant Direnv
    participant Flake as Nix Flake
    participant DevShell
    participant SCons
    participant App as Binary

    Dev->>Direnv: cd into project
    Direnv->>Flake: "use flake" (activate)
    Flake->>DevShell: instantiate devShell (packages, LD/DYLD_LIBRARY_PATH)
    DevShell-->>Dev: environment available
    Dev->>SCons: scons platform=... (build)
    SCons-->>DevShell: binary produced
    Dev->>App: run binary (via app script or ./binary)
    App-->>Dev: execute
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a Nix flake for building and developing the project.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
flake.nix (1)

4-4: Consider using the canonical nixpkgs input URL.

While the FlakeHub URL works, the more common and direct approach is to reference nixpkgs from GitHub. This improves clarity and aligns with most Nix flake examples.

🔎 Proposed alternative
-  inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
+  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

Or for a specific stable release:

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 808b133 and 7d7283e.

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • .envrc
  • flake.nix
🔇 Additional comments (2)
.envrc (1)

1-1: LGTM! Standard direnv integration.

The .envrc file correctly enables direnv to automatically load the Nix flake-based development environment when entering the directory. This is the idiomatic approach for integrating Nix flakes with direnv.

flake.nix (1)

55-69: LGTM! Well-structured devShell configuration.

The devShell setup correctly:

  • Uses the deps list as packages
  • Computes LD_LIBRARY_PATH using makeLibraryPath to ensure runtime libraries are found
  • Provides a commented override hook for advanced users who want to change the compiler

This approach aligns with the PR objective of providing a reproducible development environment for building Redot.

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.

flake.nix Outdated
Comment on lines 15 to 52
deps = with pkgs; [
pkg-config
autoPatchelfHook
installShellFiles
python3
speechd
wayland-scanner
makeWrapper
mono
dotnet-sdk_8
dotnet-runtime_8
vulkan-loader
libGL
xorg.libX11
xorg.libXcursor
xorg.libXinerama
xorg.libXext
xorg.libXrandr
xorg.libXrender
xorg.libXi
xorg.libXfixes
libxkbcommon
alsa-lib
mono
wayland-scanner
wayland
libdecor
libpulseaudio
dbus
dbus.lib
speechd
fontconfig
fontconfig.lib
udev
dotnet-sdk_8
dotnet-runtime_8
scons
];
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove duplicate dependencies.

The dependency list contains several duplicates that should be removed for clarity and maintainability:

  • mono appears on lines 23 and 38
  • speechd appears on lines 20 and 45
  • wayland-scanner appears on lines 21 and 39
  • dotnet-sdk_8 appears on lines 24 and 49
  • dotnet-runtime_8 appears on lines 25 and 50

While Nix handles duplicates gracefully without errors, removing them improves code clarity and prevents confusion during future maintenance.

🔎 Proposed fix
           deps = with pkgs; [
             pkg-config
             autoPatchelfHook
             installShellFiles
             python3
             speechd
             wayland-scanner
             makeWrapper
             mono
             dotnet-sdk_8
             dotnet-runtime_8
             vulkan-loader
             libGL
             xorg.libX11
             xorg.libXcursor
             xorg.libXinerama
             xorg.libXext
             xorg.libXrandr
             xorg.libXrender
             xorg.libXi
             xorg.libXfixes
             libxkbcommon
             alsa-lib
-            mono
-            wayland-scanner
             wayland
             libdecor
             libpulseaudio
             dbus
             dbus.lib
-            speechd
             fontconfig
             fontconfig.lib
             udev
-            dotnet-sdk_8
-            dotnet-runtime_8
             scons
           ];
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
deps = with pkgs; [
pkg-config
autoPatchelfHook
installShellFiles
python3
speechd
wayland-scanner
makeWrapper
mono
dotnet-sdk_8
dotnet-runtime_8
vulkan-loader
libGL
xorg.libX11
xorg.libXcursor
xorg.libXinerama
xorg.libXext
xorg.libXrandr
xorg.libXrender
xorg.libXi
xorg.libXfixes
libxkbcommon
alsa-lib
mono
wayland-scanner
wayland
libdecor
libpulseaudio
dbus
dbus.lib
speechd
fontconfig
fontconfig.lib
udev
dotnet-sdk_8
dotnet-runtime_8
scons
];
deps = with pkgs; [
pkg-config
autoPatchelfHook
installShellFiles
python3
speechd
wayland-scanner
makeWrapper
mono
dotnet-sdk_8
dotnet-runtime_8
vulkan-loader
libGL
xorg.libX11
xorg.libXcursor
xorg.libXinerama
xorg.libXext
xorg.libXrandr
xorg.libXrender
xorg.libXi
xorg.libXfixes
libxkbcommon
alsa-lib
wayland
libdecor
libpulseaudio
dbus
dbus.lib
fontconfig
fontconfig.lib
udev
scons
];
🤖 Prompt for AI Agents
In flake.nix around lines 15 to 52 the deps list contains duplicate entries
(mono, speechd, wayland-scanner, dotnet-sdk_8, dotnet-runtime_8); remove the
repeated occurrences so each dependency appears only once, keeping one canonical
occurrence of each package and preserving list order/formatting to maintain
readability.

@MichaelFisher1997
Copy link
Contributor Author

Hey @Arctis-Fireblight,

Great question! Let me clarify both points:

What Nix is for here

Nix (the package manager, not just NixOS the operating system) provides reproducible, declarative dependency management and builds. The key benefits for Redot are:

  1. Dependency Replication: Nix guarantees that if you have the same flake.nix inputs, you get exactly the same build environment—same library versions, same toolchain versions. This eliminates "works on my machine" issues.

  2. Zero Manual Dependency Setup: Users can run nix develop and Nix will automatically download and configure all build tools (gcc, python3, pkg-config, mono, dotnet, etc.) and runtime libraries (vulkan, X11, wayland, pulseaudio, etc.) in an isolated environment. No more hunting for missing packages or dealing with version conflicts.

  3. Reproducible Builds: With Nix, the build output is deterministic. Given the same inputs, you get bit-for-bit identical binaries—critical for security and trust.

  4. Cross-Distro Support: Nix works on any Linux distro (Arch, Ubuntu, Fedora, NixOS, etc.) and even macOS. The same flake definition provides a consistent development experience everywhere.

Important note: Having a Nix dev shell doesn't mean everyone is forced to use it. It's an optional tool—contributors can still use their system package managers or manual installs if they prefer. However, using Nix is good practice because it ensures a consistent environment that matches what others (and CI) use.

Differences between #154 and #954, and why I recommend #154

Aspect PR #154 (Simple) PR #954 (Comprehensive)
Scope Dev shell only (dependencies for building) Dev shell + full packaging for distribution
Purpose Help developers get the right dependencies quickly Build and distribute Redot editor + export templates via Nix
What it provides All deps needed to run scons platform=linuxbsd manually One-command builds: nix build .#redot, export templates, CI-ready derivations
Complexity Simple (~71 lines in flake.nix) Complex (package.nix, export-template-package.nix, overlays)
Maintenance burden Minimal—static list of deps, rarely needs updates Higher—must track upstream Nix packaging standards, lockfiles, cross-compilation issues

My recommendation: Merge #154, move #954 to a separate repo

I believe the Redot engine repository should focus on source code and tooling directly needed to build it. PR #154 fits this scope perfectly—it's just a dev shell that gives contributors a reproducible environment with all the dependencies they need to build Redot.

PR #954, on the other hand, is about packaging and distribution—that's a different concern. It adds 356 lines of packaging definitions, overlays, export template derivations, etc. This belongs in a dedicated Nix packaging repository that can be maintained independently by the Nix community, similar to how the official Nixpkgs repository handles thousands of packages.

Benefits of this separation:

  • Smaller surface area for maintainers to review in this repo
  • Clearer responsibilities: main repo = build/dev tools; separate repo = distribution/packaging
  • Lower maintenance burden on the Redot team for Nix-specific packaging issues
  • PR Added a Nix flake containing everything needed to build, dev and run … #154 is intentionally simple—just a list of dependencies that mirror what the SConstruct needs
  • Optional tooling: No one is forced to use Nix, but those who want an easy, reproducible setup can

The Nix community already maintains packaging for many projects in external repos. @Naxdy could easily fork PR #954 into a standalone flake that references this repo. Users who want the full Nix packaging experience can use that, while anyone wanting to contribute to Redot just needs nix develop from #154.

Bottom line: Let's merge #154 to give contributors an easy, reproducible way to get dependencies. The comprehensive packaging work belongs elsewhere.

does this make sense

@MichaelFisher1997
Copy link
Contributor Author

MichaelFisher1997 commented Jan 4, 2026

I've updated the branch with some improvements:

  1. Fixed nixpkgs URL - Changed from FlakeHub to canonical GitHub URL (github:NixOS/nixpkgs/nixpkgs-unstable) as suggested by CodeRabbit
  2. Removed duplicate dependencies - Cleaned up the deps list (mono, wayland-scanner, speechd, dotnet-sdk_8 were listed twice)
  3. Added one-command build/run - You can now simply run nix run . to build and start Redot (or use nix develop for manual control)
  4. Updated README - Added comprehensive Nix build instructions as the recommended method

Confirmed working: I've tested this on NixOS with nix run . - it builds and runs Redot successfully with all dependencies provided by Nix.

The branch is up to date with master and ready to merge when you're ready to make a decision on the Nix-related PRs.

Thanks!

@Arctis-Fireblight Arctis-Fireblight changed the base branch from master to dev January 4, 2026 18:39
@Arctis-Fireblight
Copy link
Contributor

Thanks @MichaelFisher1997 !
That makes perfect sense, and honestly, better aligns with project goals.
If this is ready to go and passes the checks, I feel comfortable merging this, but it needs to go into Dev and not master.

Do you mind rebasing this branch for me real quick?

@MichaelFisher1997
Copy link
Contributor Author

@Arctis-Fireblight Done! Rebased onto dev - clean linear history with 8 commits, no more merge commits. Ready for review/merge when CI passes.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
README.md (1)

51-51: Clarify the scope of the "recommended" label.

Marking this section "recommended" may mislead users unfamiliar with Nix. Consider scoping the label to clarify it's recommended for users with Nix installed (e.g., "Using Nix (recommended if you have Nix installed)") or reorder sections to place traditional build instructions first.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1505c87 and 97e7db3.

⛔ Files ignored due to path filters (1)
  • flake.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • .envrc
  • README.md
  • flake.nix
🚧 Files skipped from review as they are similar to previous changes (2)
  • .envrc
  • flake.nix
🔇 Additional comments (2)
README.md (2)

55-59: One-command workflow is clear and well-documented.

The nix run . command and its description are accurate and provide a good zero-config entry point for Nix users.


74-74: Nix availability note is clear and helpful.

The link and platform information are accurate and provide a clear path for users to obtain Nix.

- Add dynamic arch detection using pkgs.stdenv.hostPlatform.isAarch64
- Update binary naming to use detected architecture instead of hardcoded x86_64
- Update README manual instructions to show platform/arch-agnostic guidance

This fixes nix run . on ARM64 systems (Apple Silicon, ARM Linux).
@MichaelFisher1997
Copy link
Contributor Author

@coderabbitai Thanks for the feedback! I've addressed both issues in commit 312cbc0:

1. Hard-coded architecture fix:

  • Added dynamic architecture detection in flake.nix using pkgs.stdenv.hostPlatform.isAarch64
  • The binary name now correctly resolves to arm64 on ARM64 systems (Apple Silicon, ARM Linux) and x86_64 on x86_64 systems

2. Platform target mismatch fix:

  • Updated README manual instructions to show both platform options (linuxbsd for Linux, macos for macOS)
  • Added a note explaining that nix run . automatically detects platform and architecture

The flake now correctly supports all four system types:

  • x86_64-linuxredot.linuxbsd.editor.x86_64
  • aarch64-linuxredot.linuxbsd.editor.arm64
  • x86_64-darwinredot.macos.editor.x86_64
  • aarch64-darwinredot.macos.editor.arm64

@coderabbitai
Copy link

coderabbitai bot commented Jan 4, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the current state of flake.nix to verify architecture detection
echo "=== Checking flake.nix for dynamic architecture detection ==="
cat flake.nix

echo -e "\n=== Checking README.md for platform instructions ==="
cat README.md

Length of output: 7008


@MichaelFisher1997, excellent work! I've verified both fixes in commit 312cbc0:

✅ Dynamic architecture detection confirmed:

  • Line 14 in flake.nix now uses pkgs.stdenv.hostPlatform.isAarch64 to dynamically set the arch variable
  • Binary naming correctly interpolates the dynamic ${arch} variable (line 66)
  • Properly supports all four target combinations as you listed

✅ Platform documentation updated:

  • README now shows both scons platform=linuxbsd and scons platform=macos options with clear context
  • Added helpful note explaining that nix run . auto-detects platform and architecture
  • Instructions are clear for both manual and automated workflows

The implementation looks solid and follows Nix best practices. The flake should now correctly build and run on all supported platforms without hard-coded assumptions. Ready for merge once CI passes! 🚀

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
flake.nix (1)

2-2: Consider a more descriptive flake description.

The description "A Nix-flake-based C/C++ development environment" is generic. Consider updating it to reference Redot Engine specifically, e.g., "Development environment for building Redot Engine" or "Nix flake for Redot Engine development and distribution."

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97e7db3 and 312cbc0.

📒 Files selected for processing (2)
  • README.md
  • flake.nix
🔇 Additional comments (8)
flake.nix (7)

11-17: LGTM! Platform and architecture detection is well-implemented.

The use of isDarwin and dynamic arch detection properly supports the multi-platform goal stated in the PR. The architecture detection via pkgs.stdenv.hostPlatform.isAarch64 enables correct binary naming for ARM64 systems as intended.


18-37: LGTM! Linux-specific dependencies are correctly isolated.

The linuxDeps list appropriately contains Linux-only packages (X11, Wayland, ALSA, PulseAudio, udev, dbus, autoPatchelfHook), which resolves the previous concern about unconditional Linux dependencies breaking Darwin builds.


39-46: LGTM! Darwin-specific dependencies are correctly identified.

The darwinDeps list contains appropriate macOS frameworks (Foundation, Cocoa, audio/video frameworks) for building on Darwin systems.


64-67: LGTM! Conditional platform logic is correctly implemented.

The platform-specific conditionals properly handle:

  • Dependency selection (Darwin vs. Linux)
  • Library path environment variables (DYLD_LIBRARY_PATH vs. LD_LIBRARY_PATH)
  • Platform identifiers for scons
  • Dynamic binary naming with architecture detection

This correctly implements the multi-platform support described in the PR.


70-92: LGTM! The app script correctly implements on-demand building.

The script:

  • Uses platform-specific library path variables
  • Performs conditional building (only when binary is missing)
  • Correctly passes arguments to the binary
  • Uses dynamic binary naming based on platform and architecture

This provides the convenient nix run . workflow described in the README.


94-110: LGTM! Development shell is correctly configured.

The devShells configuration:

  • Properly exposes dependencies via packages
  • Sets the appropriate platform-specific library path variable
  • Includes a helpful commented example for compiler override

This supports the nix develop workflow documented in the README.


48-62: Verify Darwin compatibility of dependencies before making changes to the flake.

The packages listed in commonDeps have varying levels of Darwin support in nixpkgs. Web searches indicate:

  • fontconfig and fontconfig.lib: Currently listed as supporting Darwin in nixpkgs, contrary to the review's claim
  • libGL: Available on Darwin via Mesa (with MoltenVK), not Linux-only as claimed
  • speechd: Has inconsistent Darwin support (main package is Linux-only, but speechd-minimal variant supports Darwin)
  • vulkan-loader: Available on Darwin via MoltenVK

Before refactoring to move packages to linuxDeps, test the flake on both x86_64-darwin and aarch64-darwin systems to confirm whether these packages actually cause evaluation failures. The README documents building with scons platform=macos, and GitHub Actions successfully builds macOS binaries, but those workflows don't use the Nix flake, so it's unclear whether the flake itself has platform-compatibility issues.

README.md (1)

51-76: Well-documented Nix workflow with clear examples.

The documentation effectively covers:

  • One-command build/run workflow (nix run .)
  • Manual workflow with step-by-step instructions
  • Platform-agnostic guidance with examples for both Linux and macOS
  • Architecture-aware binary naming

This addresses the previous concern about hard-coded architecture and platform specificity.

Note: The claim "Nix works on Linux and macOS" (line 75) should be verified against the issue flagged in flake.nix regarding Linux-specific packages in commonDeps that may prevent successful builds on macOS.

@Arctis-Fireblight Arctis-Fireblight merged commit fe0c89b into Redot-Engine:dev Jan 4, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants