]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/oignon.nix
systemd: make coredumps usable
[julm/julm-nix.git] / hosts / oignon.nix
1 { config, pkgs, lib, inputs, hostName, ... }:
2 let inherit (config.users) users; in
3 {
4 imports = [
5 ../profiles/dnscrypt-proxy2.nix
6 oignon/hardware.nix
7 oignon/tor.nix
8 oignon/backup.nix
9 ];
10
11 home-manager.users.julm = {
12 imports = [ ../homes/julm.nix ];
13 host.name = hostName;
14 host.hardware = ["ThinkPad" "X201"];
15 };
16 systemd.services.home-manager-julm.postStart = ''
17 ${pkgs.nix}/bin/nix-env --delete-generations +1 --profile /nix/var/nix/profiles/per-user/julm/home-manager
18 '';
19 users.mutableUsers = false;
20 users.users.julm = {
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 ../secrets/julm/hashedPassword;
26 extraGroups = [
27 "adbusers"
28 "lp"
29 "networkmanager"
30 "scanner"
31 "tor"
32 "video"
33 "wheel"
34 "networkmanager"
35 #"vboxusers"
36 ];
37 # If created, zfs-mount.service would require:
38 # zfs set overlay=yes ${hostName}/home
39 createHome = false;
40 };
41
42 nix = {
43 extraOptions = ''
44 auto-optimise-store = true
45 '';
46 gc = {
47 automatic = true;
48 dates = "weekly";
49 options = "--delete-older-than 7d";
50 };
51 nixPath = [
52 "nixpkgs=/etc/nixpkgs"
53 "nixpkgs-overlays=/etc/nixpkgs-overlays/overlays.nix"
54 ];
55 trustedUsers = [ users.julm.name ];
56 };
57 environment.etc."nixpkgs".source = pkgs.path;
58 environment.etc."nixpkgs-overlays".source = inputs.self + "/nixpkgs";
59
60 nixpkgs.config = {
61 allowUnfree = true;
62 };
63 documentation.nixos.enable = true;
64 time.timeZone = "Europe/Paris";
65 i18n.defaultLocale = "fr_FR.UTF-8";
66 console.font = "Lat2-Terminus16";
67 console.keyMap = "fr";
68
69 networking = {
70 hostName = hostName;
71 domain = "localdomain";
72 search = [ "sourcephile.fr" ];
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 };
86 };
87
88 sound.enable = true;
89 hardware.pulseaudio.enable = true;
90 hardware.sane.enable = true;
91 hardware.sane.extraBackends = [ pkgs.hplipWithPlugin ];
92
93 environment.variables = {
94 EDITOR = "vim";
95 PAGER = "less -R";
96 SYSTEMD_LESS = "FKMRX";
97 };
98 environment.systemPackages = [
99 pkgs.gdb
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 printing = {
167 enable = true;
168 drivers = [
169 pkgs.gutenprint
170 pkgs.hplip
171 ];
172 };
173 udev = {
174 packages = [
175 # Allow members of the "adbusers" group to mount Android devices via MTP
176 pkgs.android-udev-rules
177 ];
178 };
179 xserver = {
180 enable = true;
181 layout = "fr";
182 xkbOptions = "eurosign:e";
183 libinput.enable = true;
184 desktopManager = {
185 session = [
186 # Let the session be generated by home-manager
187 { name = "home-manager";
188 start = ''
189 ${pkgs.runtimeShell} $HOME/.hm-xsession &
190 waitPID=$!
191 '';
192 }
193 ];
194 };
195 displayManager = {
196 defaultSession = "home-manager";
197 #defaultSession = "none+xmonad";
198 autoLogin = {
199 enable = true;
200 user = users.julm.name;
201 };
202 };
203 };
204 };
205
206 systemd.coredump.enable = true;
207 #environment.enableDebugInfo = true;
208
209 # This value determines the NixOS release with which your system is to be
210 # compatible, in order to avoid breaking some software such as database
211 # servers. You should change this only after NixOS release notes say you should.
212 system.stateVersion = "20.09"; # Did you read the comment?
213 }