{
  config,
  pkgs,
  inputs,
  ...
}:
{
  nix = {
    channel.enable = false; # remove nix-channel related tools & configs, we use flakes instead.
    gc = {
      automatic = true;
      dates = "Sat *-*-* 00:00:00";
      options =
        if config.networking.hostName == "baker" then
          "--delete-older-than 30d"
        else
          "--delete-older-than 7d";
      persistent = true;
    };
    optimise = {
      automatic = true;
      dates = [ "Mon *-*-* 00:00:00" ];
    };
    # make `nix run nixpkgs#nixpkgs` use the same nixpkgs as the one used by this flake.
    # registry.nixpkgs.flake = nixpkgs;
    settings = {
      experimental-features = [
        "nix-command"
        "flakes"
      ];
      # https://github.com/NixOS/nix/issues/9574
      # nix-path = lib.mkForce "nixpkgs=/etc/nix/inputs/nixpkgs";
    };
  };

  system.autoUpgrade = {
    allowReboot = true;
    flake = "git+https://gitlab.com/marvinroman/nixos-configuration";
    flags = [
      "--update-input"
      "mysecrets"
    ];
    dates = if config.networking.hostName == "baker" then "*-*-* 00:00:00" else "*-*-* 00:15:00";
    enable = true;
  };
}