1 { pkgs, lib, config, ... }:
2 let inherit (lib) types;
7 defaults/predictable-interface-names.nix
11 deployment.name = lib.mkOption {
12 type = types.enum ["production"];
13 default = "production";
19 #binaryCaches = lib.mkForce [];
22 # Use gc.automatic to keep disk space under control.
26 options = "--delete-older-than 30d";
29 # WARNING: this is a hack to avoid copying Nixpkgs
30 # a second time into the Nix store.
31 # It makes only sense when Nixpkgs is already in the Nix store,
33 "nixpkgs=${toString pkgs.path}"
41 packageOverrides = pkgs: {
42 postfix = pkgs.postfix.override {
48 overlays = import ./overlays.nix;
51 documentation.nixos = {
52 enable = false; # NOTE: useless on a server, and CPU intensive.
56 timeZone = "Europe/Paris";
60 defaultLocale = "fr_FR.UTF-8";
64 font = "Lat2-Terminus16";
68 # Always try to start all the units (default.target)
69 # because systemd's emergency shell does not try to start sshd.
70 # https://wiki.archlinux.org/index.php/systemd#Disable_emergency_mode_on_remote_machine
71 systemd.enableEmergencyMode = false;
73 # This is a remote headless server: always reboot on a kernel panic,
74 # to not have to physically go power cycle the apu2e4.
75 # Which happens if the wrong ZFS password is used
76 # but the boot is manually forced to continue.
77 # Using kernelParams instead of kernel.sysctl
78 # sets this up as soon as the initrd.
79 boot.kernelParams = [ "panic=10" ];
81 boot.cleanTmpDir = true;
82 boot.tmpOnTmpfs = true;
87 passwordAuthentication = false;
99 #checkConfigurationOptions = false;
100 #etc.nixpkgs.source = (pkgs.runCommandLocal "pkgs.path" {propagatedBuildInputs=[pkgs.path]; buildInputs=[pkgs.path];} "mkdir $out");
101 systemPackages = with pkgs; [
102 pkgs.path # WARNING: this is a hack to register the path to Nixpkgs. See nix.nixPath.
120 linuxPackages.cpupower
123 etc."inputrc".text = lib.readFile defaults/readline/inputrc;
128 interactiveShellInit = ''
129 bind '"\e[A":history-search-backward'
130 bind '"\e[B":history-search-forward'
132 # Ignore duplicate commands, ignore commands starting with a space
133 export HISTCONTROL=erasedups:ignorespace
134 export HISTSIZE=42000
136 # Append to the history instead of overwriting (good for multiple connections)
139 # Enable ** file pattern
142 # Convenient mkdir wrapper
143 mkcd() { mkdir -p "$1" && cd "$1"; }
149 ls = "ls --color=tty";
150 mem = "ps -e -orss=,user=,args= | sort -b -k1,1n";
153 s-u="systemctl --user";
155 nixos-clean="sudo nix-collect-garbage -d";
156 nixos-history="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";
157 nixos-rollback="sudo nixos-rebuild switch --rollback";
158 nixos-update="sudo nix-channel --update";
159 nixos-upgrade="sudo nixos-rebuild switch";
160 nixos-upstream="sudo nix-channel --list";
165 pinentryFlavor = "curses";