File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ use flake ./tools/nix --no-pure-eval
Original file line number Diff line number Diff line change 1+ on :
2+ pull_request_target :
3+ paths :
4+ - ' **.nix'
5+ steps :
6+ - uses : actions/checkout@v3
7+ - name : Install Nix
8+ uses : cachix/install-nix-action@v17
9+ with :
10+ extra_nix_config : |
11+ access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
12+ - name : Build dev shell
13+ run : nix develop --no-pure-eval --accept-flake-config "./tools/nix" --command "bash"
Original file line number Diff line number Diff line change 1+ # nix
2+ .devenv /
3+ .direnv /
14# project
25.idea /
36.vscode /
Original file line number Diff line number Diff line change @@ -6,9 +6,15 @@ Langchain-powered natural language interface to RDF knowledge-graphs.
66This repository uses ` uv ` for package management. A Makefile rule is provided to install the dependencies:
77
88``` bash
9- make install
9+ just setup
1010```
1111
12+ To start the nix-based development shell (linux-only), run:
13+
14+ ``` bash
15+ just dev
16+ ``````
17+
1218# # Configuration
1319
1420Configuration variables are loaded from the ` .env` file or environment variables. A template configuration file is provided in ` .env.example` .
Original file line number Diff line number Diff line change 1+ set positional-arguments
2+ set dotenv-load
3+ set shell := [" bash" , " -cue" ]
4+ root_dir := ` git rev-parse --show-toplevel `
5+ flake_dir := root_dir / " tools/nix"
6+
7+ # Manage nix flakes
8+ mod nix ' tools/just/nix.just'
9+
10+ [private ]
11+ default :
12+ just --unsorted --list --no-aliases
13+
14+ alias dev := develop
15+
16+ # Enter a development shell.
17+ develop :
18+ just nix::develop default
19+
20+ # Set up python environment.
21+ setup :
22+ @ echo " 🔧 Setting up python environment"
23+ uv sync --all-extras --group dev
24+ uv run pre-commit install
25+
26+
27+ # Run all quality checks.
28+ check : setup
29+ @ echo " 🚀 Validating lock file"
30+ uv lock --check
31+ @ echo " 🚀 Running all pre-commit hooks"
32+ uv run pre-commit run -a
33+
34+ alias fmt := format
35+ # Format code.
36+ format * args : setup
37+ @ echo " 🚀 Formatting python code"
38+ uv run ruff format {{ args}}
39+
40+ # Run unit tests.
41+ test * args : setup
42+ @ echo " 🚀 Testing code: Running pytest"
43+ @ uv run pytest {{ args}}
Original file line number Diff line number Diff line change 1+ set positional-arguments
2+ set dotenv-load
3+ set shell := [" bash" , " -cue" ]
4+ root_dir := ` git rev-parse --show-toplevel `
5+ flake_dir := root_dir / " tools/nix"
6+
7+ ## Nix Stuff ==================================================================
8+ # Show all packages configured in the Nix `flake.nix`.
9+ list * args :
10+ cd {{ flake_dir}} && nix flake --no-pure-eval show
11+
12+ # Enter the Nix `devShell` with name `$1` and execute the command `${@:2}` (default command is '$SHELL')
13+ [private ]
14+ develop * args :
15+ #!/usr/bin/env bash
16+ set -eu
17+ shell =" $1" ; shift 1 ;
18+ args=(" $@" ) && [ " ${#args[@]}" != 0 ] || args=" $SHELL"
19+ cd {{ root_dir}}
20+ nix develop --no-pure-eval --accept-flake-config \
21+ " {{ flake_dir}} #$shell" --command " ${args[@]}"
22+ ## ============================================================================
You can’t perform that action at this time.
0 commit comments