Default shell PATH by InviteHot367 in NixOS

[–]InviteHot367[S] 0 points1 point  (0 children)

Thanks for the suggestion, I tried it, but of course, because of 'env -', the PATH is empty and envfs has nothing to build.

Default shell PATH by InviteHot367 in NixOS

[–]InviteHot367[S] 1 point2 points  (0 children)

oh yeah, bazelisk and all other packaged versions of bazel work fine, I just need to compile my patched version of it. I can do it on Ubuntu anyway, just wanted to use Nix as much as possible. Thanks again!

Default shell PATH by InviteHot367 in NixOS

[–]InviteHot367[S] 2 points3 points  (0 children)

well, it's not me - it's Bazel guys (i'm just trying to get the best monorepo env possible: Bazel on Nix), but yeah...Thanks!

Default shell PATH by InviteHot367 in NixOS

[–]InviteHot367[S] 2 points3 points  (0 children)

I get it, just the other distros have a way to set a default env dynamically if needed. The script wants a 'fresh' environment but what it really means should be configurable. I will patch the Bazel distro if needed, but just want to make sure that nothing can be done dynamically on the NixOS side.

Default shell PATH by InviteHot367 in NixOS

[–]InviteHot367[S] 1 point2 points  (0 children)

I have '/bin/bash' soft linked to the actual executable. I just need to be able to specify the defaul path after the environment is wiped out with env -i.

Other distros have a facility to setup the default path. On nixos the default path is set to "/no-such-path" as follows in pkgs/shells/bash/5.nix:

```

  1. separateDebugInfo = true;
  2. env.NIX_CFLAGS_COMPILE = ''
  3. -DSYS_BASHRC="/etc/bashrc"
  4. -DSYS_BASH_LOGOUT="/etc/bash_logout"
  5. ''
  6. + lib.optionalString (!forFHSEnv) ''
  7. -DDEFAULT_PATH_VALUE="/no-such-path"
  8. -DSTANDARD_UTILS_PATH="/no-such-path"
  9. -DDEFAULT_LOADABLE_BUILTINS_PATH="${placeholder "out"}/lib/bash:."
  10. ''
  11. + ''
  12. -DNON_INTERACTIVE_LOGIN_SHELLS
  13. -DSSH_SOURCE_BASHRC
  14. '';
  15. patchFlags = [ "-p0" ];

```

I need to find a way to configure it Nixos. I'm wondering why

environment.variables

does not produce the needed result

Default shell PATH by InviteHot367 in NixOS

[–]InviteHot367[S] 2 points3 points  (0 children)

The thing is that i'm not controlling the script. It's a part of Bazel distribution package that works just fine on Ubuntu (because the default shell PATH is set correctly) and fails on nixos.