-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from cgahr/nix
add a nix environment to ensure a reproducible build
- Loading branch information
Showing
6 changed files
with
213 additions
and
11 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,2 @@ | ||
watch_file pyproject.toml | ||
use flake |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.envrc | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,56 @@ | ||
{ | ||
description = "A very basic flake"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; | ||
|
||
pyproject-nix = { | ||
url = "github:nix-community/pyproject.nix"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
|
||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = | ||
{ | ||
self, | ||
nixpkgs, | ||
pyproject-nix, | ||
flake-utils, | ||
}: | ||
flake-utils.lib.eachDefaultSystem ( | ||
system: | ||
let | ||
pkgs = import nixpkgs { inherit system; }; | ||
|
||
project = pyproject-nix.lib.project.loadPyproject { projectRoot = ./.; }; | ||
python = pkgs.python312; | ||
in | ||
{ | ||
devShells.default = | ||
let | ||
attrs = project.renderers.withPackages { | ||
inherit python; | ||
extras = [ "tests" ]; | ||
extraPackages = python-pkgs: [ python-pkgs.ipykernel ]; | ||
}; | ||
pythonEnv = python.withPackages attrs; | ||
in | ||
pkgs.mkShell { | ||
packages = | ||
[ pythonEnv ] | ||
++ (with pkgs; [ | ||
ruff | ||
pre-commit | ||
rustc # for pre-commit ruff | ||
cargo # for pre-commit ruff | ||
]); | ||
shellHook = '' | ||
export PYTHONPATH="$(pwd)/src" | ||
export PIP_NO_BINARY="ruff" | ||
''; | ||
}; | ||
} | ||
); | ||
} |