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