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