-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔧 Add flake.nix for creating dev shells with nix. (#1253)
This enables user with nix installed to work on pyglotaran. The flake creates a shell with python 3.10 and virtualenv installed and installs all dependencies on first creation.
- Loading branch information
1 parent
356b934
commit 6a984fb
Showing
4 changed files
with
99 additions
and
0 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 |
---|---|---|
|
@@ -13,6 +13,8 @@ pyvenv.cfg | |
/.venv* | ||
/venv* | ||
/.env/ | ||
/.direnv/ | ||
.envrc | ||
|
||
# sensitive environment variables | ||
.env | ||
|
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,52 @@ | ||
{ | ||
inputs = { | ||
nixpkgs = { | ||
url = "github:nixos/nixpkgs/nixos-unstable"; | ||
}; | ||
flake-utils = { | ||
url = "github:numtide/flake-utils"; | ||
}; | ||
}; | ||
outputs = { nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
}; | ||
python = pkgs.python310; | ||
lib-path = with pkgs; lib.makeLibraryPath [ | ||
stdenv.cc.cc | ||
]; | ||
|
||
|
||
in | ||
rec { | ||
devShell = pkgs.mkShell { | ||
buildInputs = with pkgs; [ | ||
python | ||
pre-commit | ||
(python3.withPackages (ps: with ps; [ | ||
virtualenvwrapper | ||
])) | ||
]; | ||
shellHook = '' | ||
# Augment the dynamic linker path | ||
export "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${lib-path}" | ||
# Setup the virtual environment if it doesn't already exist. | ||
VENV=.venv | ||
if test ! -d $VENV; then | ||
virtualenv $VENV | ||
# Install Python dependencies | ||
pip install -r requirements_dev.txt | ||
pip install -e . | ||
fi | ||
source ./$VENV/bin/activate | ||
export PYTHONPATH=`pwd`/$VENV/${python.sitePackages}/:$PYTHONPATH | ||
pre-commit install | ||
''; | ||
|
||
}; | ||
} | ||
); | ||
} |
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