81 lines
2.4 KiB
Nix
81 lines
2.4 KiB
Nix
{
|
|
description = "test stuff for fox32";
|
|
|
|
inputs = {
|
|
fox32asm.url = "git+file:../fox32asm";
|
|
fox32.url = "git+file:../fox32";
|
|
fox32rom.url = "git+file:../fox32rom";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, fox32asm, fox32, fox32rom, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (sys:
|
|
let pkgs = import nixpkgs { system = sys; };
|
|
asm = fox32asm.packages.${sys}.fox32asm;
|
|
emulator = fox32.packages.${sys}.fox32;
|
|
romdev = fox32rom.packages.${sys}.fox32rom-dev;
|
|
py = pkgs.python310;
|
|
|
|
ultlf = pkgs.stdenv.mkDerivation {
|
|
name = "ultlf";
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "ultlang"; repo = "ultlf";
|
|
rev = "9b867a6cd04a2daf6d44ab9731ecf426d535a8a2";
|
|
hash = "sha256-Y7WrkvC+GNZluqzIuXm/2WIlFj/nvJNWTXU6gCvOf5E=";
|
|
};
|
|
dontBuild = true;
|
|
installPhase = ''
|
|
mkdir -p $out/data
|
|
cp ultlf-data/{codepoints.json,trimmed_baselines.json,data.json} $out/data
|
|
'';
|
|
};
|
|
|
|
rom = pkgs.stdenv.mkDerivation rec {
|
|
pname = "xen32";
|
|
version = "0.0-alpha";
|
|
|
|
src = ./. ;
|
|
|
|
buildPhase = ''
|
|
mkdir -p inc
|
|
mkdir -p xenrom/data
|
|
cp ${romdev}/dev/fox32rom.def inc
|
|
mkdir -p ultlf
|
|
cp ${ultlf}/data/* ultlf
|
|
|
|
mkdir -p $out/bin/
|
|
${py}/bin/python3 ./gen/fontgen.py
|
|
${py}/bin/python3 ./gen/logogen.py
|
|
${py}/bin/python3 ./gen/vergen.py
|
|
${asm}/bin/fox32asm xenrom/main.asm $out/bin/xen32.rom
|
|
'';
|
|
|
|
NIX_SEMVER = version;
|
|
NIX_GIT_SHA_SHORT = if self ? rev then builtins.substring 0 7 self.rev else "dirty";
|
|
};
|
|
|
|
in rec {
|
|
packages.rom = rom;
|
|
|
|
packages.run = pkgs.writeScriptBin "xen32-run" ''
|
|
${emulator}/bin/fox32 --rom ${packages.rom}/bin/xen32.rom
|
|
'';
|
|
|
|
packages.ultlf = ultlf;
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
packages = [ asm emulator py ];
|
|
shellHook = ''
|
|
mkdir -p inc
|
|
mkdir -p xenrom/data
|
|
cp ${romdev}/dev/fox32rom.def inc
|
|
mkdir -p ultlf
|
|
cp ${ultlf}/data/* ultlf
|
|
${py}/bin/python3 ./gen/fontgen.py
|
|
${py}/bin/python3 ./gen/logogen.py
|
|
'';
|
|
};
|
|
}
|
|
);
|
|
}
|