{ pkgs, username, lib, ... }: 
{
    # given the users in this list the right to specify additional substituters via:
    #    1. `nixConfig.substituers` in `flake.nix`
    #    2. command line args `--options substituers http://xxx`
    nix.settings.trusted-users = [username];

    # customise /etc/nix/nix.conf declaratively via `nix.settings`
    nix.settings = {
        # enable flakes globally
        experimental-features = ["nix-command" "flakes"];
        auto-optimise-store = true;
        substituters = [
          "https://cache.nixos.org"
          "https://hyprland.cachix.org"
        ];

        trusted-public-keys = [
          "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
          "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
        ];
        builders-use-substitutes = true;
    };

    # do garbage collection weekly to keep disk usage low
    nix.gc = {
        automatic = lib.mkDefault true;
        dates = lib.mkDefault "1 h";
        options = lib.mkDefault "--delete-older-than +3";
    };

    # Allow unfree packages
    nixpkgs.config.allowUnfree = true;
    nixpkgs.config.allowBroken = true;

    nixpkgs.config.permittedInsecurePackages = [
        "dotnet-sdk-6.0.428"
	    "dotnet-runtime-6.0.36"
    ];

}
