commit 3dee9bf679359d09f1c1f61f61b987bd69a7f8c2 Author: Kristian Krsnik Date: Wed Apr 23 20:53:49 2025 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..56f543a --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# Nix # +/result + +# balatromobile # +/balatro*.apk diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..cf8b1a9 --- /dev/null +++ b/default.nix @@ -0,0 +1,21 @@ +{ + fetchgit, + python3Packages, + jdk, + ... +}: let + src = fetchgit { + url = "https://github.com/antipatico/balatromobile"; + sha256 = "P6MVmDiI6NLHqBYdkbtqExHKjkjLeD5bE/kTEyPxVTw="; + fetchLFS = true; + }; + pname = (builtins.fromTOML (builtins.readFile "${src}/pyproject.toml")).project.name; + version = builtins.elemAt (builtins.match ".*([0-9]+\.[0-9]+\.[0-9]+).*" (builtins.readFile "${src}/balatromobile/__version__.py")) 0; +in + python3Packages.buildPythonPackage { + inherit pname version src; + + pyproject = true; + build-system = [python3Packages.flit]; + dependencies = [python3Packages.tabulate jdk]; + } diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..3399aa8 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1745234285, + "narHash": "sha256-GfpyMzxwkfgRVN0cTGQSkTC0OHhEkv3Jf6Tcjm//qZ0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c11863f1e964833214b767f4a369c6e6a7aba141", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..51e7662 --- /dev/null +++ b/flake.nix @@ -0,0 +1,32 @@ +{ + description = "A Python Project Template."; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = { + self, + nixpkgs, + ... + } @ inputs: let + supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); + in { + # `nix build` + packages = forAllSystems (system: rec { + default = balatromobile; + balatromobile = pkgs.${system}.callPackage ./default.nix {}; + }); + + # `nix run` + apps = forAllSystems (system: rec { + default = balatromobile; + balatromobile = { + program = "${self.packages.${system}.balatromobile}/bin/balatromobile"; + type = "app"; + }; + }); + }; +}