generated from saicaca/fuwari
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.envrc
26 lines (22 loc) · 1.29 KB
/
.envrc
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
#!/usr/bin/env bash
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_file flake.nix
watch_file flake.lock
# Conditionally watch dev files only if they exist
[ -f flake-parts/devenv/dev.nix ] && watch_file flake-parts/devenv/dev.nix
[ -f flake-parts/shells/dev.nix ] && watch_file flake-parts/shells/dev.nix
[ -f flake-parts/process-compose-flake/dev.nix ] && watch_file flake-parts/process-compose-flake/dev.nix
[ -f flake-parts/treefmt.nix ] && watch_file flake-parts/treefmt.nix
[ -f flake-parts/pre-commit-hooks.nix ] && watch_file flake-parts/pre-commit-hooks.nix
# Check which devshell implementation we are using and load that one
if [ -f flake-parts/devenv/dev.nix ]; then
if ! use flake .#dev --accept-flake-config --override-input devenv-root "file+file://"<(printf %s "$PWD"); then
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to dev.nix and hit enter to try again." >&2
fi
elif [ -f flake-parts/shells/dev.nix ]; then
if ! use flake .#dev --accept-flake-config; then
echo "devshell could not be built. Make sure dev.nix is a valid devshell and try again." >&2
fi
fi