Skip to content

Commit 867655f

Browse files
nyonsonjosibake
andauthored
Add nix development shell with a flake (#590)
* Add nix development shell with a flake * Update contrib/README.md --------- Co-authored-by: josie <[email protected]>
1 parent 4eaeacb commit 867655f

File tree

3 files changed

+106
-0
lines changed

3 files changed

+106
-0
lines changed

contrib/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Community Contributions
2+
3+
Contains community-contributed resources for Warnet. These contributions are not officially supported or maintained.

contrib/nix/flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/nix/flake.nix

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
description = "Warnet python development environment";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = nixpkgs.legacyPackages.${system};
13+
in
14+
{
15+
devShells.default = pkgs.mkShell {
16+
nativeBuildInputs = with pkgs; [
17+
python3
18+
python3Packages.pip
19+
# K8 dependencies for local cluster deployment.
20+
minikube
21+
kubectl
22+
kubernetes-helm
23+
];
24+
25+
# Install project dependencies and executable.
26+
shellHook = ''
27+
# Create a virtual environment if it doesn't exist.
28+
if [ ! -d ".venv" ]; then
29+
python -m venv .venv
30+
fi
31+
32+
# Activate the virtual environment.
33+
source .venv/bin/activate
34+
# Install the project in editable mode.
35+
pip install -e .
36+
37+
echo "WARNET DEVELOPMENT SHELL ENABLED"
38+
'';
39+
};
40+
}
41+
);
42+
}

0 commit comments

Comments
 (0)