aboutsummaryrefslogtreecommitdiff
path: root/shellrc.d/nix
blob: bf26cd5881a7e4a0e3e0bcd680f84ae05b35a82d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# vim: ft=sh:
if command -v nix >/dev/null; then

dev() {
	local target="$1"
	local flake dev
	if [[ "${target#*"#"}" != "$target" ]]; then
		IFS='#' read flake dev <<<"$target"
	else
		if [ -e "$target" ]; then
			flake="$target"
			dev="default"
		else
			flake="personal"
			dev="${target:-default}"
		fi
	fi
	nix develop "$flake#$dev" -c zsh
}

fi