Skip to content

Commit 1df68a2

Browse files
committed
fix(nix): ensure experimental-features before nix develop
Previously, if nix was already installed, install.sh was skipped and nix.conf was never created, causing nix develop to fail.
1 parent 0745d89 commit 1df68a2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

bootstrap.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,27 @@ ensure_repo() {
8080
update_existing_repo || clone_repo
8181
}
8282

83+
ensure_nix_conf() {
84+
conf_dir="$HOME/.config/nix"
85+
conf_file="$conf_dir/nix.conf"
86+
mkdir -p "$conf_dir"
87+
if [ ! -f "$conf_file" ] || ! grep -q "experimental-features" "$conf_file"; then
88+
echo "experimental-features = nix-command flakes" >> "$conf_file"
89+
fi
90+
}
91+
8392
main() {
8493
require_git
8594
ensure_checkout_dir
8695
ensure_repo
8796
cd "$CHECKOUT_DIR"
8897

8998
if ! command -v nix >/dev/null 2>&1; then
90-
sh ./nix/install.sh
99+
bash ./nix/install.sh
91100
fi
92101

102+
ensure_nix_conf
103+
93104
if [ "${IN_NIX_SHELL:-}" = "1" ]; then
94105
bash ./nix/setup-internal.sh
95106
else

0 commit comments

Comments
 (0)