]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/oignon.nix
oignon: update julm's password
[julm/julm-nix.git] / hosts / oignon.nix
1 { config, pkgs, lib, inputs, private, 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 ../private/world/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 secret-key-files = ${private}/${hostName}/nix/binary-cache/priv.pem
46 '';
47 gc = {
48 automatic = true;
49 dates = "weekly";
50 options = "--delete-older-than 7d";
51 };
52 nixPath = [
53 "nixpkgs=/etc/nixpkgs"
54 "nixpkgs-overlays=/etc/nixpkgs-overlays/overlays.nix"
55 ];
56 trustedUsers = [ users.julm.name ];
57 binaryCaches = [ "https://nix-localcache.sourcephile.fr" ];
58 binaryCachePublicKeys = [ "losurdo.sourcephile.fr-1:XGeaIE2AA2mZskSZ5bIDrfx53q+TDDWJOUEpZDX7los=" ];
59 };
60 nix.sshServe = {
61 enable = true;
62 keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOOaag1MS41CRZrAji3K5IDROh5szSo34SDB0HNXGQtX julm@losurdo" ];
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 search = [ "sourcephile.fr" ];
82 networkmanager = {
83 enable = true;
84 #dhcp = "dhcpcd";
85 logLevel = "INFO";
86 wifi = {
87 #backend = "iwd";
88 #backend = "wpa_supplicant";
89 powersave = false;
90 };
91 };
92 firewall = {
93 enable = true;
94 allowPing = false;
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";
105 PAGER = "less -R";
106 SYSTEMD_LESS = "FKMRX";
107 };
108 environment.systemPackages = [
109 pkgs.mkpasswd
110 pkgs.gdb
111 ];
112
113 programs = {
114 bash = {
115 interactiveShellInit = ''
116 bind '"\e[A":history-search-backward'
117 bind '"\e[B":history-search-forward'
118
119 # Ignore duplicate commands, ignore commands starting with a space
120 export HISTCONTROL=erasedups:ignorespace
121 export HISTSIZE=42000
122 # Append to the history instead of overwriting (good for multiple connections)
123 shopt -s histappend
124
125 # Utilities
126 mkcd () { mkdir -p "$1"; cd "$1"; }
127 fan () {
128 if [ $# -gt 0 ]
129 then sudo tee /proc/acpi/ibm/fan <<<"level $1"
130 else grep '^\(level\|speed\):' /proc/acpi/ibm/fan
131 fi
132 acpi -t
133 }
134 '';
135 shellAliases = {
136 cl = "clear";
137 grep = "grep --color";
138 l = "ls -alh";
139 ll = "ls -al";
140 ls = "ls --color=tty";
141 mem = "ps -e -orss=,user=,args= | sort -b -k1,1n";
142
143 s="sudo systemctl";
144 st="sudo systemctl status";
145 u="systemctl --user";
146 j="sudo journalctl -u";
147 jb="sudo journalctl -b";
148
149 nix-history="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";
150 mv = "mv -i";
151 sshfs = "sshfs -o ServerAliveInterval=15 -o reconnect -f";
152 };
153 };
154 dconf.enable = true;
155 mtr.enable = true;
156 };
157
158 services = {
159 avahi = {
160 enable = true;
161 nssmdns = true;
162 openFirewall = false;
163 publish = {
164 enable = false;
165 };
166 };
167 dbus = {
168 packages = [ pkgs.gnome3.dconf ];
169 };
170 gvfs = {
171 enable = true;
172 };
173 journald = {
174 extraConfig = ''
175 Compress=true
176 MaxRetentionSec=1month
177 Storage=persistent
178 SystemMaxUse=100M
179 '';
180 };
181 printing = {
182 enable = true;
183 drivers = [
184 pkgs.gutenprint
185 pkgs.hplip
186 ];
187 };
188 udev = {
189 packages = [
190 # Allow members of the "adbusers" group to mount Android devices via MTP
191 pkgs.android-udev-rules
192 ];
193 };
194 xserver = {
195 enable = true;
196 layout = "fr";
197 xkbOptions = "eurosign:e";
198 libinput.enable = true;
199 desktopManager = {
200 session = [
201 # Let the session be generated by home-manager
202 { name = "home-manager";
203 start = ''
204 ${pkgs.runtimeShell} $HOME/.hm-xsession &
205 waitPID=$!
206 '';
207 }
208 ];
209 };
210 displayManager = {
211 defaultSession = "home-manager";
212 #defaultSession = "none+xmonad";
213 autoLogin = {
214 enable = true;
215 user = users.julm.name;
216 };
217 };
218 };
219 };
220
221 systemd.coredump.enable = true;
222 #environment.enableDebugInfo = true;
223
224 # This value determines the NixOS release with which your system is to be
225 # compatible, in order to avoid breaking some software such as database
226 # servers. You should change this only after NixOS release notes say you should.
227 system.stateVersion = "20.09"; # Did you read the comment?
228 }