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