diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c21cf39 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1742546557, + "narHash": "sha256-QyhimDBaDBtMfRc7kyL28vo+HTwXRPq3hz+BgSJDotw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "bfa9810ff7104a17555ab68ebdeafb6705f129b1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index e7784aa..1f8c456 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,70 @@ { - 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; [])) + ]; + }; + }); + + 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) ]; + } '' + mckart export-mapcrafter --output-dir "$out" + ''; + }); }; }