blob: b22ff26e33aacf543c80c634c4638f27203e0f60 [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";
};
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;
};
};
}