]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/pumpkin.nix
+use/op(xmonad): add scratchpads
[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.adb.enable = true;
109
110 programs.fuse.userAllowOther = true;
111
112 services.davfs2.enable = true;
113
114 systemd.automounts = [
115 {
116 where = "/mnt/aubergine";
117 automountConfig.TimeoutIdleSec = "5 min";
118 }
119 ];
120 fileSystems =
121 let
122 # Use the user's gpg-agent session to query
123 # for the password of the SSH key when auto-mounting.
124 sshAsUser = pkgs.writeScript "sshAsUser" ''
125 user="$1"; shift
126 exec ${pkgs.sudo}/bin/sudo -i -u "$user" \
127 ${pkgs.openssh}/bin/ssh "$@"
128 '';
129 options = [
130 "user"
131 "uid=julm"
132 "gid=users"
133 "allow_other"
134 "exec" # Override "user"'s noexec
135 "noatime"
136 "nosuid"
137 "_netdev"
138 "ssh_command=${sshAsUser}\\040julm"
139 "noauto"
140 "x-gvfs-hide"
141 "x-systemd.automount"
142 #"Compression=yes" # YMMV
143 # Disconnect approximately 2*15=30 seconds after a network failure
144 "ServerAliveCountMax=1"
145 "ServerAliveInterval=15"
146 "dir_cache=no"
147 #"reconnect"
148 ];
149 in
150 {
151 "/mnt/aubergine" = {
152 device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@aubergine.sp:/";
153 fsType = "fuse";
154 inherit options;
155 };
156 "/mnt/losurdo" = {
157 device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@losurdo.sp:/";
158 fsType = "fuse";
159 inherit options;
160 };
161 "/mnt/mermet" = {
162 device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@mermet.sp:/";
163 fsType = "fuse";
164 inherit options;
165 };
166 /*
167 "/mnt/ilico/severine" = {
168 device = "https://nuage.ilico.org/remote.php/dav/files/severine/";
169 fsType = "davfs";
170 options =
171 let
172 conf = pkgs.writeText "davfs2.conf" ''
173 backup_dir /home/julm/.local/share/davfs2/ilico/severine
174 secrets /home/julm/.davfs2/secrets
175 '';
176 in
177 [
178 "conf=${conf}"
179 "user"
180 "noexec"
181 "nosuid"
182 "noauto"
183 "nofail"
184 "_netdev"
185 "reconnect"
186 "x-systemd.automount"
187 "x-systemd.device-timeout=1m"
188 "x-systemd.idle-timeout=1m"
189 "x-systemd.mount-timeout=10s"
190 ];
191 };
192 */
193 };
194
195 services.udev.packages = [
196 # Allow the console user access the Yubikey USB device node,
197 # needed for challenge/response to work correctly.
198 pkgs.yubikey-personalization
199 ];
200
201 services.xserver = {
202 xkb = {
203 layout = "fr,us(altgr-intl)";
204 };
205 desktopManager = {
206 session = [
207 # Let the session be generated by home-manager
208 {
209 name = "home-manager";
210 start = ''
211 ${pkgs.runtimeShell} $HOME/.hm-xsession &
212 waitPID=$!
213 '';
214 }
215 ];
216 };
217 };
218
219 services.displayManager = {
220 defaultSession = "home-manager";
221 #defaultSession = "none+xmonad";
222 #defaultSession = "mate";
223 #defaultSession = "cinnamon";
224 autoLogin = {
225 user = config.users.users.julm.name;
226 };
227 };
228
229 nixpkgs.config.allowUnfreePredicate =
230 pkg:
231 builtins.elem (lib.getName pkg) [
232 "canon-cups-ufr2"
233 "cuda_cccl"
234 "cuda_cudart"
235 "cuda_cupti"
236 "cuda_nvcc"
237 "cuda_nvrtc"
238 "cuda_nvtx"
239 "cudnn"
240 "geogebra"
241 "hplip"
242 "libcublas"
243 "libcufft"
244 "libcurand"
245 "libcusolver"
246 "libcusparse"
247 "libnvjitlink"
248 "memtest86-efi"
249 "shipwright"
250 "steam"
251 "steam-unwrapped"
252 "synthesia"
253 "torch"
254 "triton"
255 ];
256
257 # This value determines the NixOS release with which your system is to be
258 # compatible, in order to avoid breaking some software such as database
259 # servers. You should change this only after NixOS release notes say you should.
260 system.stateVersion = "24.11"; # Did you read the comment?
261 }