1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-04 02:24:12 +02:00
This commit is contained in:
Robin Appelman 2024-05-06 15:16:48 +02:00
commit 4e6d6e4b3a
5 changed files with 39 additions and 14 deletions

27
nix/codegen.nix Normal file
View file

@ -0,0 +1,27 @@
{
stdenv,
rustPlatform,
lib,
}: let
inherit (lib.sources) sourceByRegex;
src = sourceByRegex ../. ["Cargo.*" "(src|benches)(/.*)?"];
in
rustPlatform.buildRustPackage {
pname = "demostf-parser-codegen";
version = "0.1.0";
cargoBuildFlags = ''
--bin codegen
'';
src = lib.traceVal src;
buildType = "debug";
buildFeatures = ["codegen"];
doCheck = false;
cargoLock = {
lockFile = ../Cargo.lock;
};
}

12
nix/overlay.nix Normal file
View file

@ -0,0 +1,12 @@
final: prev: {
demostf-parser = final.callPackage ./parser.nix {};
demostf-parser-codegen = final.callPackage ./codegen.nix {};
demostf-parser-codegen-events = final.runCommand "gameevent_gen.rs" {} ''
${final.demostf-parser-codegen}/bin/codegen ${../test_data/short-2024.dem} events > $out
${final.rustfmt}/bin/rustfmt $out
'';
demostf-parser-codegen-props = final.runCommand "sendprop_gen.rs" {} ''
${final.demostf-parser-codegen}/bin/codegen ${../test_data/short-2024.dem} props > $out
${final.rustfmt}/bin/rustfmt $out
'';
}

24
nix/parser.nix Normal file
View file

@ -0,0 +1,24 @@
{
stdenv,
rustPlatform,
lib,
}: let
inherit (lib.sources) sourceByRegex;
src = sourceByRegex ../. ["Cargo.*" "(src|benches|tests|test_data)(/.*)?"];
in
rustPlatform.buildRustPackage rec {
pname = "demostf-parser";
version = "0.1.0";
cargoBuildFlags = ''
--bin parse_demo
'';
inherit src;
doCheck = stdenv.system == "x86_64-linux"; # building the tests takes +- forever on aarch64 for some reason
cargoLock = {
lockFile = ../Cargo.lock;
};
}

27
nix/schema.nix Normal file
View file

@ -0,0 +1,27 @@
{
stdenv,
rustPlatform,
lib,
}: let
inherit (lib.sources) sourceByRegex;
src = sourceByRegex ../. ["Cargo.*" "(src|benches)(/.*)?"];
in
rustPlatform.buildRustPackage {
pname = "demostf-parser-schema";
version = "0.1.0";
cargoBuildFlags = ''
--bin schema
'';
src = lib.traceVal src;
buildType = "debug";
buildFeatures = ["schema"];
doCheck = false;
cargoLock = {
lockFile = ../Cargo.lock;
};
}