-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdev.nix
61 lines (57 loc) · 1.87 KB
/
dev.nix
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
49
50
51
52
53
54
55
56
57
58
59
60
61
# To learn more about how to use Nix to configure your environment
# see: https://developers.google.com/idx/guides/customize-idx-env
{ pkgs, ... }: {
# Which nixpkgs channel to use.
channel = "stable-24.05"; # or "unstable"
# Use https://search.nixos.org/packages to find packages
packages = [
pkgs.python312
pkgs.python312Packages.pip
pkgs.git
pkgs.git-lfs
];
# Sets environment variables in the workspace
env = { }; # Not recommended
idx = {
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
extensions = [
"ms-python.black-formatter"
"ms-python.python"
"ms-python.debugpy"
"visualstudioexptteam.vscodeintellicode"
"ms-python.vscode-pylance"
"glenn2223.live-sass"
"yzhang.markdown-all-in-one"
# "vscodevim.vim"
];
# Enable previews and customize configuration
previews = {
enable = true;
previews = {
web = {
command = [ "sh" "-c" "source .venv/bin/activate && python -m flask --app web run -p $PORT --debug" ];
env = { PORT = "$PORT"; };
manager = "web";
};
};
};
# Workspace lifecycle hooks
workspace = {
# Runs when a workspace is first created
onCreate = {
# SETUP: Create the environment when created the workspace
install-git-lfs = "git lfs install";
pull-LF = "git lfs pull";
put-env = "cat .env.example > .env";
setup = "python -m venv .venv && sleep 2 && bash -c '. .venv/bin/activate && sleep 4 && pip install -r requirements.txt'";
};
# Runs when the workspace is (re)started
onStart = {
# Example: start a background task
pull = "git pull";
pull-LF = "git lfs pull";
setup = "sleep 1 && . .venv/bin/activate && sleep 3 && pip install -r requirements.txt";
};
};
};
}