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