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