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