Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions mobala-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,18 @@ export NIXIFIED=${NIXIFIED:-0}
function nixify() {
read -r -a args <<< "$(grep -v '^\s*$' $MOBALA_KEEP | grep -v '#' | sed "s/^/--keep /;s/$/ /" | tr '\n' ' ')"

local func_args=("$@")
local last_index=$(( ${#func_args[@]} - 1 ))
local last_arg="${func_args[$last_index]}"
local dev_shell=".#$last_arg"

if [[ -z "${IN_NIX_SHELL+x}" ]]; then
echo "[info] Restarting in Nix..."
export NIXIFIED=1
nix flake lock
nix flake metadata
exec nix develop \
$dev_shell \
--ignore-environment \
--keep HOME \
--keep NIXIFIED \
Expand Down
7 changes: 6 additions & 1 deletion mobala.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ while [[ $idx -lt $arguments_length ]] ; do
case "$arg" in
--nix)
idx=$((idx+1))
shift && nixify "$@"
shift && nixify "$@" "default"
;;

--nix=*)
dev_shell="${arg#--nix=}"
shift && nixify "$@" $dev_shell
;;

--help)
idx=$((idx+1))
print-help
Expand Down