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