]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/oignon.nix
nixpkgs: update
[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/security.nix
6 ../nixos/profiles/wireguard/wg-intra.nix
7 oignon/hardware.nix
8 oignon/wireguard.nix
9 oignon/tor.nix
10 oignon/backup.nix
11 ];
12
13 home-manager.users.julm = {
14 imports = [ ../homes/julm.nix ];
15 host.hardware = [ "ThinkPad" "X201" ];
16 };
17 systemd.services.home-manager-julm.postStart = ''
18 ${pkgs.nix}/bin/nix-env --delete-generations +1 --profile /nix/var/nix/profiles/per-user/julm/home-manager
19 '';
20 security.lockKernelModules = false;
21 users.mutableUsers = false;
22 users.users.julm = {
23 isNormalUser = true;
24 uid = 1000;
25 # Put the hashedPassword in /nix/store, but it will also be in /etc/passwd
26 # which is already world readable.
27 hashedPassword = lib.readFile ../private/world/julm/hashedPassword;
28 extraGroups = [
29 "adbusers"
30 "lp"
31 "networkmanager"
32 "scanner"
33 "tor"
34 "video"
35 "wheel"
36 #"ipfs"
37 config.services.davfs2.davGroup
38 #"vboxusers"
39 ];
40 # If created, zfs-mount.service would require:
41 # zfs set overlay=yes ${hostName}/home
42 createHome = false;
43 };
44
45 nix = {
46 extraOptions = ''
47 secret-key-files = ${private}/${hostName}/nix/binary-cache/priv.pem
48 '';
49 autoOptimiseStore = true;
50 gc.automatic = true;
51 gc.dates = "weekly";
52 gc.options = "--delete-older-than 7d";
53 nixPath = lib.mkForce [];
54 trustedUsers = [ config.users.users.julm.name ];
55 binaryCaches = [ "http://nix-localcache.losurdo.wg" ];
56 binaryCachePublicKeys = [ "losurdo.sourcephile.fr-1:XGeaIE2AA2mZskSZ5bIDrfx53q+TDDWJOUEpZDX7los=" ];
57 };
58 #environment.etc."nixpkgs".source = pkgs.path;
59 #environment.etc."nixpkgs-overlays".source = inputs.self + "/nixpkgs";
60
61 documentation = {
62 enable = true;
63 dev.enable = true;
64 doc.enable = true;
65 info.enable = false;
66 man.enable = true;
67 nixos.enable = false;
68 };
69 nix.sshServe = {
70 enable = true;
71 keys = [ (lib.readFile ../private/world/julm/losurdo/ssh.pub) ];
72 };
73 users.users.julm.openssh.authorizedKeys.keys = [
74 (lib.readFile ../private/world/julm/losurdo/ssh.pub)
75 ];
76
77 time.timeZone = "Europe/Paris";
78 i18n.defaultLocale = "fr_FR.UTF-8";
79 console.font = "Lat2-Terminus16";
80 console.keyMap = "fr";
81
82 networking = {
83 hostName = hostName;
84 domain = "localdomain";
85 search = [ "sourcephile.fr" ];
86 networkmanager = {
87 enable = true;
88 #dhcp = "dhcpcd";
89 logLevel = "INFO";
90 wifi = {
91 #backend = "iwd";
92 #backend = "wpa_supplicant";
93 powersave = false;
94 };
95 };
96 firewall = {
97 enable = true;
98 allowPing = true;
99 };
100 };
101
102 sound.enable = true;
103 hardware.pulseaudio.enable = true;
104 hardware.sane.enable = true;
105 hardware.sane.extraBackends = [ pkgs.hplipWithPlugin ];
106
107 environment.variables = {
108 EDITOR = "vim";
109 PAGER = "less -R";
110 SYSTEMD_LESS = "FKMRX";
111 };
112
113 programs.bash.interactiveShellInit = ''
114 fan () {
115 if [ $# -gt 0 ]
116 then sudo tee /proc/acpi/ibm/fan <<<"level $1"
117 else grep '^\(level\|speed\):' /proc/acpi/ibm/fan
118 fi
119 acpi -t
120 }
121 '';
122 programs.dconf.enable = true;
123 programs.mtr.enable = true;
124
125 services.avahi = {
126 enable = true;
127 nssmdns = true;
128 openFirewall = false;
129 publish = {
130 enable = false;
131 };
132 };
133 services.davfs2.enable = true;
134 fileSystems."/home/julm/mnt/ilico/severine" = {
135 device = "https://nuage.ilico.org/remote.php/dav/files/severine/";
136 fsType = "davfs";
137 options =
138 let conf = pkgs.writeText "davfs2.conf" ''
139 backup_dir /home/julm/documents/backup/ilico/severine
140 cache_dir /home/julm/.cache/davfs2/ilico/severine
141 ''; in
142 [ "conf=${conf}" "user" "noexec" "nosuid" "noauto" ]; # "x-systemd.automount"
143 };
144 programs.fuse.userAllowOther = true;
145 fileSystems."/mnt/losurdo" = {
146 device = "${pkgs.sshfsFuse}/bin/sshfs#julm@losurdo.wg:/";
147 fsType = "fuse";
148 options =
149 # Use the user's gpg-agent session to query
150 # for the password of the SSH key when auto-mounting.
151 let sshAsUser = user:
152 pkgs.writeScript "sshAsUser-${user}" ''
153 exec ${pkgs.sudo}/bin/sudo -i -u ${user} \
154 ${pkgs.openssh}/bin/ssh "$@"
155 '';
156 in [
157 "noatime" "noexec" "nosuid"
158 "user" "uid=julm" "gid=users" "allow_other"
159 "_netdev" "reconnect" "ssh_command=${sshAsUser "julm"}"
160 "noauto" "x-gvfs-hide" "x-systemd.automount"
161 #"Compression=yes" # YMMV
162 # Disconnect approximately 2*15=30 seconds after a network failure
163 "ServerAliveCountMax=2"
164 "ServerAliveInterval=15"
165 ];
166 };
167 services.dbus = {
168 packages = [ pkgs.gnome3.dconf ];
169 };
170 services.gvfs.enable = true;
171 services.ipfs = {
172 #enable = true;
173 defaultMode = "online";
174 autoMount = true;
175 enableGC = true;
176 localDiscovery = false;
177 extraConfig = {
178 Datastore.StorageMax = "10GB";
179 Discovery.MDNS.Enabled = false;
180 #Bootstrap = [
181 #];
182 #Swarm.AddrFilters = null;
183 };
184 startWhenNeeded = true;
185 };
186 services.openssh = {
187 forwardX11 = true;
188 };
189 services.printing = {
190 enable = true;
191 drivers = [
192 pkgs.gutenprint
193 pkgs.hplip
194 ];
195 };
196 services.udev = {
197 packages = [
198 # Allow members of the "adbusers" group to mount Android devices via MTP.
199 pkgs.android-udev-rules
200 # Allow the console user access the Yubikey USB device node,
201 # needed for challenge/response to work correctly.
202 pkgs.yubikey-personalization
203 ];
204 };
205 services.xserver = {
206 enable = true;
207 layout = "fr";
208 xkbOptions = "eurosign:e";
209 libinput.enable = true;
210 desktopManager = {
211 session = [
212 # Let the session be generated by home-manager
213 { name = "home-manager";
214 start = ''
215 ${pkgs.runtimeShell} $HOME/.hm-xsession &
216 waitPID=$!
217 '';
218 }
219 ];
220 };
221 displayManager = {
222 defaultSession = "home-manager";
223 #defaultSession = "none+xmonad";
224 autoLogin = {
225 enable = true;
226 user = config.users.users.julm.name;
227 };
228 };
229 };
230
231 systemd.coredump.enable = true;
232 #environment.enableDebugInfo = true;
233
234 # This value determines the NixOS release with which your system is to be
235 # compatible, in order to avoid breaking some software such as database
236 # servers. You should change this only after NixOS release notes say you should.
237 system.stateVersion = "20.09"; # Did you read the comment?
238 }