# 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";
    };

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

    headscale = {
      url = "github:juanfont/headscale?ref=refs/tags/v0.24.0-beta.2";
      inputs.nixpkgs.follows = "unstable";
      inputs.flake-utils.follows = "flake-utils";
    };

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

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

    lix-module = {
      url = "git+https://git.lix.systems/lix-project/nixos-module?ref=refs/tags/2.91.1-2";
      inputs.nixpkgs.follows = "nixpkgs";
    };

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

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

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

    whisk.url = "github:freshlybakedcake/whisk";


    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...
        }
        inputs.lix-module.nixosModules.default
      ];

      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;
      };
    };
}
