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