]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/oignon.nix
home-manager: update
[julm/julm-nix.git] / hosts / oignon.nix
1 { config, pkgs, lib, inputs, private, hostName, ... }:
2 let
3 inherit (config.users) users;
4 inherit (config.services) davfs2;
5 in
6 {
7 imports = [
8 ../profiles/dnscrypt-proxy2.nix
9 ../profiles/security.nix
10 ../networking/wireguard/wg-intra.nix
11 oignon/hardware.nix
12 oignon/wireguard.nix
13 oignon/tor.nix
14 oignon/backup.nix
15 ];
16
17 home-manager.users.julm = {
18 imports = [
19 ../homes/julm.nix
20 inputs.nix-doom-emacs.hmModule
21 ];
22 host.hardware = ["ThinkPad" "X201"];
23 };
24 systemd.services.home-manager-julm.postStart = ''
25 ${pkgs.nix}/bin/nix-env --delete-generations +1 --profile /nix/var/nix/profiles/per-user/julm/home-manager
26 '';
27 security.lockKernelModules = false;
28 users.mutableUsers = false;
29 users.users.julm = {
30 isNormalUser = true;
31 uid = 1000;
32 # Put the hashedPassword in /nix/store, but it will also be in /etc/passwd
33 # which is already world readable.
34 hashedPassword = lib.readFile ../private/world/julm/hashedPassword;
35 extraGroups = [
36 "adbusers"
37 "lp"
38 "networkmanager"
39 "scanner"
40 "tor"
41 "video"
42 "wheel"
43 #"ipfs"
44 davfs2.davGroup
45 #"vboxusers"
46 ];
47 # If created, zfs-mount.service would require:
48 # zfs set overlay=yes ${hostName}/home
49 createHome = false;
50 };
51
52 nix = {
53 extraOptions = ''
54 secret-key-files = ${private}/${hostName}/nix/binary-cache/priv.pem
55 '';
56 autoOptimiseStore = true;
57 gc = {
58 automatic = true;
59 dates = "weekly";
60 options = "--delete-older-than 7d";
61 };
62 nixPath = [
63 "nixpkgs=/etc/nixpkgs"
64 "nixpkgs-overlays=/etc/nixpkgs-overlays/overlays.nix"
65 ];
66 trustedUsers = [ users.julm.name ];
67 binaryCaches = [ "http://nix-localcache.losurdo.wg" ];
68 binaryCachePublicKeys = [ "losurdo.sourcephile.fr-1:XGeaIE2AA2mZskSZ5bIDrfx53q+TDDWJOUEpZDX7los=" ];
69 };
70 documentation = {
71 enable = true;
72 dev.enable = true;
73 doc.enable = true;
74 info.enable = false;
75 man.enable = true;
76 nixos.enable = false;
77 };
78 nix.sshServe = {
79 enable = true;
80 keys = [ (lib.readFile ../private/world/julm/losurdo/ssh.pub) ];
81 };
82 users.users.julm.openssh.authorizedKeys.keys = [
83 (lib.readFile ../private/world/julm/losurdo/ssh.pub)
84 ];
85 services.openssh.openFirewall = false;
86 services.openssh.forwardX11 = true;
87 services.openssh.passwordAuthentication = false;
88
89 environment.etc."nixpkgs".source = pkgs.path;
90 environment.etc."nixpkgs-overlays".source = inputs.self + "/nixpkgs";
91
92 time.timeZone = "Europe/Paris";
93 i18n.defaultLocale = "fr_FR.UTF-8";
94 console.font = "Lat2-Terminus16";
95 console.keyMap = "fr";
96
97 networking = {
98 hostName = hostName;
99 domain = "localdomain";
100 search = [ "sourcephile.fr" ];
101 networkmanager = {
102 enable = true;
103 #dhcp = "dhcpcd";
104 logLevel = "INFO";
105 wifi = {
106 #backend = "iwd";
107 #backend = "wpa_supplicant";
108 powersave = false;
109 };
110 };
111 firewall = {
112 enable = true;
113 allowPing = false;
114 };
115 };
116
117 sound.enable = true;
118 hardware.pulseaudio.enable = true;
119 hardware.sane.enable = true;
120 hardware.sane.extraBackends = [ pkgs.hplipWithPlugin ];
121
122 environment.variables = {
123 EDITOR = "vim";
124 PAGER = "less -R";
125 SYSTEMD_LESS = "FKMRX";
126 };
127 environment.systemPackages = [
128 pkgs.mkpasswd
129 pkgs.gdb
130 pkgs.riseup-vpn
131 #pkgs.calyx-vpn
132 ];
133
134 programs = {
135 bash = {
136 interactiveShellInit = ''
137 bind '"\e[A":history-search-backward'
138 bind '"\e[B":history-search-forward'
139
140 # Ignore duplicate commands, ignore commands starting with a space
141 export HISTCONTROL=erasedups:ignorespace
142 export HISTSIZE=42000
143 # Append to the history instead of overwriting (good for multiple connections)
144 shopt -s histappend
145
146 # Utilities
147 mkcd () { mkdir -p "$1"; cd "$1"; }
148 fan () {
149 if [ $# -gt 0 ]
150 then sudo tee /proc/acpi/ibm/fan <<<"level $1"
151 else grep '^\(level\|speed\):' /proc/acpi/ibm/fan
152 fi
153 acpi -t
154 }
155 '';
156 shellAliases = {
157 cl = "clear";
158 grep = "grep --color";
159 l = "ls -alh";
160 ll = "ls -al";
161 ls = "ls --color=tty";
162 mem = "ps -e -orss=,user=,args= | sort -b -k1,1n";
163
164 s="sudo systemctl";
165 st="sudo systemctl status";
166 u="systemctl --user";
167 j="sudo journalctl -u";
168 jb="sudo journalctl -b";
169
170 nix-history="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";
171 mv = "mv -i";
172 sshfs = "sshfs -o ServerAliveInterval=15 -o reconnect -f";
173 };
174 };
175 dconf.enable = true;
176 mtr.enable = true;
177 };
178
179 services.avahi = {
180 enable = true;
181 nssmdns = true;
182 openFirewall = false;
183 publish = {
184 enable = false;
185 };
186 };
187 services.davfs2 = {
188 enable = true;
189 extraConfig = ''
190 '';
191 };
192 fileSystems."/home/julm/mnt/ilico/severine" = {
193 device = "https://nuage.ilico.org/remote.php/dav/files/severine/";
194 fsType = "davfs";
195 options =
196 let conf = pkgs.writeText "davfs2.conf" ''
197 backup_dir /home/julm/documents/backup/ilico/severine
198 cache_dir /home/julm/.cache/davfs2/ilico/severine
199 ''; in
200 [ "conf=${conf}" "user" "noexec" "nosuid" "noauto" ]; # "x-systemd.automount"
201 };
202 services.dbus = {
203 packages = [ pkgs.gnome3.dconf ];
204 };
205 services.gvfs = {
206 enable = true;
207 };
208 services.ipfs = {
209 #enable = true;
210 defaultMode = "online";
211 autoMount = true;
212 enableGC = true;
213 localDiscovery = false;
214 extraConfig = {
215 Datastore.StorageMax = "10GB";
216 Discovery.MDNS.Enabled = false;
217 #Bootstrap = [
218 #];
219 #Swarm.AddrFilters = null;
220 };
221 startWhenNeeded = true;
222 };
223 services.journald = {
224 extraConfig = ''
225 Compress=true
226 MaxRetentionSec=1month
227 Storage=persistent
228 SystemMaxUse=100M
229 '';
230 };
231 services.printing = {
232 enable = true;
233 drivers = [
234 pkgs.gutenprint
235 pkgs.hplip
236 ];
237 };
238 services.udev = {
239 packages = [
240 # Allow members of the "adbusers" group to mount Android devices via MTP.
241 pkgs.android-udev-rules
242 # Allow the console user access the Yubikey USB device node,
243 # needed for challenge/response to work correctly.
244 pkgs.yubikey-personalization
245 ];
246 };
247 services.xserver = {
248 enable = true;
249 layout = "fr";
250 xkbOptions = "eurosign:e";
251 libinput.enable = true;
252 desktopManager = {
253 session = [
254 # Let the session be generated by home-manager
255 { name = "home-manager";
256 start = ''
257 ${pkgs.runtimeShell} $HOME/.hm-xsession &
258 waitPID=$!
259 '';
260 }
261 ];
262 };
263 displayManager = {
264 defaultSession = "home-manager";
265 #defaultSession = "none+xmonad";
266 autoLogin = {
267 enable = true;
268 user = users.julm.name;
269 };
270 };
271 };
272
273 systemd.coredump.enable = true;
274 #environment.enableDebugInfo = true;
275
276 # This value determines the NixOS release with which your system is to be
277 # compatible, in order to avoid breaking some software such as database
278 # servers. You should change this only after NixOS release notes say you should.
279 system.stateVersion = "20.09"; # Did you read the comment?
280 }