commit 350b8ba0ef5eb104470f423b373b83bc35dd487b Author: Simon Bruder Date: Sat Aug 7 10:55:03 2021 +0200 init diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..305264a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.pre-commit-config.yaml +result* diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7382217 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +The MIT License +Copyright 2021 Simon Bruder + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..0850212 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# pokegb-nix + +A nixpkgs overlay for compiling/assembling Game Boy Pokémon ROMs. + +## Usage + +If you have a Nix version with flake support, simply run a command like this: + +```bash +nix build ".#pokegb/red" # builds Pokémon Red/Blue +nix build ".#pokegb/all" # builds all ROMs into one directory +``` + +For the legacy Nix UI you can use a command like this: + +```bash +nix-build -E 'import { overlays = [ (import ./default.nix) ]; }' -A pokegb.red +``` + +If you do not allow unfree packages globally, you might have to run the command +with the environment variable `NIXPKGS_ALLOW_UNFREE=1` set. + +You can find a list of all packages provided by this overlay in `default.nix`. + +## License + +[The MIT License](./LICENSE) + +This only applies to the package expressions, not the built packages. Patches +may also be licensed differently, since they may be derivative works of the +packages to which they apply. + +##### Disclaimer + +This project is not affiliated with Nintendo or any of its subsidiaries. +Pokémon is a registered trademark of Nintendo. diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..ce16870 --- /dev/null +++ b/default.nix @@ -0,0 +1 @@ +final: prev: { } diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c619b96 --- /dev/null +++ b/flake.lock @@ -0,0 +1,68 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1623875721, + "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nix-pre-commit-hooks": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1624971177, + "narHash": "sha256-Amf/nBj1E77RmbSSmV+hg6YOpR+rddCbbVgo5C7BS0I=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "397f0713d007250a2c7a745e555fa16c5dc8cadb", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "master", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1628280432, + "narHash": "sha256-bqwbY8NtJ2S7RXJpYK0Xw0vMZRzmxS5KmSWIb0g7/Ts=", + "owner": "sbruder", + "repo": "nixpkgs", + "rev": "bf6d934cf80e6f5365d3193e01840397709d4d87", + "type": "github" + }, + "original": { + "owner": "sbruder", + "ref": "update-rgbds", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nix-pre-commit-hooks": "nix-pre-commit-hooks", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e0bf6bc --- /dev/null +++ b/flake.nix @@ -0,0 +1,50 @@ +{ + description = "A nixpkgs overlay for compiling/assembling Game Boy Pokémon ROMs"; + + inputs = { + # Until https://github.com/NixOS/nixpkgs/pull/132928 gets merged, this fork + # has to be used because the ROMs require rgbds 0.5.1. + nixpkgs.url = "github:sbruder/nixpkgs/update-rgbds"; + + flake-utils.url = "github:numtide/flake-utils"; + + nix-pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix/master"; + nix-pre-commit-hooks.inputs.flake-utils.follows = "flake-utils"; + nix-pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, nixpkgs, flake-utils, nix-pre-commit-hooks }: + let + inherit (nixpkgs) lib; + in + { + overlay = import ./default.nix; + } // (flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ self.overlay ]; + config = { + allowUnfree = true; + }; + }; + in + rec { + checks = { + pre-commit-check = nix-pre-commit-hooks.lib.${system}.run { + src = self; + hooks = { + nixpkgs-fmt.enable = true; + }; + }; + }; + + devShell = pkgs.mkShell { + inherit (self.checks.${system}.pre-commit-check) shellHook; + }; + + packages = flake-utils.lib.flattenTree { + inherit (pkgs); + }; + })); +}