]> Git — Sourcephile - julm/julm-nix.git/blob - machines/oignon.nix
bash: move utilities to home-manager
[julm/julm-nix.git] / machines / oignon.nix
1 { config, pkgs, inputs, machineName, ... }:
2 let
3 inherit (config.users) users;
4 in
5 {
6 imports = [
7 oignon/hardware.nix
8 ];
9
10 users.mutableUsers = false;
11 users.users.julm = {
12 isNormalUser = true;
13 uid = 1000;
14 # Put the hashedPassword in /nix/store, but it will also be in /etc/passwd
15 # which is already world readable.
16 hashedPassword = builtins.readFile ../secrets/julm/hashedPassword;
17 extraGroups = [
18 "wheel"
19 "networkmanager"
20 #"vboxusers"
21 ];
22 # If created, zfs-mount.service would require:
23 # zfs set overlay=yes ${machineName}/home
24 createHome = false;
25 };
26
27 nix = {
28 extraOptions = ''
29 auto-optimise-store = true
30 '';
31 gc = {
32 automatic = true;
33 dates = "weekly";
34 options = "--delete-older-than 7d";
35 };
36 nixPath = [
37 "nixpkgs=/etc/nixpkgs"
38 "nixpkgs-overlays=/etc/nixpkgs-overlays/overlays.nix"
39 ];
40 trustedUsers = [ users.julm.name ];
41 };
42 environment.etc."nixpkgs".source = pkgs.path;
43 environment.etc."nixpkgs-overlays".source = inputs.self + "/nixpkgs";
44
45 nixpkgs.config = {
46 allowUnfree = false;
47 };
48
49 time.timeZone = "Europe/Paris";
50 i18n.defaultLocale = "fr_FR.UTF-8";
51 console.font = "Lat2-Terminus16";
52 console.keyMap = "fr";
53
54 networking = {
55 hostName = machineName;
56 domain = "localdomain";
57 networkmanager = {
58 enable = true;
59 #dhcp = "dhcpcd";
60 logLevel = "INFO";
61 wifi = {
62 #backend = "iwd";
63 #backend = "wpa_supplicant";
64 powersave = false;
65 };
66 };
67 firewall = {
68 enable = true;
69 };
70 };
71
72 sound.enable = true;
73 hardware.pulseaudio.enable = true;
74
75 environment.variables = {
76 EDITOR = "vim";
77 PAGER = "less -R";
78 SYSTEMD_LESS = "FKMRX";
79 };
80 environment.systemPackages = with pkgs; [
81 acpi
82 binutils
83 bmon
84 coreutils
85 cryptsetup
86 curl
87 direnv
88 dstat
89 e2fsprogs
90 file
91 glib # gio
92 gvfs
93 gnumake
94 gnupg
95 gparted
96 hicolor-icon-theme
97 home-manager
98 htop
99 less
100 libfaketime
101 lsof
102 man
103 miniupnpc
104 mosh
105 ncdu
106 ncurses
107 nmon
108 ntfs3g
109 pasystray
110 pavucontrol
111 pciutils
112 powertop
113 procps
114 python
115 sudo
116 tig
117 tmux
118 tree
119 utillinux
120 vim
121 wget
122 which
123 xdg_utils
124 xsel
125 zfs
126 ];
127
128 programs = {
129 bash = {
130 interactiveShellInit = ''
131 bind '"\e[A":history-search-backward'
132 bind '"\e[B":history-search-forward'
133
134 # Ignore duplicate commands, ignore commands starting with a space
135 export HISTCONTROL=erasedups:ignorespace
136 export HISTSIZE=42000
137 # Append to the history instead of overwriting (good for multiple connections)
138 shopt -s histappend
139 '';
140 shellAliases = {
141 cl = "clear";
142 l = "ls -alh";
143 ll = "ls -al";
144 ls = "ls --color=tty";
145 mem = "ps -e -orss=,user=,args= | sort -b -k1,1n";
146
147 s="sudo systemctl";
148 st="sudo systemctl status";
149 s-u="systemctl --user";
150 j="sudo journalctl -u";
151
152 nix-clean="sudo nix-collect-garbage -d";
153 nix-catalog="sudo nix-channel --list";
154 nix-history="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";
155 nix-rollback="sudo nixos-rebuild switch --rollback";
156 nix-update="sudo nix-channel --update";
157 nix-upgrade="sudo nixos-rebuild switch";
158 nix-upstream="sudo nix-channel --list";
159 nix-config="gvim ~/.config/nixos/*.nix";
160 };
161 };
162 dconf.enable = true;
163 gnupg.agent = {
164 enable = true;
165 enableSSHSupport = true;
166 };
167 mtr.enable = true;
168 };
169
170 services = {
171 avahi = {
172 enable = true;
173 nssmdns = true;
174 };
175 dbus = {
176 packages = [ pkgs.gnome3.dconf ];
177 };
178 gvfs = {
179 enable = true;
180 };
181 journald = {
182 extraConfig = ''
183 Compress=true
184 MaxRetentionSec=1month
185 Storage=persistent
186 SystemMaxUse=100M
187 '';
188 };
189 physlock = {
190 enable = true;
191 allowAnyUser = true;
192 # NOTE: xfconf-query -c xfce4-session -p /general/LockCommand -s "physlock" --create -t string
193 };
194 printing = {
195 enable = true;
196 drivers = [
197 pkgs.gutenprint
198 pkgs.hplip
199 ];
200 };
201 sanoid = {
202 enable = true;
203 extraArgs = [ "--verbose" ];
204 datasets = {
205 "${machineName}/home" = {
206 autosnap = true;
207 autoprune = true;
208 hourly = 12;
209 daily = 7;
210 monthly = 0;
211 yearly = 0;
212 recursive = true;
213 };
214 "${machineName}/var" = {
215 autosnap = true;
216 autoprune = true;
217 hourly = 12;
218 daily = 7;
219 monthly = 0;
220 yearly = 0;
221 recursive = true;
222 };
223 };
224 };
225 xserver = {
226 enable = true;
227 layout = "fr";
228 xkbOptions = "eurosign:e";
229 libinput.enable = true;
230 desktopManager = {
231 session = [
232 # Let the session be generated by home-manager
233 { name = "home-manager";
234 start = ''
235 ${pkgs.runtimeShell} $HOME/.hm-xsession &
236 waitPID=$!
237 '';
238 }
239 ];
240 xfce = {
241 enable = false;
242 /*
243 thunarPlugins = [
244 pkgs.xfce.thunar-archive-plugin
245 ];
246 */
247 };
248 xterm.enable = false;
249 };
250 displayManager = {
251 defaultSession = "home-manager";
252 #defaultSession = "none+xmonad";
253 autoLogin = {
254 enable = true;
255 user = users.julm.name;
256 };
257 };
258 };
259 };
260
261 #virtualisation.virtualbox.host.enable = true;
262
263 # This value determines the NixOS release with which your system is to be
264 # compatible, in order to avoid breaking some software such as database
265 # servers. You should change this only after NixOS release notes say you should.
266 system.stateVersion = "20.09"; # Did you read the comment?
267 }