Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix print-dev-env assumes that PATH and XDG_DATA_DIRS actually exist #6809

Closed
jfly opened this issue Jul 15, 2022 · 0 comments · Fixed by #6810
Closed

nix print-dev-env assumes that PATH and XDG_DATA_DIRS actually exist #6809

jfly opened this issue Jul 15, 2022 · 0 comments · Fixed by #6810
Labels

Comments

@jfly
Copy link
Contributor

jfly commented Jul 15, 2022

I use direnv with strict_env enabled, and with this Hand-rolled Nix flakes integration

This demo.sh script effectively shows off what direnv does when I cd into a flake-enabled project:

$ cat demo.sh
#!/usr/bin/env bash

set -euo pipefail
eval "$(nix print-dev-env)"

This recently started failing for me after #6702. Here's what started happening:

$ ./demo
./demo.sh: line 6: XDG_DATA_DIRS: unbound variable

Note how nix print-dev-env now assumes that XDG_DATA_DIRS exists:

$ nix print-dev-env
unset shellHook
nix_saved_PATH="$PATH"
nix_saved_XDG_DATA_DIRS="$XDG_DATA_DIRS"
...

(There was already the same problem with PATH, but I've always had that
environment variable defined, I just don't have a XDG_DATA_DIRS set to
anything.)

I'll put together a PR to not assume that these environment variables are
actually set.

@jfly jfly added the bug label Jul 15, 2022
jfly added a commit to jfly/nix that referenced this issue Jul 15, 2022
Minion3665 pushed a commit to Minion3665/nix that referenced this issue Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant