rewrite to python: redo nix packaging
This commit is contained in:
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1762482733,
|
||||
"narHash": "sha256-g/da4FzvckvbiZT075Sb1/YDNDr+tGQgh4N8i5ceYMg=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e1ebeec86b771e9d387dd02d82ffdc77ac753abc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
85
flake.nix
85
flake.nix
@@ -1,7 +1,84 @@
|
||||
{
|
||||
inputs = { };
|
||||
outputs = inputs@{ self, ...}: {
|
||||
map-markers = import ./map-markers;
|
||||
map-lib = import ./map-markers/lib.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
|
||||
'';
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user