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