-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathflake.nix
More file actions
48 lines (40 loc) · 1.46 KB
/
flake.nix
File metadata and controls
48 lines (40 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
python-3-nixpkgs.url =
"github:NixOS/nixpkgs/d98abf5cf5914e5e4e9d57205e3af55ca90ffc1d";
};
outputs = { self, nixpkgs, ... }@inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
python = inputs.python-3-nixpkgs.legacyPackages.${system}.python3;
in {
devShells.${system} = {
default = pkgs.mkShell {
packages = [ python ];
shellHook = ''
# Set the PS1 variable to indicate dev environment
PS1='\[\e[38;5;147m\][\u@\h\[\e[38;5;250m\]:\[\e[38;5;75m\]\w\[\e[38;5;147m\]]\[\e[38;5;250m\]\$ \[\e[0m\]'
# Find the topmost git directory (not submodule)
PRJ_ROOT="$(git rev-parse --show-superproject-working-tree 2>/dev/null)"
if [ -z "$PRJ_ROOT" ]; then
PRJ_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
fi
source $PRJ_ROOT/.venv/bin/activate
PWD="$(pwd)"
if [ "$DEPENDENCY_GROUP" ]; then
uv sync --active --group="$DEPENDENCY_GROUP" --directory=$PWD
else
uv sync --active --directory=$PWD
fi
clear
PYTHONPATH=$PRJ_ROOT
if [ "$OPEN_NVIM" = "true" ]; then
nvim -c 'Neotree focus left'
fi
'';
};
};
};
}