{ config, pkgs, lib, ... }:
{
  # How NUR (or unstable) can be imported without `niv`.
  #nixpkgs.config.packageOverrides = pkgs: {
  #  nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
  #    inherit pkgs;
  #  };
  #};

  nixpkgs.config.packageOverrides = pkgs: {
    # Import NUR with niv.
    nur = import (import ../nix/sources.nix).NUR {
      inherit pkgs;
    };
    # Import unstable with niv.
    unstable = import (import ../nix/sources.nix).unstable {
      inherit pkgs;

      # "unstable" `nixpkgs.config` has to be configured here where we import it.
      # https://github.com/NixOS/nixpkgs/issues/69347#issuecomment-534573461
      config = {

#        allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
#          # Required for unstable.obsidian (see obsidan.nix)
#          "obsidian"
#        ];
#        permittedInsecurePackages = [
#          # Required for unstable.obsidian (see obsidan.nix)
#          "electron-25.9.0"
#        ];

      };
    };
  };

  #environment.systemPackages = with pkgs; [
  #  # Example NUR usage:
  #  nur.repos.mic92.hello-nur
  #  # Example unstable usage:
  #  unstable.nano
  #];
}
