profileSourced checks if the Nix profile shell scripts (such as nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh) have already been successfully sourced.
()
| 386 | // /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh) have already been |
| 387 | // successfully sourced. |
| 388 | func profileSourced() bool { |
| 389 | // Check if we're already in a Nix environment. Use NIX_PROFILES instead |
| 390 | // of __ETC_PROFILE_NIX_SOURCED because it's set for single-user |
| 391 | // installs and on NixOS (whereas __ETC_PROFILE_NIX_SOURCED is not). |
| 392 | _, ok := os.LookupEnv("NIX_PROFILES") |
| 393 | return ok |
| 394 | } |
| 395 | |
| 396 | // profilePaths returns the paths where the Nix profile shell scripts might be. |
| 397 | // None of the paths are guaranteed to be readable or even exist. |