# SPDX-FileCopyrightText: 2024 Auxolotl Infrastructure Contributors
# SPDX-FileCopyrightText: 2024 Clicks Codes
#
# SPDX-License-Identifier: GPL-3.0-only

{
  options,
  config,
  pkgs,
  lib,
  inputs,
  ...
}:
let
  cfg = config.clicks.nix;

  substituters-submodule = lib.types.submodule (
    { name, ... }:
    {
      options = {
        key = lib.mkOption {
          type = lib.types.nullOr lib.types.str;
          default = null;
          description = "The trusted public key for this substituter.";
        };
      };
    }
  );
in
{
  options.clicks.nix = {
    enable = lib.mkEnableOption "Nix configuration";

    default-substituter = {
      url = lib.mkOption {
        type = lib.types.str;
        default = "https://cache.nixos.org";
        description = "The url for the substituter.";
      };
      key = lib.mkOption {
        type = lib.types.str;
        default = "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=";
        description = "The trusted public key for the substituter.";
      };
    };

    extra-substituters = lib.mkOption {
      type = lib.types.attrsOf substituters-submodule;
      default = { };
      description = "Extra substituters to configure.";
    };
  };

  config = lib.mkIf cfg.enable {
    assertions = lib.mapAttrsToList (name: value: {
      assertion = value.key != null;
      message = "auxolotl.nix.extra-substituters.${name}.key must be set";
    }) cfg.extra-substituters;

    nix =
      let
        users = [ "root" ];
      in
      ({
        settings = {
          experimental-features = "nix-command flakes";
          http-connections = 50;
          log-lines = 50;
          auto-optimise-store = true;

          trusted-users = users;
          allowed-users = users;

          substituters = [
            cfg.default-substituter.url
          ] ++ (lib.mapAttrsToList (name: value: name) cfg.extra-substituters);

          trusted-public-keys = [
            cfg.default-substituter.key
          ] ++ (lib.mapAttrsToList (name: value: value.key) cfg.extra-substituters);
        };

        gc = {
          automatic = true;
          dates = "weekly";
          options = "--delete-older-than 30d";
        };

        # flake-utils-plus
      } // (lib.optionalAttrs cfg.enable {
        generateRegistryFromInputs = true;
        generateNixPathFromInputs = true;
        linkInputs = true;
      }));
  };
}
