-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.envrc
More file actions
42 lines (34 loc) · 1.37 KB
/
.envrc
File metadata and controls
42 lines (34 loc) · 1.37 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
#!/usr/bin/env bash
# Singularity Edge - Automatic Nix Flake Development Environment
# Make sure you have direnv installed and hooked into your shell
# Run: direnv allow
# Use nix-direnv for better flake support and caching
if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4="
fi
# Watch for changes to flake files and reload automatically
watch_file flake.nix
watch_file flake.lock
# Watch for changes to Mix files (Elixir)
watch_file mix.exs
watch_file mix.lock
# Configure Nix settings directly in direnv to avoid approval prompts
# Use default nixos cache for pre-built packages
export NIX_CONFIG="substituters = https://cache.nixos.org"
# Enable flake support
use flake
# Ensure nix-provided tools take precedence over mise
# Remove mise shims from PATH and prepend nix paths
PATH_WITHOUT_MISE=$(echo "$PATH" | tr ':' '\n' | grep -v '/mise/shims' | tr '\n' ':' | sed 's/:$//')
export PATH="$PATH_WITHOUT_MISE"
# Load local environment and secrets (auto-generate if missing)
if [ ! -f .envrc.local ]; then
if [ -f scripts/setup-secrets.sh ]; then
echo "🔐 Generating development secrets..."
bash scripts/setup-secrets.sh
fi
fi
# Load secrets from .envrc.local
if [ -f .envrc.local ]; then
source_env .envrc.local
fi