1 {pkgs, lib, config, system, ...}:
2 let inherit (builtins.extraBuiltins) pass;
4 inherit (config) networking;
5 inherit (config.services) dovecot2;
6 userPass = name: pass "${networking.domainBase}/${networking.hostName}/login/${name}";
9 <nixpkgs-commonsoft/install/modules.nix>
10 ../overlays/tools/networking/shorewall/service.nix
11 ../overlays/tools/networking/shorewall6/service.nix
12 ../overlays/servers/mail/rspamd/service.nix
28 enable = lib.mkEnableOption "friot";
29 networking.domainBase = lib.mkOption {
31 description = "Base network name.";
34 networking.domainAliases = lib.mkOption {
35 type = types.listOf types.str;
36 description = "Domain aliases.";
37 example = [ "example.org" "example.net" ];
39 networking.zones = lib.mkOption {
40 type = types.attrsOf (types.submodule ({name, options, config, ...}: {
42 iface = lib.mkOption {
44 description = "Interface name.";
49 description = "Static IPv4 address of the machine.";
54 description = "Static IPv6 address of the machine.";
64 auto-optimise-store = true
69 options = "--delete-older-than 30d";
76 packageOverrides = pkgs: {
77 postfix = pkgs.postfix.override {
82 overlays = import ../overlays.nix;
88 enable = config.deployment.targetEnv != "virtualbox";
91 authorizedKeys = [ (pass "${networking.domain}/ssh/pub/julm") ];
98 "vm.vfs_cache_pressure" = 50;
104 timeZone = "Europe/Paris";
108 consoleFont = "Lat2-Terminus16";
109 consoleKeyMap = "fr";
110 defaultLocale = "fr_FR.UTF-8";
114 domainBase = "commonsoft";
115 domain = "${networking.domainBase}.org";
117 "${networking.domainBase}.net"
118 "${networking.domainBase}.coop"
123 mutableUsers = false;
125 root.initialPassword = userPass "root";
126 root.password = config.users.users.root.initialPassword;
129 extraGroups = [ "sudo" ];
130 description = "Julien Moutinho";
132 shell = lib.mkDefault config.users.defaultUserShell;
133 group = "users"; # FIXME: unknown group
134 initialPassword = userPass "julm";
135 password = config.users.users.julm.initialPassword;
140 gid = config.users.users.julm.uid;
147 enable = false; # NOTE: useless on this machine, and CPU intensive.
177 (dom: map (sub: "${sub}.${dom}")
178 ["www" "git" "mail"])
179 ([networking.domain] ++ networking.domainAliases)
180 ++ networking.domainAliases;
183 # "root@${networking.domain}" = [ "test@${networking.domain}" ];
184 # "postmaster@${networking.domain}" = [ "test@${networking.domain}" ];
185 # "abuse@${networking.domain}" = [ "test@${networking.domain}" ];
187 #dovecot2.domains = {
188 # "${networking.domain}" = {
191 # password = pass "${networking.domain}/mail/julm";
192 # # "${networking.domain}/dovecot2/julm";
193 # # "{SSHA512}uyjL1KYx4z7HpfNvnKzuVxpMLD2KVueGGBvOcj7AF1EZCTVhT++IIKUVOC4xpZtWdqVD0OVmZqgYr2qpn/3t3Aj4oU0=";
194 # aliases = ["julien.moutinho@${networking.domain}"];
198 # password = pass "${networking.domain}/mail/test";
199 # # "${networking.domain}/dovecot2/test";
200 # # "{SSHA512}uyjL1KYx4z7HpfNvnKzuVxpMLD2KVueGGBvOcj7AF1EZCTVhT++IIKUVOC4xpZtWdqVD0OVmZqgYr2qpn/3t3Aj4oU0=";
201 # aliases = ["test-alias@${networking.domain}"];
210 systemPackages = with pkgs; [
244 etc."inputrc".text = ''
245 # /etc/inputrc - global inputrc for libreadline
246 # See readline(3readline) and `info rluserman' for more information.
252 # To allow the use of 8bit-characters like the german umlauts, uncomment
253 # the line below. However this makes the meta key not work as a meta key,
254 # which is annoying to those which don't need to type in 8-bit characters.
256 # set convert-meta off
258 # try to enable the application keypad when it is called. Some systems
259 # need this to enable the arrow keys.
260 # set enable-keypad on
262 # see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys
264 # do not bell on tab-completion
265 # set bell-style none
266 # set bell-style visible
268 # some defaults / modifications for the emacs mode
271 # allow the use of the Home/End keys
272 "\e[1~": beginning-of-line
275 # allow the use of the Delete/Insert keys
277 "\e[2~": quoted-insert
279 # mappings for "page up" and "page down" to step to the beginning/end
281 # "\e[5~": beginning-of-history
282 # "\e[6~": end-of-history
284 # alternate mappings for "page up" and "page down" to search the history
285 # "\e[5~": history-search-backward
286 # "\e[6~": history-search-forward
288 # mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
289 "\e[1;5C": forward-word
290 "\e[1;5D": backward-word
291 "\e[5C": forward-word
292 "\e[5D": backward-word
293 "\e\e[C": forward-word
294 "\e\e[D": backward-word
297 "\e[7~": beginning-of-line
300 "\eOd": backward-word
303 # for non RH/Debian xterm, can't hurt for RH/Debian xterm
304 # "\eOH": beginning-of-line
305 # "\eOF": end-of-line
307 # for freebsd console
308 # "\e[H": beginning-of-line
309 # "\e[F": end-of-line
317 interactiveShellInit = ''
318 bind '"\e[A":history-search-backward'
319 bind '"\e[B":history-search-forward'
321 # Ignore duplicate commands, ignore commands starting with a space
322 export HISTCONTROL=erasedups:ignorespace
323 export HISTSIZE=42000
324 # Append to the history instead of overwriting (good for multiple connections)
331 ls = "ls --color=tty";
334 s-u="systemctl --user";
336 nix-clean="sudo nix-collect-garbage -d";
337 nix-history="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";
338 nix-rollback="sudo nixos-rebuild switch --rollback";
339 nix-update="sudo nix-channel --update";
340 nix-upgrade="sudo nixos-rebuild switch";
341 nix-upstream="sudo nix-channel --list";
342 nix-config="gvim ~/.config/nixos/*.nix";
351 enableSSHSupport = true;