forked from LGUG2Z/nixos-wsl-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwsl.nix
113 lines (95 loc) · 2.78 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
{
# CONFIG: uncomment the next line if you want to reference your GitHub/GitLab access tokens and other secrets
# secrets,
username,
hostname,
pkgs,
inputs,
...
}: {
# CONFIG: timezone (`timedatectl list-timezones`)
time.timeZone = "Europe/Oslo";
networking.hostName = "${hostname}";
# CONFIG: shell
programs.fish.enable = true;
environment.pathsToLink = ["/share/fish"];
environment.shells = [pkgs.fish];
environment.enableAllTerminfo = true;
security.sudo.wheelNeedsPassword = false;
# CONFIG: openssh
# services.openssh.enable = true;
users.users.${username} = {
isNormalUser = true;
# CONFIG: shell
shell = pkgs.fish;
extraGroups = [
"wheel"
# CONFIG: for using docker without sudo
# "docker"
];
# CONFIG: hashed password
# hashedPassword = "";
# CONFIG: 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;
# CONFIG: Docker Desktop integration (must be installed on host machine)
docker-desktop.enable = false;
};
virtualisation.docker = {
enable = true;
enableOnBoot = true;
autoPrune.enable = true;
};
# nix-ld is needed for connecting VS Code on the Windows host machine to WSL NixOS
# See: https://nix-community.github.io/NixOS-WSL/how-to/vscode.html
# FIXME: it seems like nix-ld-rs has been merged into nix-ld as version 2.0.0, which is not yet released on stable channels.
# Once that happens, the following small block should be replaced by this: `programs.nix-ld.enable = true;`
# (ie. remove `package = pkgs.nix-ld-rs;`)
programs.nix-ld = {
enable = true;
package = pkgs.nix-ld-rs;
};
nix = {
settings = {
trusted-users = [username];
# CONFIG: access tokens for building your NixOS (or at least that's what I assume this is for)
# 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.nixFlakes;
extraOptions = ''experimental-features = nix-command flakes'';
gc = {
automatic = true;
options = "--delete-older-than 7d";
};
};
}