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