forked from Sceptre/sceptre
-
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.
add(1521) - Add nix flake, justfile, and direnv
- Loading branch information
Showing
4 changed files
with
137 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 |
---|---|---|
|
@@ -143,3 +143,5 @@ tags | |
|
||
# temp files | ||
temp/ | ||
/.direnv/ | ||
/.envrc |
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,50 @@ | ||
{ | ||
description = "Sceptre development environment"; | ||
|
||
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; | ||
}; | ||
in { | ||
devShells.default = pkgs.mkShell { | ||
# buildInputs = with pkgs; [ | ||
# poetry | ||
# ]; | ||
packages = with pkgs; [ | ||
nix-search-cli | ||
pre-commit | ||
just | ||
watchexec | ||
|
||
# Make sure nix works within the shell | ||
nixStatic | ||
|
||
# Python | ||
poetry | ||
python3 | ||
|
||
# Other packages needed for compiling python libs | ||
readline | ||
libffi | ||
openssl | ||
glibcLocalesUtf8 | ||
]; | ||
|
||
shellHook = '' | ||
poetry env use $(which python3) | ||
poetry install | ||
. $(poetry env info -p)/bin/activate | ||
''; | ||
}; | ||
}); | ||
} |
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,24 @@ | ||
_default: | ||
@just --list | ||
|
||
# Enable direnv | ||
enable-direnv: | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
[ -f ".envrc" ] && echo ".envrc already exists" && exit | ||
echo "use flake" >.envrc | ||
# Re-run recipe CMD whenever files change | ||
watch CMD *ARGS: | ||
watchexec -c -r -d 500ms --print-events -- just {{CMD}} {{ARGS}} | ||
alias w := watch | ||
|
||
# Run tests via tox | ||
test *ARGS: | ||
poetry run tox {{ARGS}} | ||
alias t := test | ||
|
||
# Run a single test | ||
a-test TEST *ARGS: | ||
poetry run pytest -ssv {{TEST}} {{ARGS}} | ||
alias tt := a-test |