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