-
Notifications
You must be signed in to change notification settings - Fork 288
Added a Nix flake containing everything needed to build, dev and run … #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Arctis-Fireblight
merged 9 commits into
Redot-Engine:dev
from
MichaelFisher1997:nix-build-flake
Jan 4, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f259cf9
Added a Nix flake containing everything needed to build, dev and run …
9f5ddf5
Trigger Build
ca87bcf
Update nixpkgs URL to GitHub and remove duplicate dependencies
MichaelFisher1997 abb3c4a
Add app to build and run Redot in one command
MichaelFisher1997 749428e
Fix app program path reference
MichaelFisher1997 e55f2b9
Add Nix build instructions to README
MichaelFisher1997 6d42da8
Remove outdated other platforms compilation link
MichaelFisher1997 97e7db3
Add proper macOS/Darwin support with platform-specific dependencies
MichaelFisher1997 312cbc0
Fix architecture detection for ARM64 systems in Nix flake
MichaelFisher1997 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| use flake |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"]; | ||
| 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; | ||
| }; | ||
| }); | ||
| }; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 80
🏁 Script executed:
cat -n flake.nix | head -30Repository: Redot-Engine/redot-engine
Length of output: 1113
🏁 Script executed:
# Search for any PR description or comments mentioning macOS/Darwin git log --oneline -20Repository: Redot-Engine/redot-engine
Length of output: 135
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 589
🏁 Script executed:
# See more of flake.nix to understand the complete structure cat -n flake.nixRepository: Redot-Engine/redot-engine
Length of output: 2276
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 135
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 158
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 51
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 601
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 3097
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 206
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 78
🏁 Script executed:
# Check the PR template and any related issues cat ./.github/PULL_REQUEST_TEMPLATE.mdRepository: Redot-Engine/redot-engine
Length of output: 394
🏁 Script executed:
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 --statRepository: Redot-Engine/redot-engine
Length of output: 50382
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 51
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 135
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 2200
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 95
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 947
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 109
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 51
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 80
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 411
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 119
🏁 Script executed:
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
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 172
🏁 Script executed:
Repository: Redot-Engine/redot-engine
Length of output: 336
Remove Darwin systems until macOS/Nix compatibility is properly implemented.
The flake declares
x86_64-darwinandaarch64-darwinsupport but includes unconditional Linux-specific dependencies:autoPatchelfHookis for ELF binaries only (not applicable to macOS Mach-O format)xorg.*packages (X11),wayland-scanner,wayland,libdecor(Wayland) are Linux-onlyalsa-lib,libpulseaudio,udev,dbusare Linux-onlyThere are no platform-specific conditionals (
system == "darwin"orlib.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
supportedSystemsand add them back in a future PR once macOS compatibility is properly implemented with platform-specific package selection and environment variables (DYLD_LIBRARY_PATHinstead ofLD_LIBRARY_PATH).🤖 Prompt for AI Agents