{ config, lib, nixpkgs, ... }:
{
  nix = {
    # expose all flake inputs through nix Path and registry
    registry = {
      nixpkgs.flake = nixpkgs;
    };
    nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
    distributedBuilds = true;
    settings = {
      extra-platforms = [ "aarch64-linux" ];
      auto-optimise-store = true;
      system-features = [ "big-parallel" ];
      experimental-features = [ "nix-command" "flakes" ];
      substituters = [
        "https://cache.rfive.de"
        "https://cache.ifsr.de"
        "https://nix-community.cachix.org"
      ];
      trusted-public-keys = [
        "cache.rfive.de:of5d+o6mfGXQSR3lk6ApfDBr4ampAUaNHux1O/XY3Tw="
        "cache.ifsr.de:y55KBAMF4YkjIzXwYOKVk9fcQS+CZ9RM1zAAMYQJtsg="
        "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      ];
      trusted-users = [
        "@wheel"
      ];
    };
    # buildMachines = [
    #   # {
    #   #   hostName = "quitte.ifsr.de";
    #   #   sshUser = "rouven.seifert";
    #   #   system = "x86_64-linux";
    #   #   protocol = "ssh-ng";
    #   #   supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
    #   #   maxJobs = 4;
    #   #   speedFactor = 10;
    #   # }
    #   {
    #     hostName = "fujitsu.vpn.rfive.de";
    #     system = "x86_64-linux";
    #     protocol = "ssh-ng";
    #     supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ];
    #     maxJobs = 4;
    #     speedFactor = 5;
    #   }
    # ];
    # extraOptions = ''
    #   builders-use-substitutes = true
    # '';
  };
}