Skip to content

Commit d9c9f17

Browse files
authored
[RFC][Devbox] computeEnv: remove __ETC_PROFILE_NIX_SOURCED=1 (#2147)
## Summary This was introduced in #635 (cc @ipince). I don't think its needed anymore. It seems to be used in the `/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh` script, at the very top to prevent re-execution: ``` 1 # Only execute this file once per shell. 2 if [ -n "${__ETC_PROFILE_NIX_SOURCED:-}" ]; then return; fi 3 __ETC_PROFILE_NIX_SOURCED=1 4 ``` Perhaps it has other use-cases as well? RFC. From my casual usage of a Devbox binary built with this change, it all seems to still work fine. ## How was it tested?
1 parent 3aac497 commit d9c9f17

File tree

2 files changed

+0
-8
lines changed

2 files changed

+0
-8
lines changed

internal/devbox/devbox.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,10 +892,6 @@ func (d *Devbox) computeEnv(ctx context.Context, usePrintDevEnvCache bool) (map[
892892
env[key] = val.Value.(string)
893893
}
894894

895-
// These variables are only needed for shell, but we include them here in the computed env
896-
// for both shell and run in order to be as identical as possible.
897-
env["__ETC_PROFILE_NIX_SOURCED"] = "1" // Prevent user init file from loading nix profiles
898-
899895
slog.Debug("nix environment PATH", "path", env)
900896

901897
env["PATH"] = envpath.JoinPathLists(

testscripts/run/env.test.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ stdout 'test-user'
1111
exec devbox run echo '$FOO'
1212
stdout 'bar'
1313

14-
# Fixed/hard-coded vars are set
15-
exec devbox run echo '$__ETC_PROFILE_NIX_SOURCED'
16-
stdout '1'
17-
1814
# DEVBOX_* vars are passed through
1915
env DEVBOX_FOO=baz
2016
exec devbox run echo '$DEVBOX_FOO'

0 commit comments

Comments
 (0)