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