This commit is contained in:
Thorn Avery 2024-01-18 15:17:19 +13:00
parent 391ff620a1
commit 2c74025bfb
3 changed files with 120 additions and 0 deletions

1
.envrc Executable file
View file

@ -0,0 +1 @@
use flake .

61
flake.lock Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1697957990,
"narHash": "sha256-LlyEQ4z1immaiZV+MQMUXM3KpNoRY/xZVm8mmN5j3yg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b3ddf9649fdac7db15aeea95cb3114c13594d265",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-23.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

58
flake.nix Normal file
View file

@ -0,0 +1,58 @@
{
description = "Kanto Expansion Pack Romhack";
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05;
flake-utils.url = github:numtide/flake-utils;
};
outputs = { self, nixpkgs, flake-utils, ... }:
let
kepDerivation = { stdenv, src, pkgs,
make ? pkgs.gnumake,
gcc ? pkgs.gcc,
rgbds ? pkgs.rgbds,
files ? ["*.*gb*"],
# python3 ? pkgs.python3,
}: stdenv.mkDerivation rec {
src = ./.;
name = "kep-hack";
buildInputs = [ rgbds gcc make ];
installPhase = ''
shopt -s extglob
mkdir $out
${builtins.concatStringsSep "\n" (map (item:
if builtins.isList item && (builtins.length item == 2)
then "mv ${builtins.elemAt item 0} $out/${builtins.elemAt item 1}"
else "cp ${item}* $out"
) files)}
'';
};
in flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { inherit system; overlays = [self.overlays.default]; };
in {
packages = {
default = pkgs.kep-hack;
kep-hack = pkgs.kep-hack;
};
devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
rgbds
gcc
gnumake
sameboy
imagemagick
];
};
};
}) // {
overlays = {
default = final: prev: {
kep-hack = final.callPackage kepDerivation {
files = [
["kep.gbc" "kanto-expansion-pak.gbc"]
];
};
};
};
};
}