Skip to content

Commit

Permalink
feat: Add Nix support
Browse files Browse the repository at this point in the history
  • Loading branch information
l0b0 committed Sep 23, 2024
1 parent 77c1e1b commit 0c943a7
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
*.pyc
__pycache__
/.pytest_cache/
/python
Thumbs.db
/.vscode/
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,41 @@ repos:
stages: [commit]
types: [python]

- id: deadnix
name: deadnix
entry: deadnix
args: [--edit, --fail]
files: \.nix$
language: system
stages: [commit]

- id: isort
name: isort
entry: isort
language: system
stages: [commit]
types: [python]

- id: nixfmt
name: nixfmt
entry: nixfmt
files: \.nix$
language: system
stages: [commit]

- id: pylint
name: pylint
entry: pylint
language: system
stages: [commit]
types: [python]
require_serial: true

- id: statix
name: statix
entry: statix
args: [check]
files: \.nix$
pass_filenames: false
language: system
stages: [commit]
32 changes: 32 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
let
pkgs = import (builtins.fetchTarball {
name = "nixos-unstable-2024-09-17";
url = "https://github.com/nixos/nixpkgs/archive/345c263f2f53a3710abe117f28a5cb86d0ba4059.tar.gz";
sha256 = "1llzyzw7a0jqdn7p3px0sqa35jg24v5pklwxdybwbmbyr2q8cf5j";
}) { overlays = [ (_final: prev: { geos = prev.geos_3_11; }) ]; };
poetry2nix = import (builtins.fetchTarball {
url = "https://github.com/nix-community/poetry2nix/archive/2024.9.1542864.tar.gz";
sha256 = "06vz5hwylvjvx4ywbv4y3kadq8zxmvpf5h7pjy6w1yhkwpjd6k25";
}) { inherit pkgs; };
poetryPackages = poetry2nix.mkPoetryPackages {
projectDir = builtins.path {
path = ./.;
name = "python-linz-logger";
};
};
in
pkgs.mkShell {
packages = [
pkgs.bashInteractive
pkgs.poetry
pkgs.deadnix
pkgs.nixfmt-rfc-style
pkgs.statix
poetryPackages.poetryPackages
poetryPackages.python.pkgs.pip # For IDEA package resolution
poetryPackages.python.pkgs.setuptools # For IDEA package resolution
];
shellHook = ''
ln --force --no-target-directory --symbolic "${poetryPackages.python}/bin/python" python
'';
}

0 comments on commit 0c943a7

Please sign in to comment.