diff --git a/.envrc b/.envrc index fd60930..27c5929 100644 --- a/.envrc +++ b/.envrc @@ -9,6 +9,14 @@ fi # TODO: # git config --local core.hooksPath "$PWD"/.githooks +flake_shell=.#envrc +if [[ -f .remote.toml ]]; then + flake_shell+=-remotes +fi +if [[ ! -f /run/current-system/nixos-version ]]; then + flake_shell+=-fhs +fi + # ensure (dirty) updated flake lock # TODO: cache this on gitea? Run in background? now="$(date +%Y-%m-%d)" @@ -47,8 +55,16 @@ if [[ ! -s .direnv/pull-date || "$now" != "$(cat .direnv/pull-date)" ]]; then if command -v pueue >/dev/null && pueue status >&/dev/null; then nix flake update "${update_args[@]}" else - echo >&2 "+ pueue add nix flake update ..." - pueue add --escape --immediate nix flake update "${update_args[@]}" + ( + echo >&2 "+ pueue add --escape --immediate nix flake update ..." + task_id=$( + pueue add --print-task-id --escape --immediate nix flake update "${update_args[@]}" \ + | tee >(xargs -d'\n' printf >&2 "New task added (id %s).\n") + ) + (set -x + pueue add --after="$task_id" --escape nix print-dev-env "$flake_shell" + ) + ) fi unset update_args @@ -56,13 +72,6 @@ if [[ ! -s .direnv/pull-date || "$now" != "$(cat .direnv/pull-date)" ]]; then fi # source env -flake_shell=.#envrc -if [[ -f .remote.toml ]]; then - flake_shell+=-remotes -fi -if [[ ! -f /run/current-system/nixos-version ]]; then - flake_shell+=-fhs -fi use flake "$flake_shell" printf "\n"