Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a nix flake #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 60 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

172 changes: 172 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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
];
};
}
);
}