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