forked from LGUG2Z/nixos-wsl-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwsl.nix
154 lines (128 loc) · 3.41 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{
secrets,
username,
hostname,
pkgs,
inputs,
...
}: {
time.timeZone = "America/New_York";
networking.hostName = "${hostname}";
programs.fish.enable = true;
environment.pathsToLink = ["/share/fish"];
environment.shells = [pkgs.fish];
environment.enableAllTerminfo = true;
# sops.secrets.my-password.neededForUsers = true;
security.sudo.wheelNeedsPassword = false;
services.openssh.enable = true;
users.mutableUsers = true;
users.users.${username} = {
isNormalUser = true;
shell = pkgs.fish;
extraGroups = [
"wheel"
"docker"
"networkmanager"
];
hashedPassword = "Monaciello-password";
openssh.authorizedKeys.keys = [
" ~/.config/sops/age/secrets.yaml ..."
];
};
home-manager.users.${username} = {
imports = [
./home.nix
];
};
sops = {
defaultSopsFile = ./secrets/secrets.json;
defaultSopsFormat = "json";
secrets = {
github_token = {
format = "json";
sopsFile = ./secrets/secrets.json;
};
};
};
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;
};
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
'';
};
# contribution given to takota/keybase.nix https://gist.github.com/taktoa/3133a4d9b1614fad1f4841f145441406
services.kbfs = {
enable = true;
mountPoint = "%t/kbfs";
extraFlags = ["-label %u"];
};
systemd.user.services = {
keybase.serviceConfig.Slice = "keybase.slice";
kbfs = {
environment = {KEYBASE_RUN_MODE = "prod";};
serviceConfig.Slice = "keybase.slice";
};
keybase-gui = {
description = "Keybase GUI";
requires = ["keybase.service" "kbfs.service"];
after = ["keybase.service" "kbfs.service"];
serviceConfig = {
ExecStart = "${pkgs.keybase-gui}/share/keybase/Keybase";
PrivateTmp = true;
Slice = "keybase.slice";
};
};
};
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.nixFlakes;
extraOptions = ''experimental-features = nix-command flakes'';
gc = {
automatic = true;
options = "--delete-older-than 7d";
};
};
}