diff --git a/flake.nix b/flake.nix index 6f51f75..ca8ee8b 100644 --- a/flake.nix +++ b/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 ") + + 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" {