generated from linz/template-python-hello-world
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Install and enable Direnv to activate it when `cd`-ing into the project - Cache Python packages in CI using the "linz" repository - Lint and format the Nix code - Create a symlink to the Python executable for easy IDE integration
- Loading branch information
Showing
5 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
watch_file poetry.lock pyproject.toml | ||
use nix | ||
ln --force --no-target-directory --symbolic "$(which python)" python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
*.pyc | ||
__pycache__ | ||
/.pytest_cache | ||
/python | ||
Thumbs.db | ||
/.venv | ||
/.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
let | ||
pkgs = import (builtins.fetchTarball { | ||
name = "nixos-unstable-2024-06-05"; | ||
url = "https://github.com/nixos/nixpkgs/archive/57610d2f8f0937f39dbd72251e9614b1561942d8.tar.gz"; | ||
sha256 = "0k8az8vmfdk1n8xlza252sqk0hm1hfc7g67adin6jxqaab2s34n9"; | ||
}) { }; | ||
poetry2nix = import (builtins.fetchTarball { | ||
name = "poetry2nix-2024.6.557458"; | ||
url = "https://github.com/nix-community/poetry2nix/archive/81662ae1ad31491eae3bb1d976fb74c71853bc63.tar.gz"; | ||
sha256 = "1zvlhzlc7mxr74qii3mkyn4iyd5rdivrm40yf7r7jvj9ry5gnbx9"; | ||
}) { inherit pkgs; }; | ||
poetryPackages = poetry2nix.mkPoetryPackages { | ||
projectDir = ./.; | ||
overrides = poetry2nix.overrides.withDefaults ( | ||
self: super: { | ||
types-shapely = super.types-shapely.overridePythonAttrs (old: { | ||
propagatedBuildInputs = old.propagatedBuildInputs or [ ] ++ [ self.setuptools ]; | ||
}); | ||
} | ||
); | ||
}; | ||
pythonWithPackages = poetryPackages.python.withPackages (_ps: poetryPackages.poetryPackages); | ||
in | ||
pkgs.mkShell { | ||
packages = [ | ||
pythonWithPackages | ||
pkgs.bashInteractive | ||
pkgs.cacert | ||
pkgs.deadnix | ||
(pkgs.gdal.override { geos = pkgs.geos_3_11; }) | ||
pkgs.gitFull | ||
pkgs.nixfmt-rfc-style | ||
pkgs.nodejs | ||
pkgs.poetry | ||
pkgs.statix | ||
pkgs.which | ||
]; | ||
shellHook = '' | ||
ln --force --no-target-directory --symbolic "${pkgs.lib.getExe pythonWithPackages}" python | ||
''; | ||
} |