85 lines
2.1 KiB
Nix
85 lines
2.1 KiB
Nix
{
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
|
|
outputs = { self, nixpkgs }: let
|
|
systems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-darwin"
|
|
];
|
|
|
|
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in f system pkgs);
|
|
|
|
inherit (nixpkgs) lib;
|
|
|
|
in {
|
|
apps = forAllSystems (system: pkgs: let
|
|
mkApp = package: {
|
|
type = "app";
|
|
program = lib.getExe package;
|
|
};
|
|
in {
|
|
default = mkApp self.packages.${system}.default;
|
|
});
|
|
|
|
devShells = forAllSystems (_: pkgs: {
|
|
default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
uv
|
|
(python3.withPackages (ps: with ps; []))
|
|
biome
|
|
];
|
|
};
|
|
});
|
|
|
|
overlays.default = final: prev: self.packages.${final.system};
|
|
|
|
packages = forAllSystems (system: pkgs: {
|
|
default = self.packages.${system}.mckart;
|
|
|
|
mckart = let
|
|
pyproject = builtins.fromTOML (builtins.readFile ./pyproject.toml);
|
|
in with pkgs.python3Packages; buildPythonPackage {
|
|
pname = pyproject.project.name;
|
|
version = pyproject.project.version;
|
|
src = lib.cleanSource ./.;
|
|
|
|
format = "pyproject";
|
|
|
|
build-system = [ hatchling ];
|
|
dependencies = [];
|
|
|
|
meta.mainProgram = "mckart";
|
|
};
|
|
|
|
bluemap-export = pkgs.runCommand "bluemap-export" {
|
|
buildInputs = [ (self.packages.${system}.mckart) ];
|
|
} ''
|
|
mckart export-bluemap --output-dir "$out"
|
|
'';
|
|
|
|
mapcrafter-export = pkgs.runCommand "mapcrafter-export" {
|
|
buildInputs = [
|
|
(self.packages.${system}.mckart)
|
|
pkgs.biome
|
|
];
|
|
|
|
biomeConf = builtins.toJSON {
|
|
formatter = {
|
|
indentStyle = "space";
|
|
lineWidth = 100;
|
|
};
|
|
};
|
|
passAsFile = [ "biomeConf" ];
|
|
} ''
|
|
mckart export-mapcrafter --output-dir "$out"
|
|
cp "$biomeConfPath" ./biome.json
|
|
biome format --config-path=./biome.json "$out"/* --write
|
|
'';
|
|
});
|
|
};
|
|
}
|