]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/blackberry.nix
pumpkin: sanoid: use recursive=zfs
[julm/julm-nix.git] / hosts / blackberry.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/desktop.nix
9 ../nixos/profiles/printing.nix
10 #../nixos/profiles/radio.nix
11 ../nixos/profiles/tor.nix
12 ../nixos/profiles/bluetooth.nix
13 #blackberry/backup.nix
14 blackberry/hardware.nix
15 blackberry/nebula.nix
16 blackberry/networking.nix
17 #blackberry/pixiecore.nix
18 blackberry/nix-ssh.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/oignon.pub
31 ../users/julm/ssh/pumpkin.pub
32 ../users/julm/ssh/blackberry.pub
33 ];
34 };
35 users.users.julm = {
36 isNormalUser = true;
37 uid = 1000;
38 # Put the hashedPassword in /nix/store,
39 # though /etc/shadow is not world readable...
40 # printf %s $(mkpasswd -m md5crypt)
41 hashedPassword = lib.readFile blackberry/users/julm/login/hashedPassword.clear;
42 extraGroups = [
43 "adbusers"
44 "dialout"
45 "lp"
46 "networkmanager"
47 "plugdev" # For rtl-sdr
48 "scanner"
49 "tor"
50 "video"
51 "wheel"
52 "wireshark"
53 #"ipfs"
54 config.services.davfs2.davGroup
55 #"vboxusers"
56 ];
57 # If created, zfs-mount.service would require:
58 # zfs set overlay=yes ${hostName}/home
59 createHome = false;
60 openssh.authorizedKeys.keys = map lib.readFile [
61 ../users/julm/ssh/oignon.pub
62 ../users/julm/ssh/pumpkin.pub
63 ../users/julm/ssh/losurdo.pub
64 ];
65 };
66
67 nix = {
68 extraOptions = ''
69 '';
70 settings = {
71 substituters = [
72 ];
73 trusted-public-keys = map lib.readFile [
74 ];
75 };
76 nixPath = lib.mkForce [ "nixpkgs=${inputs.nixpkgs}" ];
77 };
78
79 environment.systemPackages = [
80 #pkgs.riseup-vpn # Can't be installed by home-manager because it needs to install policy-kit rules
81 ];
82
83 boot.extraModulePackages = [
84 #config.boot.kernelPackages.v4l2loopback
85 ];
86
87 programs.fuse.userAllowOther = true;
88
89 systemd.automounts = [
90 { where = "/mnt/aubergine"; automountConfig.TimeoutIdleSec = "5 min"; }
91 ];
92 fileSystems =
93 let
94 # Use the user's gpg-agent session to query
95 # for the password of the SSH key when auto-mounting.
96 sshAsUser =
97 pkgs.writeScript "sshAsUser" ''
98 user="$1"; shift
99 exec ${pkgs.sudo}/bin/sudo -i -u "$user" \
100 ${pkgs.openssh}/bin/ssh "$@"
101 '';
102 options =
103 [
104 "user"
105 "uid=julm"
106 "gid=users"
107 "allow_other"
108 "exec" # Override "user"'s noexec
109 "noatime"
110 "nosuid"
111 "_netdev"
112 "ssh_command=${sshAsUser}\\040julm"
113 "noauto"
114 "x-gvfs-hide"
115 "x-systemd.automount"
116 #"Compression=yes" # YMMV
117 # Disconnect approximately 2*15=30 seconds after a network failure
118 "ServerAliveCountMax=1"
119 "ServerAliveInterval=15"
120 "dir_cache=no"
121 #"reconnect"
122 ];
123 in
124 {
125 "/mnt/aubergine" = {
126 device = "${pkgs.sshfs-fuse}/bin/sshfs#julm@aubergine.sp:/";
127 fsType = "fuse";
128 inherit options;
129 };
130 };
131
132 networking.firewall.extraCommands = ''
133 ip46tables -A nixos-fw -i wg-intra -p tcp -m tcp --dport 8000 -j ACCEPT
134 '';
135
136 services.xserver = {
137 xkb = {
138 layout = "fr,us(altgr-intl)";
139 };
140 desktopManager = {
141 session = [
142 # Let the session be generated by home-manager
143 {
144 name = "home-manager";
145 start = ''
146 ${pkgs.runtimeShell} $HOME/.hm-xsession &
147 waitPID=$!
148 '';
149 }
150 ];
151 };
152 };
153
154 services.displayManager = {
155 defaultSession = "home-manager";
156 #defaultSession = "none+xmonad";
157 #defaultSession = "mate";
158 #defaultSession = "cinnamon";
159 autoLogin = {
160 user = config.users.users.julm.name;
161 };
162 };
163
164 # This value determines the NixOS release with which your system is to be
165 # compatible, in order to avoid breaking some software such as database
166 # servers. You should change this only after NixOS release notes say you should.
167 system.stateVersion = "24.05"; # Did you read the comment?
168 }