]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/patate.nix
emacs: enable elfeed
[julm/julm-nix.git] / hosts / patate.nix
1 { config, pkgs, lib, inputs, hostName, ... }:
2 {
3 imports = [
4 ../nixos/profiles/dnscrypt-proxy2.nix
5 ../nixos/profiles/security.nix
6 ../nixos/profiles/wireguard/wg-intra.nix
7 patate/backup.nix
8 patate/hardware.nix
9 ];
10
11 home-manager.users.sevy = {
12 imports = [ ../homes/sevy.nix ];
13 host.hardware = ["ThinkPad" "X200"];
14 };
15 systemd.services.home-manager-sevy.postStart = ''
16 ${pkgs.nix}/bin/nix-env --delete-generations +1 --profile /nix/var/nix/profiles/per-user/sevy/home-manager
17 '';
18 security.lockKernelModules = false;
19 users.mutableUsers = false;
20 users.users.sevy = {
21 isNormalUser = true;
22 uid = 1000;
23 # Put the hashedPassword in /nix/store, but it will also be in /etc/passwd
24 # which is already world readable.
25 hashedPassword = lib.readFile ../private/world/sevy/hashedPassword;
26 extraGroups = [
27 "adbusers"
28 config.services.davfs2.davGroup
29 "lp"
30 "networkmanager"
31 "scanner"
32 "systemd-journal"
33 "tor"
34 "vboxusers"
35 "video"
36 "wheel"
37 ];
38 };
39
40 nix = {
41 extraOptions = ''
42 '';
43 autoOptimiseStore = true;
44 gc.automatic = true;
45 gc.dates = "weekly";
46 gc.options = "--delete-older-than 7d";
47 nixPath = lib.mkForce [ ];
48 trustedUsers = [ users.sevy.name ];
49 binaryCaches = [
50 "http://nix-localcache.losurdo.wg"
51 "ssh://nix-ssh@oignon.wg"
52 ];
53 binaryCachePublicKeys = [
54 "losurdo.sourcephile.fr-1:XGeaIE2AA2mZskSZ5bIDrfx53q+TDDWJOUEpZDX7los="
55 "oignon.sourcephile.fr:slxL7XLsGXlD1r6gvw1imL5uQntW0TTlQgGQt3LBJgQ="
56 ];
57 };
58 services.openssh.passwordAuthentication = false;
59
60 environment.systemPackages = [
61 pkgs.riseup-vpn
62 ];
63
64 documentation.nixos.enable = true;
65 time.timeZone = "Europe/Paris";
66 i18n.defaultLocale = "fr_FR.UTF-8";
67 console.font = "Lat2-Terminus16";
68 console.keyMap = "fr";
69
70 networking = {
71 hostName = hostName;
72 domain = "localdomain";
73 networkmanager = {
74 enable = true;
75 #dhcp = "dhcpcd";
76 logLevel = "INFO";
77 wifi = {
78 #backend = "iwd";
79 #backend = "wpa_supplicant";
80 powersave = false;
81 };
82 };
83 firewall = {
84 enable = true;
85 allowPing = false;
86 allowedTCPPorts = [
87 51413 # transmission-gtk
88 4662 # edonkey
89 ];
90 allowedUDPPorts = [
91 51413 # transmission-gtk
92 4667 # edonkey
93 4672 # edonkey
94 ];
95 };
96 };
97
98 sound.enable = true;
99 hardware.pulseaudio.enable = true;
100 hardware.sane.enable = true;
101 hardware.sane.extraBackends = [ pkgs.hplipWithPlugin ];
102
103 environment.variables = {
104 EDITOR = "vim -g";
105 PAGER = "less -R";
106 SYSTEMD_LESS = "FKMRX";
107 };
108
109 programs = {
110 bash = {
111 interactiveShellInit = ''
112 bind '"\e[A":history-search-backward'
113 bind '"\e[B":history-search-forward'
114
115 # Ignore duplicate commands, ignore commands starting with a space
116 export HISTCONTROL=erasedups:ignorespace
117 export HISTSIZE=42000
118 # Append to the history instead of overwriting (good for multiple connections)
119 shopt -s histappend
120
121 # Utilities
122 mkcd () { mkdir -p "$1"; cd "$1"; }
123 fan () {
124 if [ $# -gt 0 ]
125 then sudo tee /proc/acpi/ibm/fan <<<"level $1"
126 else grep '^\(level\|speed\):' /proc/acpi/ibm/fan
127 fi
128 acpi -t
129 }
130 '';
131 shellAliases = {
132 cl = "clear";
133 grep = "grep --color";
134 l = "ls -alh";
135 ll = "ls -al";
136 ls = "ls --color=tty";
137 mem = "ps -e -orss=,user=,args= | sort -b -k1,1n";
138
139 s="sudo systemctl";
140 st="sudo systemctl status";
141 u="systemctl --user";
142 j="sudo journalctl -u";
143 jb="sudo journalctl -b";
144
145 nix-history="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";
146 mv = "mv -i";
147 sshfs = "sshfs -o ServerAliveInterval=15 -o reconnect -f";
148 };
149 };
150 dconf.enable = true;
151 mtr.enable = true;
152 };
153
154 services.avahi = {
155 enable = true;
156 nssmdns = true;
157 openFirewall = false;
158 publish = {
159 enable = false;
160 };
161 };
162 services.davfs2.enable = true;
163 fileSystems."/home/sevy/mnt/ilico/severine" = {
164 device = "https://nuage.ilico.org/remote.php/dav/files/severine/";
165 fsType = "davfs";
166 options =
167 let conf = pkgs.writeText "davfs2.conf" ''
168 backup_dir /home/sevy/Documents/EnTransfert/ilico/severine
169 cache_dir /home/sevy/.cache/davfs2/ilico/severine
170 ''; in
171 [ "conf=${conf}" "user" "noexec" "nosuid" "noauto" ]; # "x-systemd.automount"
172 };
173 services.dbus = {
174 packages = [ pkgs.gnome3.dconf ];
175 };
176 services.gvfs = {
177 enable = true;
178 };
179 services.journald = {
180 extraConfig = ''
181 Compress=true
182 MaxRetentionSec=1month
183 Storage=persistent
184 SystemMaxUse=100M
185 '';
186 };
187 services.physlock = {
188 enable = true;
189 allowAnyUser = true;
190 # NOTE: xfconf-query -c xfce4-session -p /general/LockCommand -s "physlock" --create -t string
191 };
192 services.printing = {
193 enable = true;
194 drivers = [
195 pkgs.gutenprint
196 pkgs.hplip
197 ];
198 };
199 services.udev = {
200 packages = [
201 # Allow members of the "adbusers" group to mount Android devices via MTP
202 pkgs.android-udev-rules
203 ];
204 };
205 services.xserver = {
206 enable = true;
207 layout = "fr";
208 xkbOptions = "eurosign:e";
209 libinput.enable = true;
210 desktopManager = {
211 xfce = {
212 enable = true;
213 thunarPlugins = [
214 #pkgs.xfce.thunar-archive-plugin
215 ];
216 };
217 xterm.enable = false;
218 };
219 displayManager = {
220 defaultSession = "xfce";
221 autoLogin = {
222 enable = true;
223 user = config.users.users.sevy.name;
224 };
225 };
226 };
227
228 virtualisation.virtualbox.host.enable = true;
229
230 # This value determines the NixOS release with which your system is to be
231 # compatible, in order to avoid breaking some software such as database
232 # servers. You should change this only after NixOS release notes say you should.
233 system.stateVersion = "20.03"; # Did you read the comment?
234 }