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 | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 10 | deploy-rs = { |
| 11 | url = "github:serokell/deploy-rs"; |
| 12 | inputs.nixpkgs.follows = "nixpkgs"; |
| 13 | }; |
Skyler Grey | d337740 | 2024-06-06 22:01:26 +0000 | [diff] [blame] | 14 | |
Skyler Grey | d7e1acd | 2024-06-22 14:42:11 +0000 | [diff] [blame] | 15 | 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 Grey | e6a8c71 | 2024-06-22 01:41:28 +0000 | [diff] [blame] | 26 | snowfall-lib = { |
| 27 | url = "github:snowfallorg/lib"; |
| 28 | inputs.nixpkgs.follows = "nixpkgs"; |
| 29 | }; |
| 30 | |
Skyler Grey | 82ea805 | 2024-06-08 22:56:00 +0000 | [diff] [blame] | 31 | sops-nix = { |
| 32 | url = "github:Mic92/sops-nix"; |
| 33 | inputs = { |
| 34 | nixpkgs.follows = "unstable"; |
| 35 | nixpkgs-stable.follows = "nixpkgs"; |
| 36 | }; |
| 37 | }; |
| 38 | |
Skyler Grey | d7e1acd | 2024-06-22 14:42:11 +0000 | [diff] [blame] | 39 | unstable.url = "github:nixos/nixpkgs/nixos-unstable"; |
Skyler Grey | 3299e4f | 2024-07-04 00:33:43 +0000 | [diff] [blame] | 40 | |
| 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 Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | outputs = |
| 54 | inputs: |
| 55 | let |
Skyler Grey | e6a8c71 | 2024-06-22 01:41:28 +0000 | [diff] [blame] | 56 | lib = (inputs.snowfall-lib.mkLib { |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 57 | inherit inputs; |
| 58 | |
| 59 | src = ./.; |
| 60 | |
| 61 | snowfall = { |
| 62 | namespace = "clicks"; |
| 63 | }; |
Skyler Grey | e6a8c71 | 2024-06-22 01:41:28 +0000 | [diff] [blame] | 64 | }).snowfall.internal.system-lib; |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 65 | in |
| 66 | lib.mkFlake { |
| 67 | overlays = with inputs; [ ]; |
| 68 | |
Skyler Grey | 82ea805 | 2024-06-08 22:56:00 +0000 | [diff] [blame] | 69 | systems.modules.nixos = [ |
| 70 | inputs.impermanence.nixosModules.impermanence |
| 71 | inputs.sops-nix.nixosModules.sops |
| 72 | ]; |
Skyler Grey | d337740 | 2024-06-06 22:01:26 +0000 | [diff] [blame] | 73 | |
Skyler Grey | e6a8c71 | 2024-06-22 01:41:28 +0000 | [diff] [blame] | 74 | deploy = lib.clicks.deploy.mkDeploy { |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 75 | inherit (inputs) self; |
| 76 | overrides = { |
Skyler Grey | 8ef3481 | 2024-06-09 19:42:15 +0000 | [diff] [blame] | 77 | teal.hostname = "teal.alpha.clicks.domains"; |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 78 | }; |
| 79 | }; |
| 80 | |
Skyler Grey | e6a8c71 | 2024-06-22 01:41:28 +0000 | [diff] [blame] | 81 | 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 Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 92 | |
Skyler Grey | e6a8c71 | 2024-06-22 01:41:28 +0000 | [diff] [blame] | 93 | 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 Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 111 | }; |
| 112 | } |