{ ... }:
{
  nixpkgs.config.allowUnfree = true;

  nix.settings = {
    sandbox = "relaxed";
    experimental-features = [
      "nix-command"
      "flakes"
    ];
    # Optimising during every build can race on Darwin. Run it separately instead.
    auto-optimise-store = false;
    trusted-users = [
      "imnyang"
    ];
    substituters = [
      "https://cache.mizuki.guru"
      "https://nix.mizuki.my/public"
    ];
    trusted-public-keys = [
      "cache.mizuki.guru-1:EbUC9b0ryD7BJKqfT8fl4GoS2ojLV+hI9fW1al5Whp0="
      "public:SnHrtrxbCPcZujbJdgsKFeObTfRKQl5KhrI+LljtZUE="
    ];
  };

  nix.optimise.automatic = true;

  nix.gc = {
    automatic = true;
    interval = {
      Weekday = 0;
      Hour = 3;
      Minute = 15;
    };
    options = "--delete-older-than 7d";
  };
}
