let
  sources = import ./Sources.nix { sourcesFile = ./Sources.json; };

  config = {
    allowAliases = true;
    allowBroken = true;
    allowUnfree = true;
    checkMeta = true;
    cudaSupport = true;
  };

  system = __currentSystem;

in {
  nixos-23_05 = import sources.nixos-23_05 {
    inherit system config;
    overlays = [
      (_: _: { inherit sources; })

      (import ./Functions.nix)

      # override pinned deps with our sources, this must come before other
      # package overlays, because of the 'null' from 'overrideSource'
      (_: pkgs: pkgs.overridePinnedDeps pkgs.overrideSource)

      (import ./Deps.nix)
      (import ./Python.nix)
      (import ./Haskell.nix)
    ];
  };

  nixos-23_11 = import sources.nixos-23_11 {
    inherit system config;
    overlays = [
      (_: _: { inherit sources; })
      (import ./Functions.nix)
      (import ./Deps.nix)
    ];
  };

  nixos-unstable-small = import sources.nixos-unstable-small {
    inherit system config;
    overlays = [
      (_: _: { inherit sources; })
      (import ./Functions.nix)
      (import ./Deps.nix)
    ];
  };

}