]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/oignon.nix
yt-dlp: fix --output
[julm/julm-nix.git] / hosts / oignon.nix
1 { config, pkgs, lib, private, hostName, ... }:
2 {
3 imports = [
4 ../nixos/profiles/dnscrypt-proxy2.nix
5 ../nixos/profiles/graphical.nix
6 ../nixos/profiles/lang-fr.nix
7 ../nixos/profiles/networking.nix
8 ../nixos/profiles/printing.nix
9 ../nixos/profiles/security.nix
10 ../nixos/profiles/system.nix
11 ../nixos/profiles/wireguard/wg-intra.nix
12 oignon/backup.nix
13 oignon/hardware.nix
14 oignon/wireguard.nix
15 ];
16
17 home-manager.users.julm = {
18 imports = [ ../homes/julm.nix ];
19 host.hardware = [ "ThinkPad" "X201" ];
20 };
21 systemd.services.home-manager-julm.postStart = ''
22 ${pkgs.nix}/bin/nix-env --delete-generations +1 --profile /nix/var/nix/profiles/per-user/julm/home-manager
23 '';
24 users.users.julm = {
25 isNormalUser = true;
26 uid = 1000;
27 # Put the hashedPassword in /nix/store, but it will also be in /etc/passwd
28 # which is already world readable.
29 hashedPassword = lib.readFile ../private/world/julm/hashedPassword;
30 extraGroups = [
31 "adbusers"
32 "lp"
33 "networkmanager"
34 "scanner"
35 "tor"
36 "video"
37 "wheel"
38 #"ipfs"
39 config.services.davfs2.davGroup
40 #"vboxusers"
41 ];
42 # If created, zfs-mount.service would require:
43 # zfs set overlay=yes ${hostName}/home
44 createHome = false;
45 openssh.authorizedKeys.keys = map lib.readFile [
46 ../private/shared/ssh/julm/losurdo.pub
47 ];
48 };
49
50 nix = {
51 extraOptions = ''
52 secret-key-files = ${private}/${hostName}/nix/binary-cache/priv.pem
53 '';
54 trustedUsers = [ config.users.users."julm".name ];
55 binaryCaches = [
56 "http://nix-localcache.losurdo.wg"
57 ];
58 binaryCachePublicKeys = map lib.readFile [
59 ../private/shared/nix/losurdo.pub
60 ];
61 };
62 #environment.etc."nixpkgs".source = pkgs.path;
63 #environment.etc."nixpkgs-overlays".source = inputs.self + "/nixpkgs";
64
65 nix.allowedUsers = [ config.users.users."nix-ssh".name ];
66 nix.sshServe = {
67 enable = true;
68 keys = map lib.readFile [
69 ../private/shared/ssh/julm/losurdo.pub
70 ../private/shared/ssh/sevy/patate.pub
71 ../private/shared/ssh/julm/oignon.pub
72 ];
73 };
74
75 environment.systemPackages = [
76 pkgs.riseup-vpn # Can't be installed by home-manager because it needs to install policy-kit rules
77 ];
78
79 boot.extraModulePackages = [
80 #config.boot.kernelPackages.v4l2loopback
81 ];
82
83 programs.fuse.userAllowOther = true;
84 fileSystems."/mnt/losurdo" = {
85 device = "${pkgs.sshfsFuse}/bin/sshfs#julm@losurdo.wg:/";
86 fsType = "fuse";
87 options =
88 # Use the user's gpg-agent session to query
89 # for the password of the SSH key when auto-mounting.
90 let sshAsUser = user:
91 pkgs.writeScript "sshAsUser-${user}" ''
92 exec ${pkgs.sudo}/bin/sudo -i -u ${user} \
93 ${pkgs.openssh}/bin/ssh "$@"
94 '';
95 in [
96 "noatime" "noexec" "nosuid"
97 "user" "uid=julm" "gid=users" "allow_other"
98 "_netdev" "ssh_command=${sshAsUser "julm"}" # "reconnect"
99 "noauto" "x-gvfs-hide" "x-systemd.automount"
100 #"Compression=yes" # YMMV
101 # Disconnect approximately 2*15=30 seconds after a network failure
102 "ServerAliveCountMax=1"
103 "ServerAliveInterval=15"
104 ];
105 };
106
107 services.ipfs = {
108 #enable = true;
109 defaultMode = "online";
110 autoMount = true;
111 enableGC = true;
112 localDiscovery = false;
113 extraConfig = {
114 Datastore.StorageMax = "10GB";
115 Discovery.MDNS.Enabled = false;
116 #Bootstrap = [
117 #];
118 #Swarm.AddrFilters = null;
119 };
120 startWhenNeeded = true;
121 };
122
123 services.udev.packages = [
124 # Allow the console user access the Yubikey USB device node,
125 # needed for challenge/response to work correctly.
126 pkgs.yubikey-personalization
127 ];
128
129 services.xserver = {
130 desktopManager = {
131 session = [
132 # Let the session be generated by home-manager
133 { name = "home-manager";
134 start = ''
135 ${pkgs.runtimeShell} $HOME/.hm-xsession &
136 waitPID=$!
137 '';
138 }
139 ];
140 };
141 displayManager = {
142 defaultSession = "home-manager";
143 #defaultSession = "none+xmonad";
144 #defaultSession = "mate";
145 #defaultSession = "cinnamon";
146 autoLogin = {
147 user = config.users.users.julm.name;
148 };
149 };
150 };
151
152 # This value determines the NixOS release with which your system is to be
153 # compatible, in order to avoid breaking some software such as database
154 # servers. You should change this only after NixOS release notes say you should.
155 system.stateVersion = "20.09"; # Did you read the comment?
156 }