-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathshell.nix
More file actions
110 lines (97 loc) · 2.72 KB
/
Copy pathshell.nix
File metadata and controls
110 lines (97 loc) · 2.72 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Compatibility wrapper for users without flakes enabled.
# Prefer using `nix develop` with flake.nix for better reproducibility.
#
# Usage:
# nix-shell # Default (Docker-based)
# nix-shell --arg withVagrant true # Include Vagrant
# nix-shell --arg withLima true # Include Lima
#
# Or with direnv:
# echo "use nix" >> .envrc
# direnv allow
{ pkgs ? import <nixpkgs> { config.allowUnfree = true; }
, withVagrant ? false
, withLima ? false
}:
let
pythonEnv = pkgs.python311.withPackages (ps: with ps; [
pyyaml
jinja2
]);
basePackages = with pkgs; [
# Python environment
pythonEnv
# Build tools
gnumake
rsync
coreutils
findutils
gnugrep
gawk
# Version control
git
# Container tools
docker
docker-compose
# Linting and validation
yamllint
shellcheck
# Utilities
jq
yq-go
curl
wget
];
optionalPackages =
(if withVagrant then [ pkgs.vagrant ] else []) ++
(if withLima then [ pkgs.lima ] else []);
shellType =
if withVagrant then "withVagrant"
else if withLima then "withLima"
else "default";
in
pkgs.mkShell {
name = "salt-workspace";
buildInputs = basePackages ++ optionalPackages;
shellHook = ''
echo ""
echo "Salt Workspace Development Environment"
echo "======================================="
echo ""
echo "Shell: ${shellType}"
echo ""
echo "Available commands:"
echo " make - Build dist/ directory"
echo " make test - Run full test suite (lint + docker)"
echo " make lint - Run linting checks"
echo " make docker - Run Docker-based formula tests"
echo " make coverage - Show test coverage"
echo " make help - Show all make commands"
echo ""
${if withVagrant then ''
echo "Vagrant commands (requires VirtualBox):"
echo " vagrant up - Start Salt master and minion VMs"
echo " vagrant ssh linux-1 - Connect to minion"
echo ""
'' else ""}
${if withLima then ''
echo "Lima commands:"
echo " limactl start - Start default Lima VM"
echo " limactl shell - Open shell in Lima VM"
echo " limactl start template://almalinux-8 - Start AlmaLinux VM"
echo ""
'' else ""}
echo "Environment:"
echo " Python: $(python3 --version)"
echo " Make: $(make --version | head -1)"
echo " Docker: $(docker --version 2>/dev/null || echo 'not running')"
echo ""
${if !withVagrant && !withLima then ''
echo "For VMs, use: nix-shell --arg withVagrant true"
echo " or: nix-shell --arg withLima true"
echo ""
'' else ""}
echo "Note: For better reproducibility, use 'nix develop' with flakes."
echo ""
'';
}