1 { pkgs, lib, config, ... }:
2 let inherit (lib) types;
3 inherit (config.networking) hostName domain;
8 defaults/predictable-interface-names.nix
14 #binaryCaches = lib.mkForce [];
17 # Use gc.automatic to keep disk space under control.
21 options = "--delete-older-than 30d";
24 # WARNING: this is a hack to avoid copying Nixpkgs
25 # a second time into the Nix store.
26 # It makes only sense when Nixpkgs is already in the Nix store,
28 "nixpkgs=${toString pkgs.path}:nixpkgs-overlays=${../nixpkgs}/overlays.nix"
36 packageOverrides = pkgs: {
37 postfix = pkgs.postfix.override {
43 overlays = import ../nixpkgs/overlays.nix;
46 documentation.nixos = {
47 enable = false; # NOTE: useless on a server, and CPU intensive.
51 timeZone = "Europe/Paris";
55 defaultLocale = "fr_FR.UTF-8";
59 font = "Lat2-Terminus16";
63 # Always try to start all the units (default.target)
64 # because systemd's emergency shell does not try to start sshd.
65 # https://wiki.archlinux.org/index.php/systemd#Disable_emergency_mode_on_remote_machine
66 systemd.enableEmergencyMode = false;
68 # This is a remote headless server: always reboot on a kernel panic,
69 # to not have to physically go power cycle the apu2e4.
70 # Which happens if the wrong ZFS password is used
71 # but the boot is manually forced to continue.
72 # Using kernelParams instead of kernel.sysctl
73 # sets this up as soon as the initrd.
74 boot.kernelParams = [ "panic=10" ];
76 boot.cleanTmpDir = true;
77 boot.tmpOnTmpfs = true;
81 # See: https://github.com/NixOS/nixpkgs/issues/10183#issuecomment-537629621
83 "127.0.1.1" = lib.mkForce [ "${hostName}.${domain}" hostName ];
84 "::1" = lib.mkForce [ "${hostName}.${domain}" hostName "localhost" ];
92 passwordAuthentication = false;
104 #checkConfigurationOptions = false;
105 #etc.nixpkgs.source = (pkgs.runCommandLocal "pkgs.path" {propagatedBuildInputs=[pkgs.path]; buildInputs=[pkgs.path];} "mkdir $out");
106 systemPackages = with pkgs; [
107 pkgs.path # WARNING: this is a hack to register the path to Nixpkgs. See nix.nixPath.
126 linuxPackages.cpupower
129 etc."inputrc".text = lib.readFile defaults/readline/inputrc;
134 interactiveShellInit = ''
135 bind '"\e[A":history-search-backward'
136 bind '"\e[B":history-search-forward'
138 # Ignore duplicate commands, ignore commands starting with a space
139 export HISTCONTROL=erasedups:ignorespace
140 export HISTSIZE=42000
142 # Append to the history instead of overwriting (good for multiple connections)
145 # Enable ** file pattern
148 # Convenient mkdir wrapper
149 mkcd() { mkdir -p "$1" && cd "$1"; }
155 ls = "ls --color=tty";
156 mem = "ps -e -orss=,user=,args= | sort -b -k1,1n";
159 s-u="systemctl --user";
161 nixos-clean="sudo nix-collect-garbage -d";
162 nixos-history="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";
163 nixos-rollback="sudo nixos-rebuild switch --rollback";
164 nixos-update="sudo nix-channel --update";
165 nixos-upgrade="sudo nixos-rebuild switch";
166 nixos-upstream="sudo nix-channel --list";
171 pinentryFlavor = "curses";