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