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