blob: 0a703f48506743653ff92d2ce1bf3022330a779f [file] [log] [blame]
Skyler Greyf08a6192024-06-01 23:55:20 +00001# SPDX-FileCopyrightText: 2024 Auxolotl Infrastructure Contributors
2# SPDX-FileCopyrightText: 2024 Clicks Codes
3#
4# SPDX-License-Identifier: GPL-3.0-only
5
6{
Skyler Grey02c195e2024-06-22 01:35:26 +00007 description = "Clicks Infrastructure";
Skyler Greyf08a6192024-06-01 23:55:20 +00008
9 inputs = {
Skyler Greyf08a6192024-06-01 23:55:20 +000010 deploy-rs = {
11 url = "github:serokell/deploy-rs";
12 inputs.nixpkgs.follows = "nixpkgs";
13 };
Skyler Greyd3377402024-06-06 22:01:26 +000014
Skyler Greyd7e1acd2024-06-22 14:42:11 +000015 home-manager = {
16 url = "github:nix-community/home-manager";
17 inputs.nixpkgs.follows = "nixpkgs";
18 };
19
20 flake-utils.url = "github:numtide/flake-utils";
21
22 impermanence.url = "github:nix-community/impermanence";
23
24 nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
25
Skyler Greye6a8c712024-06-22 01:41:28 +000026 snowfall-lib = {
27 url = "github:snowfallorg/lib";
28 inputs.nixpkgs.follows = "nixpkgs";
29 };
30
Skyler Grey82ea8052024-06-08 22:56:00 +000031 sops-nix = {
32 url = "github:Mic92/sops-nix";
33 inputs = {
34 nixpkgs.follows = "unstable";
35 nixpkgs-stable.follows = "nixpkgs";
36 };
37 };
38
Skyler Greyd7e1acd2024-06-22 14:42:11 +000039 unstable.url = "github:nixos/nixpkgs/nixos-unstable";
Skyler Grey3299e4f2024-07-04 00:33:43 +000040
41 aux--docs-site = {
42 url = "git+https://git.auxolotl.org/auxolotl/docs-site";
43 inputs.nixpkgs.follows = "nixpkgs";
44 inputs.snowfall-lib.follows = "snowfall-lib";
45 inputs.wiki.follows = "aux--wiki";
46 };
47 aux--wiki = {
48 url = "git+https://git.auxolotl.org/auxolotl/wiki";
49 flake = false;
50 };
Skyler Greyf08a6192024-06-01 23:55:20 +000051 };
52
53 outputs =
54 inputs:
55 let
Skyler Greye6a8c712024-06-22 01:41:28 +000056 lib = (inputs.snowfall-lib.mkLib {
Skyler Greyf08a6192024-06-01 23:55:20 +000057 inherit inputs;
58
59 src = ./.;
60
61 snowfall = {
62 namespace = "clicks";
63 };
Skyler Greye6a8c712024-06-22 01:41:28 +000064 }).snowfall.internal.system-lib;
Skyler Greyf08a6192024-06-01 23:55:20 +000065 in
66 lib.mkFlake {
67 overlays = with inputs; [ ];
68
Skyler Grey82ea8052024-06-08 22:56:00 +000069 systems.modules.nixos = [
70 inputs.impermanence.nixosModules.impermanence
71 inputs.sops-nix.nixosModules.sops
72 ];
Skyler Greyd3377402024-06-06 22:01:26 +000073
Skyler Greye6a8c712024-06-22 01:41:28 +000074 deploy = lib.clicks.deploy.mkDeploy {
Skyler Greyf08a6192024-06-01 23:55:20 +000075 inherit (inputs) self;
76 overrides = {
Skyler Grey8ef34812024-06-09 19:42:15 +000077 teal.hostname = "teal.alpha.clicks.domains";
Skyler Greyf08a6192024-06-01 23:55:20 +000078 };
79 };
80
Skyler Greye6a8c712024-06-22 01:41:28 +000081 outputs-builder = channels: {
82 specs = let
83 nixFiles = lib.snowfall.fs.get-nix-files-recursive ./.;
84 specFiles = builtins.filter (lib.clicks.strings.endsWith ".spec.nix") nixFiles;
85 importedSpecs = lib.forEach specFiles (file: {
86 name = builtins.unsafeDiscardStringContext (builtins.baseNameOf file);
87 value = import file {
88 inherit channels lib;
89 };
90 });
91 in builtins.listToAttrs importedSpecs;
Skyler Greyf08a6192024-06-01 23:55:20 +000092
Skyler Greye6a8c712024-06-22 01:41:28 +000093 formatter = channels.nixpkgs.nixfmt-rfc-style;
94
95 checks = let
96 allChecks = {
97 deploy-rs = lib.deploy-rs.${channels.nixpkgs.system}.deployChecks inputs.self.deploy;
98 clicks = lib.clicks.checks channels.nixpkgs;
99 };
100
101 mergedChecks = lib.trivial.pipe allChecks [
102 (lib.attrsets.mapAttrsToList (sourceName: (lib.attrsets.mapAttrsToList (checkName: value: {
103 name = "${sourceName}:${checkName}";
104 inherit value;
105 }))))
106 lib.lists.flatten
107 builtins.listToAttrs
108 ];
109 in mergedChecks;
110 };
Skyler Greyf08a6192024-06-01 23:55:20 +0000111 };
112}