-
Notifications
You must be signed in to change notification settings - Fork 81
/
wsl.nix
121 lines (103 loc) · 3.21 KB
/
wsl.nix
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{
# FIXME: uncomment the next line if you want to reference your GitHub/GitLab access tokens and other secrets
# secrets,
username,
hostname,
pkgs,
inputs,
...
}: {
# FIXME: change to your tz! look it up with "timedatectl list-timezones"
time.timeZone = "America/Los_Angeles";
networking.hostName = "${hostname}";
# FIXME: change your shell here if you don't want fish
programs.fish.enable = true;
environment.pathsToLink = ["/share/fish"];
environment.shells = [pkgs.fish];
environment.enableAllTerminfo = true;
security.sudo.wheelNeedsPassword = false;
# FIXME: uncomment the next line to enable SSH
# services.openssh.enable = true;
users.users.${username} = {
isNormalUser = true;
# FIXME: change your shell here if you don't want fish
shell = pkgs.fish;
extraGroups = [
"wheel"
# FIXME: uncomment the next line if you want to run docker without sudo
# "docker"
];
# FIXME: add your own hashed password
# hashedPassword = "";
# FIXME: add your own ssh public key
# openssh.authorizedKeys.keys = [
# "ssh-rsa ..."
# ];
};
home-manager.users.${username} = {
imports = [
./home.nix
];
};
system.stateVersion = "22.05";
wsl = {
enable = true;
wslConf.automount.root = "/mnt";
wslConf.interop.appendWindowsPath = false;
wslConf.network.generateHosts = false;
defaultUser = username;
startMenuLaunchers = true;
# Enable integration with Docker Desktop (needs to be installed)
docker-desktop.enable = false;
};
virtualisation.docker = {
enable = true;
enableOnBoot = true;
autoPrune.enable = true;
};
# FIXME: uncomment the next block to make vscode running in Windows "just work" with NixOS on WSL
# solution adapted from: https://github.com/K900/vscode-remote-workaround
# more information: https://github.com/nix-community/NixOS-WSL/issues/238 and https://github.com/nix-community/NixOS-WSL/issues/294
# systemd.user = {
# paths.vscode-remote-workaround = {
# wantedBy = ["default.target"];
# pathConfig.PathChanged = "%h/.vscode-server/bin";
# };
# services.vscode-remote-workaround.script = ''
# for i in ~/.vscode-server/bin/*; do
# if [ -e $i/node ]; then
# echo "Fixing vscode-server in $i..."
# ln -sf ${pkgs.nodejs_18}/bin/node $i/node
# fi
# done
# '';
# };
nix = {
settings = {
trusted-users = [username];
# FIXME: use your access tokens from secrets.json here to be able to clone private repos on GitHub and GitLab
# access-tokens = [
# "github.com=${secrets.github_token}"
# "gitlab.com=OAuth2:${secrets.gitlab_token}"
# ];
accept-flake-config = true;
auto-optimise-store = true;
};
registry = {
nixpkgs = {
flake = inputs.nixpkgs;
};
};
nixPath = [
"nixpkgs=${inputs.nixpkgs.outPath}"
"nixos-config=/etc/nixos/configuration.nix"
"/nix/var/nix/profiles/per-user/root/channels"
];
package = pkgs.nixVersions.stable;
extraOptions = ''experimental-features = nix-command flakes'';
gc = {
automatic = true;
options = "--delete-older-than 7d";
};
};
}