]> Git — Sourcephile - julm/julm-nix.git/blob - hosts/oignon.nix
avahi: disable openFirewall
[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 openFirewall = false;
152 publish = {
153 enable = false;
154 };
155 };
156 dbus = {
157 packages = [ pkgs.gnome3.dconf ];
158 };
159 gvfs = {
160 enable = true;
161 };
162 journald = {
163 extraConfig = ''
164 Compress=true
165 MaxRetentionSec=1month
166 Storage=persistent
167 SystemMaxUse=100M
168 '';
169 };
170 printing = {
171 enable = true;
172 drivers = [
173 pkgs.gutenprint
174 pkgs.hplip
175 ];
176 };
177 udev = {
178 packages = [
179 # Allow members of the "adbusers" group to mount Android devices via MTP
180 pkgs.android-udev-rules
181 ];
182 };
183 xserver = {
184 enable = true;
185 layout = "fr";
186 xkbOptions = "eurosign:e";
187 libinput.enable = true;
188 desktopManager = {
189 session = [
190 # Let the session be generated by home-manager
191 { name = "home-manager";
192 start = ''
193 ${pkgs.runtimeShell} $HOME/.hm-xsession &
194 waitPID=$!
195 '';
196 }
197 ];
198 };
199 displayManager = {
200 defaultSession = "home-manager";
201 #defaultSession = "none+xmonad";
202 autoLogin = {
203 enable = true;
204 user = users.julm.name;
205 };
206 };
207 };
208 };
209
210 systemd.coredump.enable = true;
211 #environment.enableDebugInfo = true;
212
213 # This value determines the NixOS release with which your system is to be
214 # compatible, in order to avoid breaking some software such as database
215 # servers. You should change this only after NixOS release notes say you should.
216 system.stateVersion = "20.09"; # Did you read the comment?
217 }