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