diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..3550a30f --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 700286c0..6e4ace76 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,6 @@ TM-CE/ # Mac files .DS_Store + +# Direnv folder +.direnv/ diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 94962ca5..f708a21c 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -26,6 +26,13 @@ If you have any other questions, feel free to ping me (Aitch) in the dev-discuss - If the provided binaries fail (possibly due to libc issues), you can compile your own binaries from my repos: [gc_fst](https://github.com/AlexanderHarrison/gc_fst), [hmex](https://github.com/AlexanderHarrison/cdat), [hgecko](https://github.com/AlexanderHarrison/hgecko) +### NixOS +1. Make sure you have the [Flakes](https://nixos.wiki/wiki/Flakes) feature enabled. +2. Enter the development shell by running `nix develop` to load all the necessary dependencies. +3. Run the command `./build.sh path-to-melee.iso` in the console. + +Alternatively, if you have [Direnv](https://nixos.wiki/wiki/Direnv) installed, you can run `direnv allow` to enter the development shell automatically when you enter this project directory. + ### Build Mode The build script takes an optional additional mode argument called the mode - `build.sh iso [mode]`. This allows building an optimized release, or fine-grained recompilation. diff --git a/build.sh b/build.sh index 4917a82d..3dd40301 100755 --- a/build.sh +++ b/build.sh @@ -32,9 +32,18 @@ elif [[ "$(uname)" == "Darwin" && "$(uname -m)" == "arm64" ]]; then hmex="bin/hmex_macos_arm64" xdelta="xdelta3" else - gc_fst="bin/gc_fst" - hgecko="bin/hgecko" - hmex="bin/hmex" + gc_fst="gc_fst" + if ! command -v gc_fst > /dev/null; then + gc_fst="bin/gc_fst" + fi + hgecko="hgecko" + if ! command -v hgecko > /dev/null; then + hgecko="bin/hgecko" + fi + hmex="hmex" + if ! command -v hmex > /dev/null; then + hmex="bin/hmex" + fi xdelta="xdelta3" fi diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..3d823729 --- /dev/null +++ b/flake.lock @@ -0,0 +1,594 @@ +{ + "nodes": { + "agenix": { + "inputs": { + "darwin": "darwin", + "home-manager": [ + "pineapple", + "home-manager" + ], + "nixpkgs": [ + "pineapple", + "ragenix", + "nixpkgs" + ], + "systems": "systems_6" + }, + "locked": { + "lastModified": 1761656077, + "narHash": "sha256-lsNWuj4Z+pE7s0bd2OKicOFq9bK86JE0ZGeKJbNqb94=", + "owner": "ryantm", + "repo": "agenix", + "rev": "9ba0d85de3eaa7afeab493fed622008b6e4924f5", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "catppuccin": { + "inputs": { + "nixpkgs": [ + "pineapple", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1779910193, + "narHash": "sha256-CQD/mtBC1VYQgTpKR6LhD+gPJ9S3neN6rBo/RYFWDgM=", + "owner": "catppuccin", + "repo": "nix", + "rev": "c61cab9677ff7184891930a60bf8224aa81c3a31", + "type": "github" + }, + "original": { + "owner": "catppuccin", + "repo": "nix", + "type": "github" + } + }, + "crane": { + "locked": { + "lastModified": 1760924934, + "narHash": "sha256-tuuqY5aU7cUkR71sO2TraVKK2boYrdW3gCSXUkF4i44=", + "owner": "ipetkov", + "repo": "crane", + "rev": "c6b4d5308293d0d04fcfeee92705017537cad02f", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "pineapple", + "ragenix", + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1744478979, + "narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "43975d782b418ebf4969e9ccba82466728c2851b", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "devkitNix": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1774111408, + "narHash": "sha256-eOKab4WYpdI+vsugJCwSSOKIpD/p4WkHRyHPhctWJbY=", + "owner": "bandithedoge", + "repo": "devkitNix", + "rev": "91653112a6b31870abf4394a3f7a6cd7d5d22fd9", + "type": "github" + }, + "original": { + "owner": "bandithedoge", + "repo": "devkitNix", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "pineapple", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1779969295, + "narHash": "sha256-HwIJ3tOcwSMiV75L7KqJXciXR9UfT+d7rwOZMX7cTnA=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "61e2c9659324181e0f0ed911958c536333b1d4f6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-index-database": { + "inputs": { + "nixpkgs": [ + "pineapple", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1779604987, + "narHash": "sha256-ZQ5z+fVhxYKtIFwtqGp5O0PD84BM1riASvqDaN5Xs+s=", + "owner": "Mic92", + "repo": "nix-index-database", + "rev": "8fba98c80b48fa013820e0163c5096922fea4ddd", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "nix-index-database", + "type": "github" + } + }, + "nix-minecraft": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "pineapple", + "nixpkgs" + ], + "systems": "systems_4" + }, + "locked": { + "lastModified": 1776071823, + "narHash": "sha256-jvmaBpr12HBeaJZRKfhexmVkk67foQAH3yrJ1gHU5SQ=", + "owner": "p1n3appl3", + "repo": "nix-minecraft", + "rev": "50d44c850bfd01d36727b3c7569ff62d9a851868", + "type": "github" + }, + "original": { + "owner": "p1n3appl3", + "ref": "lazymc", + "repo": "nix-minecraft", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1779826373, + "narHash": "sha256-3sRzgLX86qV5NlhWUAufLmHwkyP03tmL3VdZIM13dEo=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "ef4efb84766a166c906bd55759574676bf91267c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1782175435, + "narHash": "sha256-EMzXKmnOtBQ2MnvpiNOm7E+kOMvdPrIKaeg52Tip2Uk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "89570f24e97e614aa34aa9ab1c927b6578a43775", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1779796641, + "narHash": "sha256-ZsIrKmhp4vbBXoXXmR/tBXA/UCsAQiJL9vsgZEduhVY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "25f538306313eae3927264466c70d7001dcea1df", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "obs-gamepad": { + "inputs": { + "nixpkgs": [ + "pineapple", + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1760151712, + "narHash": "sha256-Xod+hqFnhok9rrSH42/2ON74S2Kp/EzgHDmffIbY6TQ=", + "owner": "p1n3appl3", + "repo": "obs-gamepad", + "rev": "42026f9c1496b7b263086468a3334bc72795ad56", + "type": "github" + }, + "original": { + "owner": "p1n3appl3", + "repo": "obs-gamepad", + "type": "github" + } + }, + "pineapple": { + "inputs": { + "catppuccin": "catppuccin", + "flake-utils": "flake-utils_3", + "home-manager": "home-manager", + "nix-index-database": "nix-index-database", + "nix-minecraft": "nix-minecraft", + "nixos-hardware": "nixos-hardware", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable", + "obs-gamepad": "obs-gamepad", + "ragenix": "ragenix", + "rahul-config": "rahul-config", + "slippi": "slippi" + }, + "locked": { + "lastModified": 1780707604, + "narHash": "sha256-JGiTEm1ecTuPVAcqwLlZii94vajg3L+t2fmJFwEgaqU=", + "owner": "p1n3appl3", + "repo": "config", + "rev": "6c3822de19c2e78970b1dda2b36a0ee884f3d90c", + "type": "github" + }, + "original": { + "owner": "p1n3appl3", + "repo": "config", + "type": "github" + } + }, + "ragenix": { + "inputs": { + "agenix": "agenix", + "crane": "crane", + "flake-utils": [ + "pineapple", + "flake-utils" + ], + "nixpkgs": [ + "pineapple", + "nixpkgs-stable" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1761832913, + "narHash": "sha256-VCNVjjuRvrKPiYYwqhE3BAKIaReiKXGpxGp27lZ0MFM=", + "owner": "yaxitech", + "repo": "ragenix", + "rev": "83bccfdea758241999f32869fb6b36f7ac72f1ac", + "type": "github" + }, + "original": { + "owner": "yaxitech", + "repo": "ragenix", + "type": "github" + } + }, + "rahul-config": { + "inputs": { + "agenix": [ + "pineapple" + ], + "darwin": [ + "pineapple" + ], + "flake-utils": [ + "pineapple", + "flake-utils" + ], + "home-manager": [ + "pineapple", + "home-manager" + ], + "impermanence": [ + "pineapple" + ], + "nix-index-database": [ + "pineapple", + "nix-index-database" + ], + "nixos-hardware": [ + "pineapple", + "nixos-hardware" + ], + "nixpkgs": [ + "pineapple", + "nixpkgs" + ], + "ragenix": [ + "pineapple" + ] + }, + "locked": { + "lastModified": 1732077156, + "narHash": "sha256-jVD02VoEr9T3xYI8hDtqR44PSEkuKcoHVAeJ+fyFGyY=", + "owner": "rrbutani", + "repo": "nix-config", + "rev": "6aec7854761a3a7cc5579ee23497456f7092a15e", + "type": "github" + }, + "original": { + "owner": "rrbutani", + "repo": "nix-config", + "type": "github" + } + }, + "root": { + "inputs": { + "devkitNix": "devkitNix", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs", + "pineapple": "pineapple" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "pineapple", + "ragenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1761791894, + "narHash": "sha256-myRIDh+PxaREz+z9LzbqBJF+SnTFJwkthKDX9zMyddY=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "59c45eb69d9222a4362673141e00ff77842cd219", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "slippi": { + "inputs": { + "git-hooks": [ + "pineapple" + ], + "home-manager": [ + "pineapple", + "home-manager" + ], + "nixpkgs": [ + "pineapple", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1779808405, + "narHash": "sha256-9e54diXDJNe5PqpnE76uW4DaivigG0gQYcD3AyUXKGY=", + "owner": "lytedev", + "repo": "slippi-nix", + "rev": "a81f4e08d7adf46c6fe5ffc6c8ead8e1fb35cb32", + "type": "github" + }, + "original": { + "owner": "lytedev", + "repo": "slippi-nix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_6": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems_5" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..fd0f50ea --- /dev/null +++ b/flake.nix @@ -0,0 +1,41 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + devkitNix.url = "github:bandithedoge/devkitNix"; + devkitNix.inputs.nixpkgs.follows = "nixpkgs"; + pineapple.url = "github:p1n3appl3/config"; + pineapple.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = + { + self, + nixpkgs, + flake-utils, + devkitNix, + pineapple, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ + devkitNix.overlays.default + pineapple.overlays.default + ]; + }; + in + { + devShells.default = pkgs.mkShell.override { stdenv = pkgs.devkitNix.stdenvPPC; } { + buildInputs = with pkgs; [ + gc-fst + hgecko + hmex + xdelta + ]; + }; + } + ); +}