blob: cdea1eda7453a3142f62efb8da866fa39475a581 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
{ config, pkgs, lib, ... }:
with lib; {
options = { };
config =
let
cfg = config.wsl;
syschdemd = pkgs.callPackage ./syschdemd.nix {
automountPath = cfg.wslConf.automount.root;
defaultUser = config.users.users.${cfg.defaultUser};
};
in
mkIf (cfg.enable && !cfg.nativeSystemd) {
wsl = {
binShPkg = pkgs.bashInteractive;
wslConf.user.default = "root";
};
users.users.root.shell = "${syschdemd}/bin/syschdemd";
security.sudo.extraConfig = ''
Defaults env_keep+=INSIDE_NAMESPACE
'';
# Start a systemd user session when starting a command through runuser
security.pam.services.runuser.startSession = true;
# Include Windows %PATH% in Linux $PATH.
environment.extraInit = mkIf cfg.interop.includePath ''PATH="$PATH:$WSLPATH"'';
environment.systemPackages = [
(pkgs.runCommand "wslpath" { } ''
mkdir -p $out/bin
ln -s /init $out/bin/wslpath
'')
];
};
}
|