blob: 0a703f48506743653ff92d2ce1bf3022330a779f [file] [log] [blame]
# SPDX-FileCopyrightText: 2024 Auxolotl Infrastructure Contributors
# SPDX-FileCopyrightText: 2024 Clicks Codes
#
# SPDX-License-Identifier: GPL-3.0-only
{
description = "Clicks Infrastructure";
inputs = {
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";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs = {
nixpkgs.follows = "unstable";
nixpkgs-stable.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 = with inputs; [ ];
systems.modules.nixos = [
inputs.impermanence.nixosModules.impermanence
inputs.sops-nix.nixosModules.sops
];
deploy = lib.clicks.deploy.mkDeploy {
inherit (inputs) self;
overrides = {
teal.hostname = "teal.alpha.clicks.domains";
};
};
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;
};
});
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;
};
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;
};
};
}