Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 1 | # SPDX-FileCopyrightText: 2024 Auxolotl Infrastructure Contributors |
| 2 | # SPDX-FileCopyrightText: 2024 Clicks Codes |
| 3 | # |
| 4 | # SPDX-License-Identifier: GPL-3.0-only |
| 5 | |
| 6 | { |
Skyler Grey | 02c195e | 2024-06-22 01:35:26 +0000 | [diff] [blame] | 7 | description = "Clicks Infrastructure"; |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 8 | |
| 9 | inputs = { |
Skyler Grey | 67cf8aa | 2024-07-28 13:21:32 +0000 | [diff] [blame^] | 10 | agenix.url = "github:ryantm/agenix"; |
| 11 | |
| 12 | agenix-rekey = { |
| 13 | url = "github:oddlama/agenix-rekey"; |
| 14 | inputs.nixpkgs.follows = "nixpkgs"; |
| 15 | }; |
| 16 | |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 17 | deploy-rs = { |
| 18 | url = "github:serokell/deploy-rs"; |
| 19 | inputs.nixpkgs.follows = "nixpkgs"; |
| 20 | }; |
Skyler Grey | d337740 | 2024-06-06 22:01:26 +0000 | [diff] [blame] | 21 | |
Skyler Grey | d7e1acd | 2024-06-22 14:42:11 +0000 | [diff] [blame] | 22 | home-manager = { |
| 23 | url = "github:nix-community/home-manager"; |
| 24 | inputs.nixpkgs.follows = "nixpkgs"; |
| 25 | }; |
| 26 | |
| 27 | flake-utils.url = "github:numtide/flake-utils"; |
| 28 | |
| 29 | impermanence.url = "github:nix-community/impermanence"; |
| 30 | |
| 31 | nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; |
| 32 | |
Skyler Grey | e6a8c71 | 2024-06-22 01:41:28 +0000 | [diff] [blame] | 33 | snowfall-lib = { |
| 34 | url = "github:snowfallorg/lib"; |
| 35 | inputs.nixpkgs.follows = "nixpkgs"; |
| 36 | }; |
| 37 | |
Skyler Grey | d7e1acd | 2024-06-22 14:42:11 +0000 | [diff] [blame] | 38 | unstable.url = "github:nixos/nixpkgs/nixos-unstable"; |
Skyler Grey | 3299e4f | 2024-07-04 00:33:43 +0000 | [diff] [blame] | 39 | |
| 40 | aux--docs-site = { |
| 41 | url = "git+https://git.auxolotl.org/auxolotl/docs-site"; |
| 42 | inputs.nixpkgs.follows = "nixpkgs"; |
| 43 | inputs.snowfall-lib.follows = "snowfall-lib"; |
| 44 | inputs.wiki.follows = "aux--wiki"; |
| 45 | }; |
| 46 | aux--wiki = { |
| 47 | url = "git+https://git.auxolotl.org/auxolotl/wiki"; |
| 48 | flake = false; |
| 49 | }; |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | outputs = |
| 53 | inputs: |
| 54 | let |
Skyler Grey | e6a8c71 | 2024-06-22 01:41:28 +0000 | [diff] [blame] | 55 | lib = (inputs.snowfall-lib.mkLib { |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 56 | inherit inputs; |
| 57 | |
| 58 | src = ./.; |
| 59 | |
| 60 | snowfall = { |
| 61 | namespace = "clicks"; |
| 62 | }; |
Skyler Grey | e6a8c71 | 2024-06-22 01:41:28 +0000 | [diff] [blame] | 63 | }).snowfall.internal.system-lib; |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 64 | in |
| 65 | lib.mkFlake { |
Skyler Grey | 67cf8aa | 2024-07-28 13:21:32 +0000 | [diff] [blame^] | 66 | overlays = [ |
| 67 | inputs.agenix-rekey.overlays.default |
| 68 | ]; |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 69 | |
Skyler Grey | 82ea805 | 2024-06-08 22:56:00 +0000 | [diff] [blame] | 70 | systems.modules.nixos = [ |
Skyler Grey | 67cf8aa | 2024-07-28 13:21:32 +0000 | [diff] [blame^] | 71 | inputs.agenix.nixosModules.default |
| 72 | inputs.agenix-rekey.nixosModules.default |
Skyler Grey | 82ea805 | 2024-06-08 22:56:00 +0000 | [diff] [blame] | 73 | inputs.impermanence.nixosModules.impermanence |
Skyler Grey | 82ea805 | 2024-06-08 22:56:00 +0000 | [diff] [blame] | 74 | ]; |
Skyler Grey | d337740 | 2024-06-06 22:01:26 +0000 | [diff] [blame] | 75 | |
Skyler Grey | e6a8c71 | 2024-06-22 01:41:28 +0000 | [diff] [blame] | 76 | deploy = lib.clicks.deploy.mkDeploy { |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 77 | inherit (inputs) self; |
| 78 | overrides = { |
Skyler Grey | 8ef3481 | 2024-06-09 19:42:15 +0000 | [diff] [blame] | 79 | teal.hostname = "teal.alpha.clicks.domains"; |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 80 | }; |
| 81 | }; |
| 82 | |
Skyler Grey | 67cf8aa | 2024-07-28 13:21:32 +0000 | [diff] [blame^] | 83 | agenix-rekey = inputs.agenix-rekey.configure { |
| 84 | userFlake = inputs.self // { outPath = lib.pipe "" [ |
| 85 | lib.snowfall.fs.get-snowfall-file |
| 86 | (lib.strings.removeSuffix "/") |
| 87 | ]; }; |
| 88 | nodes = inputs.self.nixosConfigurations; |
| 89 | }; |
| 90 | |
Skyler Grey | e6a8c71 | 2024-06-22 01:41:28 +0000 | [diff] [blame] | 91 | outputs-builder = channels: { |
| 92 | specs = let |
| 93 | nixFiles = lib.snowfall.fs.get-nix-files-recursive ./.; |
| 94 | specFiles = builtins.filter (lib.clicks.strings.endsWith ".spec.nix") nixFiles; |
| 95 | importedSpecs = lib.forEach specFiles (file: { |
| 96 | name = builtins.unsafeDiscardStringContext (builtins.baseNameOf file); |
| 97 | value = import file { |
| 98 | inherit channels lib; |
| 99 | }; |
| 100 | }); |
| 101 | in builtins.listToAttrs importedSpecs; |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 102 | |
Skyler Grey | e6a8c71 | 2024-06-22 01:41:28 +0000 | [diff] [blame] | 103 | formatter = channels.nixpkgs.nixfmt-rfc-style; |
| 104 | |
| 105 | checks = let |
| 106 | allChecks = { |
| 107 | deploy-rs = lib.deploy-rs.${channels.nixpkgs.system}.deployChecks inputs.self.deploy; |
| 108 | clicks = lib.clicks.checks channels.nixpkgs; |
| 109 | }; |
| 110 | |
| 111 | mergedChecks = lib.trivial.pipe allChecks [ |
| 112 | (lib.attrsets.mapAttrsToList (sourceName: (lib.attrsets.mapAttrsToList (checkName: value: { |
| 113 | name = "${sourceName}:${checkName}"; |
| 114 | inherit value; |
| 115 | })))) |
| 116 | lib.lists.flatten |
| 117 | builtins.listToAttrs |
| 118 | ]; |
| 119 | in mergedChecks; |
| 120 | }; |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 121 | }; |
| 122 | } |