initial commit
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Enter the dev shell without re-fetching nixpkgs.
|
||||
#
|
||||
# flake.nix pins nixos-26.05. When the machine already has that revision in its
|
||||
# store (NixOS systems built from the same channel usually do), pointing the
|
||||
# input at the local path skips the tarball fetch entirely and makes
|
||||
# `nix develop` near-instant. Falls back to the pinned input otherwise.
|
||||
set -euo pipefail
|
||||
|
||||
local_nixpkgs=$(nix registry list 2>/dev/null |
|
||||
awk '$1 == "system" && $2 == "flake:nixpkgs" { print $3 }' |
|
||||
sed 's/?.*//')
|
||||
|
||||
args=()
|
||||
if [[ -n ${local_nixpkgs} && -d ${local_nixpkgs#path:} ]]; then
|
||||
args=(--override-input nixpkgs "${local_nixpkgs}")
|
||||
fi
|
||||
|
||||
exec nix develop "${args[@]}" --command "${@:-bash}"
|
||||
Reference in New Issue
Block a user