]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/oignon.nix
home-manager: nix default host.hardware
[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 allowPing = false;
86 };
87 };
88
89 sound.enable = true;
90 hardware.pulseaudio.enable = true;
91 hardware.sane.enable = true;
92 hardware.sane.extraBackends = [ pkgs.hplipWithPlugin ];
93
94 environment.variables = {
95 EDITOR = "vim";
96 PAGER = "less -R";
97 SYSTEMD_LESS = "FKMRX";
98 };
99 environment.systemPackages = [
100 pkgs.gdb
101 ];
102
103 programs = {
104 bash = {
105 interactiveShellInit = ''
106 bind '"\e[A":history-search-backward'
107 bind '"\e[B":history-search-forward'
108
109 # Ignore duplicate commands, ignore commands starting with a space
110 export HISTCONTROL=erasedups:ignorespace
111 export HISTSIZE=42000
112 # Append to the history instead of overwriting (good for multiple connections)
113 shopt -s histappend
114
115 # Utilities
116 mkcd () { mkdir -p "$1"; cd "$1"; }
117 fan () {
118 if [ $# -gt 0 ]
119 then sudo tee /proc/acpi/ibm/fan <<<"level $1"
120 else grep '^\(level\|speed\):' /proc/acpi/ibm/fan
121 fi
122 acpi -t
123 }
124 '';
125 shellAliases = {
126 cl = "clear";
127 grep = "grep --color";
128 l = "ls -alh";
129 ll = "ls -al";
130 ls = "ls --color=tty";
131 mem = "ps -e -orss=,user=,args= | sort -b -k1,1n";
132
133 s="sudo systemctl";
134 st="sudo systemctl status";
135 u="systemctl --user";
136 j="sudo journalctl -u";
137 jb="sudo journalctl -b";
138
139 nix-history="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";
140 mv = "mv -i";
141 sshfs = "sshfs -o ServerAliveInterval=15 -o reconnect -f";
142 };
143 };
144 dconf.enable = true;
145 mtr.enable = true;
146 };
147
148 services = {
149 avahi = {
150 enable = true;
151 nssmdns = true;
152 openFirewall = false;
153 publish = {
154 enable = false;
155 };
156 };
157 dbus = {
158 packages = [ pkgs.gnome3.dconf ];
159 };
160 gvfs = {
161 enable = true;
162 };
163 journald = {
164 extraConfig = ''
165 Compress=true
166 MaxRetentionSec=1month
167 Storage=persistent
168 SystemMaxUse=100M
169 '';
170 };
171 printing = {
172 enable = true;
173 drivers = [
174 pkgs.gutenprint
175 pkgs.hplip
176 ];
177 };
178 udev = {
179 packages = [
180 # Allow members of the "adbusers" group to mount Android devices via MTP
181 pkgs.android-udev-rules
182 ];
183 };
184 xserver = {
185 enable = true;
186 layout = "fr";
187 xkbOptions = "eurosign:e";
188 libinput.enable = true;
189 desktopManager = {
190 session = [
191 # Let the session be generated by home-manager
192 { name = "home-manager";
193 start = ''
194 ${pkgs.runtimeShell} $HOME/.hm-xsession &
195 waitPID=$!
196 '';
197 }
198 ];
199 };
200 displayManager = {
201 defaultSession = "home-manager";
202 #defaultSession = "none+xmonad";
203 autoLogin = {
204 enable = true;
205 user = users.julm.name;
206 };
207 };
208 };
209 };
210
211 systemd.coredump.enable = true;
212 #environment.enableDebugInfo = true;
213
214 # This value determines the NixOS release with which your system is to be
215 # compatible, in order to avoid breaking some software such as database
216 # servers. You should change this only after NixOS release notes say you should.
217 system.stateVersion = "20.09"; # Did you read the comment?
218 }