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