{
  config,
  lib,
  pkgs,
  ...
}:

let
  inherit (config.programs) neovim;
  inherit (lib) mkDefault mkIf;
in
{
  environment = {
    variables = {
      BROWSER = "echo";
      EDITOR = mkIf neovim.enable "nvim";
      VISUAL = mkIf neovim.enable "nvim";
    };
    shellAliases = {
      v = mkIf neovim.enable "nvim";
    };
    # do not install /lib/ld-linux.so.2 and /lib64/ld-linux-x86-64.so.2
    stub-ld.enable = mkDefault false;
  };

  documentation = {
    enable = mkDefault false;
    nixos.enable = mkDefault false;
    doc.enable = mkDefault false;
    info.enable = mkDefault false;
    man.enable = mkDefault false;
  };

  fonts.fontconfig.enable = mkDefault false;

  xdg.autostart.enable = mkDefault false;
  xdg.icons.enable = mkDefault false;
  xdg.menus.enable = mkDefault false;
  xdg.mime.enable = mkDefault false;
  xdg.sounds.enable = mkDefault false;

  programs.git.package = mkDefault pkgs.gitMinimal;

  programs.neovim = {
    enable = mkDefault true;
    defaultEditor = mkDefault true;
    vimAlias = mkDefault true;
    viAlias = mkDefault true;
  };

  # emergency mode is useless on headless machines
  systemd.enableEmergencyMode = false;
  boot.initrd.systemd.suppressedUnits = mkIf config.systemd.enableEmergencyMode [
    "emergency.service"
    "emergency.target"
  ];

  systemd.sleep.extraConfig = ''
    AllowSuspend=no
    AllowHibernation=no
  '';

  # force reboots
  systemd.settings.Manager = {
    RuntimeWatchdogSec = mkDefault "15s";
    RebootWatchdogSec = mkDefault "30s";
    KExecWatchdogSec = mkDefault "1m";
  };
}
