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