diff --git a/README.md b/README.md index d205cd98..3ad312e2 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,8 @@ If the system does not already have Python 3.11 or higher, install it explicitly sudo dnf install python3.11 ``` +If Nix or NixOS is installed, `nix develop` can be used to be dropped into a development shell which can run APT without venv. + ## Setup APT Create a new virtual environment diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..c9e9b980 --- /dev/null +++ b/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1727374820, + "narHash": "sha256-NvOudjGphnrRykpF5E41M8bKyPX5O8QcyVk7+K29mw4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d1b1ae077108738cb948e78e634b5d30217bcc72", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..c45e8372 --- /dev/null +++ b/flake.nix @@ -0,0 +1,172 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = + { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages."${system}".extend ( + pkgs: prev: with pkgs; { + pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [ + ( + pythonFinal: pythonPrev: with pythonFinal; { + protobuf = protobuf5; + + click803 = click.overrideAttrs ( + f: p: { + version = "8.0.3"; + + src = fetchPypi { + inherit (f) pname version; + sha256 = "sha256-QQ6TKwUPXu13PEzalN51lxyJzbMVWnKggxE5p55ey1s="; + }; + + doInstallCheck = false; + } + ); + + proto-plus = pythonPrev.proto-plus.overrideAttrs ( + f: p: { + version = "1.24.0"; + + src = fetchFromGitHub { + owner = "googleapis"; + repo = "proto-plus-python"; + rev = "v${f.version}"; + hash = "sha256-pTbraH2l9AH2sODi3Zd1A2IBkiU8aHVVTSa/h7i0m28="; + }; + } + ); + + grpc-google-iam-v1 = pythonPrev.grpc-google-iam-v1.overrideAttrs ( + f: p: { + version = "0.13.1"; + + src = fetchFromGitHub { + owner = "googleapis"; + repo = "python-grpc-google-iam-v1"; + rev = "v${f.version}"; + hash = "sha256-FLDx2zbM0qqLa+k/7xexyv5/YHlSOdikrbU2eYbxDM0="; + }; + } + ); + + google-api-core = pythonPrev.google-api-core.overrideAttrs ( + f: p: { + version = "2.20.0"; + + src = fetchFromGitHub { + owner = "googleapis"; + repo = "python-api-core"; + rev = "v${f.version}"; + hash = "sha256-ccjkGQNaPRefI6+j/O+NwdBGEVNuZ5q5m1d8EAJGcbs="; + }; + } + ); + + google-cloud-kms = pythonPrev.google-cloud-kms.overrideAttrs ( + f: p: { + version = "3.0.0"; + + src = fetchFromGitHub { + owner = "googleapis"; + repo = "google-cloud-python"; + rev = "google-cloud-kms-v${f.version}"; + hash = "sha256-R6anDMiK5nrXapWYyAS9IaQAhmfA5bO8LEliftWKjAw="; + }; + + sourceRoot = "source/packages/google-cloud-kms"; + } + ); + + google-cloud-bigquery = pythonPrev.google-cloud-bigquery.overrideAttrs ( + f: p: { doInstallCheck = false; } + ); + + google-auth-oauthlib = pythonPrev.google-auth-oauthlib.override { click = click803; }; + + google-cloud-testutils = pythonPrev.google-cloud-testutils.override { click = click803; }; + } + ) + ]; + } + ); + in + { + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + (python312.withPackages ( + pythonPackages: with pythonPackages; [ + absl-py + beautifulsoup4 + blinker + contextlib2 + colorama + click803 + (colorlog.overrideAttrs ( + f: p: { + version = "2.6.0"; + + src = fetchPypi { + inherit (f) pname version; + sha256 = "sha256-DwOuASihrC4i7GpmF++9NqsA1LLhxJxJfhGFTPJPH+k="; + }; + + doInstallCheck = false; + } + )) + (buildPythonPackage rec { + pname = "google-cloud-aiplatform"; + version = "1.68.0"; + format = "setuptools"; + + src = fetchPypi { + inherit pname version; + sha256 = "sha256-106fM3B8ehTGoyp8/prNMrkJdd+6n6xIfRBci6UZf0A="; + }; + + propagatedBuildInputs = [ + docstring-parser + google-cloud-bigquery + google-cloud-resource-manager + google-cloud-storage + pydantic + shapely + ]; + }) + google-cloud-core + google-cloud-datastore + google-cloud-monitoring + jinja2 + loguru + numpy + pandas + pint + ptyprocess + (python-dotenv.override { click = click803; }) + pytz + pywinrm + pyyaml + seaborn + setuptools + six + tabulate + timeout-decorator + ] + )) + google-cloud-sdk + openssl + stdenv.cc.cc.lib + ]; + }; + } + ); +}