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