Repository navigation
Add Nix flake supporting both x86_64 and aarch64 Linux #135
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
Open
pgattic
wants to merge
13
commits into
patchzyy:main
Choose a base branch
from
pgattic:feat/nix-rebased
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,239
−0
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e664033
feat(nix): add flake for pure native Linux build
skiletro 043251d
refactor(nix): consolidate pipeline into build.nix, harden launcher
skiletro 532a864
feat(nix): impure Retro Rewind lifecycle, drop store-pinned RR product
skiletro 68350ef
feat(nix): add aarch64 support, fix build issues
pgattic 37c71c4
chore(nix): document rvz conversion, update hash
pgattic db44150
chore(nix): update inputs
pgattic 222198e
chore(nix): update retro rewind hash
pgattic 1169a30
chore(nix): Clean up Nix code
pgattic c33dcdc
refactor(nix): remove volatile URL from RR deps
pgattic 02e8432
chore(nix): Update inputs, nixpkgs -> nixos.org
pgattic 62e1480
chore(nix): catch up upstream native deps
pgattic 7ca52a3
chore(nix): Update inputs
pgattic f76e74a
fix(nix): harden Retro Rewind payload update
pgattic 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 |
|---|---|---|
|
|
@@ -30,6 +30,10 @@ Code.pul | |
| /local-products/ | ||
| /dist/ | ||
| /out/ | ||
|
|
||
| # Nix build results | ||
| /result | ||
| /result-* | ||
| [Bb]in/ | ||
| [Oo]bj/ | ||
| *.o | ||
|
|
||
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,197 @@ | ||
| { | ||
| description = "Wiicompiled: native Mario Kart Wii recompilation"; | ||
|
|
||
| inputs = { | ||
| nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst"; | ||
| }; | ||
|
|
||
| outputs = { | ||
| self, | ||
| nixpkgs, | ||
| }: let | ||
| systems = [ | ||
| "x86_64-linux" | ||
| "aarch64-linux" | ||
| ]; | ||
| forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system}); | ||
|
|
||
| mkOutputs = pkgs: let | ||
| lib = pkgs.lib; | ||
| # The build consumes projects/, runtime/ and aurora-main/ only; keeping | ||
| # the flake's own nix/ files out means flake-only edits do not | ||
| # re-trigger the translation and native build derivations. | ||
| repoSrc = lib.cleanSourceWith { | ||
| src = lib.cleanSource self; | ||
| filter = path: type: | ||
| !(type == "directory" && baseNameOf path == "nix") | ||
| && baseNameOf path != "flake.nix" | ||
| && baseNameOf path != "flake.lock"; | ||
| }; | ||
|
|
||
| # The disc image and the extracted tree derive from the user's own | ||
| # game dump, which the project may not redistribute, so they eval in | ||
| # an allow-unfree scope. Everything else in the flake stays free. | ||
| unfreePkgs = import pkgs.path { | ||
| system = pkgs.stdenv.hostPlatform.system; | ||
| config.allowUnfree = true; | ||
| }; | ||
| discImage = unfreePkgs.requireFile { | ||
| name = "RMCP01.rvz"; | ||
| hashMode = "recursive"; | ||
| hash = "sha256-x2xbamRFEyVsJH08SeW1mpiLzVPmJOhBX2xSVbpt6LA="; | ||
| message = '' | ||
| WiiCompiled needs your legally dumped clean PAL RMCP01 RVZ named | ||
| RMCP01.rvz. Convert a clean PAL RMCP01 ISO with Dolphin's CLI: | ||
|
|
||
| dolphin-tool convert --input /path/to/MarioKart.iso --output /path/to/RMCP01.rvz --format rvz --block_size 131072 --compression zstd --compression_level 5 | ||
|
|
||
| Then add that RVZ to the Nix store with: | ||
|
|
||
| nix-store --add-fixed sha256 --recursive /path/to/RMCP01.rvz | ||
| ''; | ||
| }; | ||
|
|
||
| # The datatree carries the extracted game data (unfree), so the whole | ||
| # pipeline is built in an allow-unfree scope; the tools it consumes are | ||
| # the same nixpkgs ones either way. | ||
| build = unfreePkgs.callPackage ./nix/build.nix { | ||
| inherit repoSrc; | ||
| inherit translator; | ||
| deps = pkgs.callPackage ./nix/deps.nix {}; | ||
| llvmPackages = pkgs.llvmPackages; | ||
| }; | ||
|
|
||
| dataTree = build.extractDisc {} {inherit discImage;}; | ||
|
|
||
| translation = build.translate {inherit dataTree;}; | ||
|
|
||
| game = build.buildNative {inherit translation;}; | ||
|
|
||
| retroRewindApp = pkgs.callPackage ./nix/retro-rewind-app.nix { | ||
| inherit repoSrc; | ||
| datatree = dataTree; | ||
| inherit translator; | ||
| drirc = build.drirc; | ||
| }; | ||
| translator = pkgs.callPackage ./nix/translator {}; | ||
| in rec { | ||
| nodtool = pkgs.nodtool; | ||
| datatree = dataTree; | ||
| inherit translation game translator; | ||
| translator-fetch-deps = translator.passthru.fetch-deps; | ||
|
|
||
| wiicompiled = build.launcher { | ||
| inherit game dataTree; | ||
| drirc = build.drirc; | ||
| }; | ||
|
|
||
| retro-rewind = retroRewindApp; | ||
|
|
||
| default = wiicompiled; | ||
| }; | ||
| in { | ||
| devShells = forAllSystems (pkgs: { | ||
| default = pkgs.mkShell { | ||
| packages = with pkgs; [ | ||
| dotnet-sdk_8 | ||
| llvmPackages.clang | ||
| cmake | ||
| ninja | ||
| pkg-config | ||
| sdl3 | ||
| vulkan-headers | ||
| vulkan-loader | ||
| libx11 | ||
| libxcursor | ||
| libxi | ||
| libxrandr | ||
| wayland | ||
| wayland-protocols | ||
| libxkbcommon | ||
| ]; | ||
| }; | ||
|
|
||
| # Environment for the impure workspace Retro Rewind build the | ||
| # retro-rewind launcher drives via `nix develop .#retro-rewind-build`. | ||
| # The cc wrapper puts every package's lib dir on the binary's rpath, so | ||
| # the resulting executable runs on NixOS without further fixups; the | ||
| # dlopen-via-rpath details match nix/build.nix's findings. | ||
| retro-rewind-build = let | ||
| buildDeps = with pkgs; [ | ||
| vulkan-headers | ||
| vulkan-loader | ||
| wayland | ||
| wayland-protocols | ||
| libxkbcommon | ||
| libffi | ||
| libGL | ||
| mesa | ||
| alsa-lib | ||
| libpulseaudio | ||
| pipewire | ||
| libx11 | ||
| libxcb | ||
| libxext | ||
| libxrender | ||
| libxcursor | ||
| libxi | ||
| libxrandr | ||
| libxscrnsaver | ||
| libxfixes | ||
| libxtst | ||
| libxv | ||
| ]; | ||
| in | ||
| pkgs.mkShell { | ||
| packages = | ||
| [ | ||
| pkgs.llvmPackages.clang | ||
| pkgs.cmake | ||
| pkgs.ninja | ||
| pkgs.pkg-config | ||
| # SDL's CheckWayland drops the Wayland video driver when the | ||
| # scanner is missing (see nix/build.nix). | ||
| pkgs."wayland-scanner" | ||
| ] | ||
| ++ buildDeps; | ||
| # The cmake setup hook only populates CMAKE_PREFIX_PATH during | ||
| # real builds, not in interactive shells; feed the dependencies to | ||
| # find_package manually (dev output for headers, lib for libs). | ||
| # NIX_LDFLAGS rpath entries likewise: the workspace build has no | ||
| # fixupPhase to repair rpaths, and SDL dlopens X11/Wayland/audio | ||
| # by default, so the linked binary must carry the store lib dirs | ||
| # itself. | ||
| shellHook = '' | ||
| export CMAKE_PREFIX_PATH="${pkgs.lib.concatMapStringsSep ":" (p: "${pkgs.lib.getDev p}:${pkgs.lib.getLib p}") buildDeps}" | ||
| export NIX_LDFLAGS="$NIX_LDFLAGS ${pkgs.lib.concatMapStringsSep " " (p: "-rpath ${pkgs.lib.getLib p}/lib") buildDeps}" | ||
| ''; | ||
| }; | ||
| }); | ||
|
|
||
| packages = forAllSystems mkOutputs; | ||
|
|
||
| # The pinned FetchContent sources are a nested set, so they live outside | ||
| # the packages output (whose values must be derivations). Handy for | ||
| # inspecting a single dep: nix build .#legacyPackages.x86_64-linux.deps.fmt | ||
| legacyPackages = forAllSystems (pkgs: { | ||
| deps = pkgs.callPackage ./nix/deps.nix {}; | ||
| }); | ||
|
|
||
| apps = forAllSystems ( | ||
| pkgs: let | ||
| outputs = mkOutputs pkgs; | ||
| in { | ||
| wiicompiled = { | ||
| type = "app"; | ||
| program = "${outputs.wiicompiled}/bin/wiicompiled"; | ||
| meta.description = "Mario Kart Wii (WiiCompiled base product)"; | ||
| }; | ||
| retro-rewind = { | ||
| type = "app"; | ||
| program = "${outputs.retro-rewind}/bin/retro-rewind"; | ||
| meta.description = "Mario Kart Wii Retro Rewind (WiiCompiled), impure install/update/launch"; | ||
| }; | ||
| } | ||
| ); | ||
| }; | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.