{ lib, outputs, ... }:
{
  nix = {
    settings = {
      substituters = [
        "https://nix-community.cachix.org"
        "https://cache.nixos.org/"
      ];
      trusted-public-keys = [
        "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      ];
      warn-dirty = lib.mkForce false;
      experimental-features = lib.mkForce [
        "nix-command"
        "flakes"
      ];
      trusted-users = [ "@wheel" ];
    };

    # Garbage collect automatically every week
    gc.automatic = lib.mkDefault true;
    gc.options = lib.mkDefault "--delete-older-than 30d";

    optimise.automatic = lib.mkDefault true;
  };

  # Nixpkgs configuration
  nixpkgs = {
    # add unstable and stable overlays
    overlays = [
      outputs.overlays.nixpkgs-unstable
      outputs.overlays.nixpkgs-stable
    ];
    config = {
      allowUnfree = lib.mkForce true;
      permittedInsecurePackages = [
        # ...
      ];
    };
  };
}