blob: 00c6592e41e0c1b258e87b18468ab43f9673e52f [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 = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
};
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";
};
};
impermanence.url = "github:nix-community/impermanence";
};
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;
};
};
}