1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-03 10:14:06 +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

View file

@ -24,7 +24,7 @@
in (eachDefaultSystem (system: let in (eachDefaultSystem (system: let
overlays = [ overlays = [
(import rust-overlay) (import rust-overlay)
(import ./overlay.nix) (import ./nix/overlay.nix)
]; ];
pkgs = (import nixpkgs) { pkgs = (import nixpkgs) {
inherit system overlays; inherit system overlays;
@ -156,7 +156,7 @@
}; };
}) })
// { // {
overlays.default = import ./overlay.nix; overlays.default = import ./nix/overlay.nix;
hydraJobs = eachSystem ["x86_64-linux" "aarch64-linux"] (system: { hydraJobs = eachSystem ["x86_64-linux" "aarch64-linux"] (system: {
parser = self.packages.${system}.demostf-parser; parser = self.packages.${system}.demostf-parser;
}); });

View file

@ -4,12 +4,16 @@
lib, lib,
}: let }: let
inherit (lib.sources) sourceByRegex; inherit (lib.sources) sourceByRegex;
src = sourceByRegex ./. ["Cargo.*" "(src|benches)(/.*)?"]; src = sourceByRegex ../. ["Cargo.*" "(src|benches)(/.*)?"];
in in
rustPlatform.buildRustPackage { rustPlatform.buildRustPackage {
pname = "demostf-parser-codegen"; pname = "demostf-parser-codegen";
version = "0.1.0"; version = "0.1.0";
cargoBuildFlags = ''
--bin codegen
'';
src = lib.traceVal src; src = lib.traceVal src;
buildType = "debug"; buildType = "debug";
@ -18,9 +22,6 @@ in
doCheck = false; doCheck = false;
cargoLock = { cargoLock = {
lockFile = ./Cargo.lock; lockFile = ../Cargo.lock;
outputHashes = {
"schemars-0.8.16" = "sha256-mQR56Ym76gSRulZrThmZHHw2JfhEgYhWXabwaYmyMYs=";
};
}; };
} }

View file

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

View file

@ -4,7 +4,7 @@
lib, lib,
}: let }: let
inherit (lib.sources) sourceByRegex; inherit (lib.sources) sourceByRegex;
src = sourceByRegex ./. ["Cargo.*" "(src|benches|tests|test_data)(/.*)?"]; src = sourceByRegex ../. ["Cargo.*" "(src|benches|tests|test_data)(/.*)?"];
in in
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
pname = "demostf-parser"; pname = "demostf-parser";
@ -19,9 +19,6 @@ in
doCheck = stdenv.system == "x86_64-linux"; # building the tests takes +- forever on aarch64 for some reason doCheck = stdenv.system == "x86_64-linux"; # building the tests takes +- forever on aarch64 for some reason
cargoLock = { cargoLock = {
lockFile = ./Cargo.lock; lockFile = ../Cargo.lock;
outputHashes = {
"schemars-0.8.16" = "sha256-mQR56Ym76gSRulZrThmZHHw2JfhEgYhWXabwaYmyMYs=";
};
}; };
} }

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;
};
}