rewrite-in-python: more nix validation, fix eval warning
This commit is contained in:
38
flake.nix
38
flake.nix
@@ -16,13 +16,12 @@
|
||||
inherit (nixpkgs) lib;
|
||||
|
||||
in {
|
||||
apps = forAllSystems (system: pkgs: let
|
||||
mkApp = package: {
|
||||
apps = forAllSystems (system: pkgs: {
|
||||
default = {
|
||||
type = "app";
|
||||
program = lib.getExe package;
|
||||
program = lib.getExe self.packages.${system}.default;
|
||||
meta.description = "The 'mckart' cli tool with all map data embedded";
|
||||
};
|
||||
in {
|
||||
default = mkApp self.packages.${system}.default;
|
||||
});
|
||||
|
||||
devShells = forAllSystems (_: pkgs: {
|
||||
@@ -40,6 +39,8 @@
|
||||
overlays.default = final: prev: self.packages.${final.system};
|
||||
|
||||
checks = forAllSystems (system: pkgs: {
|
||||
inherit (self.packages.${system}) bluemap-export mapcrafter-export;
|
||||
|
||||
hocon-include = let
|
||||
format = pkgs.formats.hocon { };
|
||||
in format.generate "minecraft-kartverket-test-hocon-include" {
|
||||
@@ -69,10 +70,33 @@
|
||||
meta.mainProgram = "mckart";
|
||||
};
|
||||
|
||||
bluemap-export = pkgs.runCommand "bluemap-export" {
|
||||
buildInputs = [ (self.packages.${system}.mckart) ];
|
||||
bluemap-export = let
|
||||
# from pkgs/pkgs-lib/formats/hocon/default.nix
|
||||
hocon-validator =
|
||||
pkgs.writers.writePython3Bin "hocon-validator"
|
||||
{
|
||||
libraries = [ pkgs.python3Packages.pyhocon ];
|
||||
}
|
||||
''
|
||||
from sys import argv
|
||||
from pyhocon import ConfigFactory
|
||||
|
||||
if not len(argv) == 2:
|
||||
print("USAGE: hocon-validator <file>")
|
||||
|
||||
ConfigFactory.parse_file(argv[1])
|
||||
'';
|
||||
in pkgs.runCommand "bluemap-export" {
|
||||
nativeBuildInputs = [
|
||||
(self.packages.${system}.mckart)
|
||||
hocon-validator
|
||||
];
|
||||
} ''
|
||||
mckart export-bluemap --output-dir "$out"
|
||||
|
||||
for file in "$out"/*.hocon; do
|
||||
hocon-validator "$file"
|
||||
done
|
||||
'';
|
||||
|
||||
mapcrafter-export = pkgs.runCommand "mapcrafter-export" {
|
||||
|
||||
Reference in New Issue
Block a user