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