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

{
  description = "Clicks Infrastructure";

  inputs = {
    agenix.url = "github:ryantm/agenix";

    agenix-rekey = {
      url = "github:oddlama/agenix-rekey";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    deploy-rs = {
      url = "github:serokell/deploy-rs";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    flake-utils.url = "github:numtide/flake-utils";

    impermanence.url = "github:nix-community/impermanence";

    nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";

    snowfall-lib = {
      url = "github:snowfallorg/lib";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    unstable.url = "github:nixos/nixpkgs/nixos-unstable";

    aux--docs-site = {
      url = "git+https://git.auxolotl.org/auxolotl/docs-site";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.snowfall-lib.follows = "snowfall-lib";
      inputs.wiki.follows = "aux--wiki";
    };
    aux--wiki = {
      url = "git+https://git.auxolotl.org/auxolotl/wiki";
      flake = false;
    };
  };

  outputs =
    inputs:
    let
      lib = (inputs.snowfall-lib.mkLib {
        inherit inputs;

        src = ./.;

        snowfall = {
          namespace = "clicks";
        };
      }).snowfall.internal.system-lib;
    in
    lib.mkFlake {
      overlays = [
        inputs.agenix-rekey.overlays.default 
      ];

      systems.modules.nixos = [
        inputs.agenix.nixosModules.default
        inputs.agenix-rekey.nixosModules.default
        inputs.impermanence.nixosModules.impermanence
        {
          config.clicks.defaults.enable = true;
          # set defaults that are clicks-specific, such as our backups module
          # being enabled...
        }
      ];

      deploy = lib.clicks.deploy.mkDeploy {
        inherit (inputs) self;
        overrides = {
          teal.hostname = "teal.alpha.clicks.domains";
        };
      };

      agenix-rekey = inputs.agenix-rekey.configure {
        userFlake = inputs.self // { outPath = lib.pipe "" [
          lib.snowfall.fs.get-snowfall-file
          (lib.strings.removeSuffix "/")
        ]; };
        nodes = inputs.self.nixosConfigurations;
      };

      outputs-builder = channels: {
        specs = let
          nixFiles = lib.snowfall.fs.get-nix-files-recursive ./.;
          specFiles = builtins.filter (lib.clicks.strings.endsWith ".spec.nix") nixFiles;
          importedSpecs = lib.forEach specFiles (file: {
            name = builtins.unsafeDiscardStringContext (builtins.baseNameOf file);
            value = import file {
              inherit channels lib inputs;
            };
          });
        in builtins.listToAttrs importedSpecs;

        formatter = channels.nixpkgs.nixfmt-rfc-style;

        checks = let
          allChecks = {
            deploy-rs = lib.deploy-rs.${channels.nixpkgs.system}.deployChecks inputs.self.deploy;
            clicks = lib.clicks.checks channels.nixpkgs;
            adhoc = let
              nixFiles = lib.snowfall.fs.get-nix-files-recursive ./.;
              checkFiles = builtins.filter (lib.clicks.strings.endsWith ".check.nix") nixFiles;
              importedChecks = lib.forEach checkFiles (file: {
                name = builtins.unsafeDiscardStringContext (builtins.baseNameOf file);
                value = import file {
                  inherit channels lib inputs;
                };
              });
            in builtins.listToAttrs importedChecks;
          };

          mergedChecks = lib.trivial.pipe allChecks [
            (lib.attrsets.mapAttrsToList (sourceName: (lib.attrsets.mapAttrsToList (checkName: value: {
              name = "${sourceName}:${checkName}";
              inherit value;
            }))))
            lib.lists.flatten
            builtins.listToAttrs
          ];
        in mergedChecks;
      };
    };
}
