]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/nan2gua1.nix
Security(neovim): use firejail
[julm/julm-nix.git] / hosts / nan2gua1.nix
1 {
2 config,
3 pkgs,
4 lib,
5 inputs,
6 hostName,
7 ...
8 }:
9 {
10 imports = [
11 ../nixos/profiles/appimage.nix
12 ../nixos/profiles/bluetooth.nix
13 ../nixos/profiles/builder.nix
14 ../nixos/profiles/debug.nix
15 ../nixos/profiles/dolphin.nix
16 ../nixos/profiles/firejail.nix
17 ../nixos/profiles/graphical.nix
18 ../nixos/profiles/home.nix
19 ../nixos/profiles/irssi.nix
20 ../nixos/profiles/lang-fr.nix
21 ../nixos/profiles/laptop.nix
22 ../nixos/profiles/printing.nix
23 ../nixos/profiles/radio.nix
24 ../nixos/profiles/tor.nix
25 nan2gua1/sanoid.nix
26 nan2gua1/syncoid.nix
27 nan2gua1/hardware.nix
28 nan2gua1/nebula.nix
29 nan2gua1/networking.nix
30 nan2gua1/postgresql.nix
31 nan2gua1/pgadmin.nix
32 ];
33
34 # Lower kernel's security for better performances
35 security.kernel.mitigations = "off";
36
37 home-manager.users.julm = {
38 imports = [ ../homes/julm.nix ];
39 };
40 users.users.root = {
41 openssh.authorizedKeys.keys = map lib.readFile [
42 # For nix -L run .#$(hostname).switch
43 ../users/julm/ssh/nan2gua1.pub
44 # SecurityToDo: remove
45 ../users/julm/ssh/blackberry.pub
46 ];
47 };
48 users.users.julm = {
49 isNormalUser = true;
50 uid = 1000;
51 # Put the hashedPassword in /nix/store,
52 # though /etc/shadow is not world readable...
53 # printf %s $(mkpasswd -m md5crypt)
54 hashedPassword = lib.readFile pumpkin/users/julm/login/hashedPassword.clear;
55 extraGroups = [
56 "adbusers"
57 "dialout"
58 "lp"
59 "networkmanager"
60 "plugdev" # For rtl-sdr
61 "scanner"
62 "tor"
63 "tss" # For tpm2
64 "video"
65 "wheel"
66 "wireshark"
67 #"ipfs"
68 config.services.davfs2.davGroup
69 config.services.kubo.group
70 #"vboxusers"
71 ];
72 # If created, zfs-mount.service would require:
73 # zfs set overlay=yes ${hostName}/home
74 createHome = false;
75 openssh.authorizedKeys.keys = map lib.readFile [
76 ../users/julm/ssh/losurdo.pub
77 ];
78 };
79
80 nix = {
81 settings = {
82 substituters = [
83 #"http://nix-localcache.losurdo.sp"
84 #"file:///mnt/off4/julm/nix?priority=10&trusted=true"
85 #"ssh://nix-ssh@losurdo.sp?priority=30"
86 ];
87 trusted-public-keys = map lib.readFile [
88 #../users/nix/ssh/losurdo.pub
89 ];
90 };
91 };
92 #environment.etc."nixpkgs".source = pkgs.path;
93 #environment.etc."nixpkgs-overlays".source = inputs.self + "/nixpkgs";
94
95 nix.settings.allowed-users = [
96 #config.users.users."nix-ssh".name
97 ];
98 nix.sshServe = {
99 #enable = true;
100 keys = map lib.readFile [
101 ../users/julm/ssh/losurdo.pub
102 ../users/julm/ssh/pumpkin.pub
103 ../users/julm/ssh/nan2gua1.pub
104 ../users/sevy/ssh/patate.pub
105 ];
106 };
107
108 environment.systemPackages = [
109 #pkgs.riseup-vpn # Can't be installed by home-manager because it needs to install policy-kit rules
110 ];
111
112 boot.extraModulePackages = [
113 #config.boot.kernelPackages.v4l2loopback
114 ];
115
116 programs.adb.enable = true;
117
118 programs.fuse.userAllowOther = true;
119
120 services.davfs2.enable = true;
121
122 systemd.automounts = [
123 {
124 where = "/mnt/aubergine";
125 automountConfig.TimeoutIdleSec = "5 min";
126 }
127 ];
128 fileSystems =
129 let
130 # Use the user's gpg-agent session to query
131 # for the password of the SSH key when auto-mounting.
132 sshAsUser = pkgs.writeScript "sshAsUser" ''
133 user="$1"; shift
134 exec ${pkgs.sudo}/bin/sudo -i -u "$user" \
135 ${pkgs.openssh}/bin/ssh "$@"
136 '';
137 options = [
138 "user"
139 "uid=julm"
140 "gid=users"
141 "allow_other"
142 "exec" # Override "user"'s noexec
143 "noatime"
144 "nosuid"
145 "_netdev"
146 "ssh_command=${sshAsUser}\\040julm"
147 "noauto"
148 "x-gvfs-hide"
149 "x-systemd.automount"
150 #"Compression=yes" # YMMV
151 # Disconnect approximately 2*15=30 seconds after a network failure
152 "ServerAliveCountMax=1"
153 "ServerAliveInterval=15"
154 "dir_cache=no"
155 #"reconnect"
156 ];
157 in
158 {
159 "/mnt/aubergine" = {
160 device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@aubergine.sp:/";
161 fsType = "fuse";
162 inherit options;
163 };
164 "/mnt/losurdo" = {
165 device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@losurdo.sp:/";
166 fsType = "fuse";
167 inherit options;
168 };
169 "/mnt/mermet" = {
170 device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@mermet.sp:/";
171 fsType = "fuse";
172 inherit options;
173 };
174 /*
175 "/mnt/ilico/severine" = {
176 device = "https://nuage.ilico.org/remote.php/dav/files/severine/";
177 fsType = "davfs";
178 options =
179 let
180 conf = pkgs.writeText "davfs2.conf" ''
181 backup_dir /home/julm/.local/share/davfs2/ilico/severine
182 secrets /home/julm/.davfs2/secrets
183 '';
184 in
185 [
186 "conf=${conf}"
187 "user"
188 "noexec"
189 "nosuid"
190 "noauto"
191 "nofail"
192 "_netdev"
193 "reconnect"
194 "x-systemd.automount"
195 "x-systemd.device-timeout=1m"
196 "x-systemd.idle-timeout=1m"
197 "x-systemd.mount-timeout=10s"
198 ];
199 };
200 */
201 };
202
203 services.udev.packages = [
204 # Allow the console user access the Yubikey USB device node,
205 # needed for challenge/response to work correctly.
206 pkgs.yubikey-personalization
207 ];
208
209 services.xserver = {
210 xkb = {
211 layout = "fr,us(altgr-intl)";
212 };
213 desktopManager = {
214 session = [
215 # Let the session be generated by home-manager
216 {
217 name = "home-manager";
218 start = ''
219 ${pkgs.runtimeShell} $HOME/.hm-xsession &
220 waitPID=$!
221 '';
222 }
223 ];
224 };
225 };
226
227 services.displayManager = {
228 defaultSession = "home-manager";
229 #defaultSession = "none+xmonad";
230 #defaultSession = "mate";
231 #defaultSession = "cinnamon";
232 autoLogin = {
233 user = config.users.users.julm.name;
234 };
235 };
236
237 nixpkgs.config.allowUnfreePredicate =
238 pkg:
239 builtins.elem (lib.getName pkg) [
240 "canon-cups-ufr2"
241 "cuda_cccl"
242 "cuda_cudart"
243 "cuda_cupti"
244 "cuda_nvcc"
245 "cuda_nvrtc"
246 "cuda_nvtx"
247 "cudnn"
248 "geogebra"
249 "hplip"
250 "libcublas"
251 "libcufft"
252 "libcurand"
253 "libcusolver"
254 "libcusparse"
255 "libnvjitlink"
256 "memtest86-efi"
257 "shipwright"
258 "steam"
259 "steam-unwrapped"
260 "synthesia"
261 "torch"
262 "triton"
263 ];
264
265 # This value determines the NixOS release with which your system is to be
266 # compatible, in order to avoid breaking some software such as database
267 # servers. You should change this only after NixOS release notes say you should.
268 system.stateVersion = "25.05"; # Did you read the comment?
269 }