nix-community / NixOS-WSL

NixOS on WSL(2) [maintainer=@nzbr]
Apache License 2.0
1.87k stars 119 forks source link

Tracking issue for environment/PAM issues #171

Open K900 opened 1 year ago

K900 commented 1 year ago

Upstream issue: https://github.com/microsoft/WSL/issues/9213

Workaround for now:

users.users.foo.shell = let
    wrapper = pkgs.writeShellScriptBin "shell-wrapper" ''
      . /etc/set-environment
      exec ${pkgs.zsh}/bin/zsh "$@"
    '';
    in lib.mkForce "${wrapper}/bin/shell-wrapper";

Proper workaround doesn't seem possible without nixpkgs changes / infinite recursion.

Atry commented 1 month ago

Can we move the workaround to bashWrapper? https://github.com/nix-community/NixOS-WSL/blob/34b95b3962f5b3436d4bae5091d1b2ff7c1eb180/modules/systemd/native/default.nix#L12

K900 commented 1 month ago

No, that is only used for WSL to run things inside its own init. The user shells are spawned directly.