git.delta.rocks / jrsonnet / refs/commits / b56a5a338d1e

difftreelog

ci add flake outputs formatter, schemas

Yaroslav Bolyukin2024-06-03parent: #7c29776.patch.diff
in: trunk

4 files changed

modifiedflake.nixdiffbeforeafterboth
--- a/flake.nix
+++ b/flake.nix
@@ -36,6 +36,31 @@
               craneLib = crane.mkLib pkgs;
             };
         };
+        # To be used with https://github.com/NixOS/nix/pull/8892
+        schemas = {
+          fleetConfigurations = {
+            version = 1;
+            doc = ''
+              The `fleetConfigurations` flake output defines fleet cluster configurations.
+            '';
+            inventory = output: {
+              children =
+                builtins.mapAttrs (configName: cluster: {
+                  what = "fleet cluster configuration";
+
+                  children =
+                    builtins.mapAttrs (hostName: host: {
+                      what = "host [${host.system}]";
+                    })
+                    cluster.config.hosts;
+                  # It is possible to implement this inventory right now, but I want to
+                  # get rid of `fleet.nix` file in the future.
+                  # children.secrets = { };
+                })
+                output;
+            };
+          };
+        };
       };
       # Supported and tested list of deployment targets.
       systems = ["x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux"];
@@ -108,6 +133,7 @@
           # `fleet` crate wants nightly rust, also little sense of supporting it on stable nixpkgs.
           (prefixAttrs "nixpkgs-" (removeAttrs packages ["fleet"]))
           // (prefixAttrs "nixpkgs-stable-" (removeAttrs packages-with-nixpkgs-stable ["fleet"]));
+        formatter = pkgs.alejandra;
       };
     };
 }
modifiedlib/default.nixdiffbeforeafterboth
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -1,6 +1,4 @@
-{
-  fleetPkgsForPkgs,
-}: {
+{fleetPkgsForPkgs}: {
   fleetConfiguration = {
     # TODO: Provide by fleet, instead of requesting user to provide it.
     # This is not good that user needs to provide it, as it becomes a flake data, and fleet arbitrarily rewriting it
modifiedmodules/fleet/assertions.nixdiffbeforeafterboth
before · modules/fleet/assertions.nix
1{ lib, ... }:23with lib;45{67  options = {89    assertions = mkOption {10      type = types.listOf types.unspecified;11      internal = true;12      default = [ ];13      example = [{ assertion = false; message = "you can't enable this for that reason"; }];14      description = ''15        This option allows modules to express conditions that must16        hold for the evaluation of the system configuration to17        succeed, along with associated error messages for the user.18      '';19    };2021    warnings = mkOption {22      internal = true;23      default = [ ];24      type = types.listOf types.str;25      example = [ "The `foo' service is deprecated and will go away soon!" ];26      description = ''27        This option allows modules to show warnings to users during28        the evaluation of the system configuration.29      '';30    };3132  };33  # impl of assertions is in <fleet/lib/default.nix>34}
after · modules/fleet/assertions.nix
1{lib, ...}:2with lib; {3  options = {4    assertions = mkOption {5      type = types.listOf types.unspecified;6      internal = true;7      default = [];8      example = [9        {10          assertion = false;11          message = "you can't enable this for that reason";12        }13      ];14      description = ''15        This option allows modules to express conditions that must16        hold for the evaluation of the system configuration to17        succeed, along with associated error messages for the user.18      '';19    };2021    warnings = mkOption {22      internal = true;23      default = [];24      type = types.listOf types.str;25      example = ["The `foo' service is deprecated and will go away soon!"];26      description = ''27        This option allows modules to show warnings to users during28        the evaluation of the system configuration.29      '';30    };31  };32  # impl of assertions is in <fleet/lib/default.nix>33}
modifiedpkgs/generator-helper.nixdiffbeforeafterboth
--- a/pkgs/generator-helper.nix
+++ b/pkgs/generator-helper.nix
@@ -1,4 +1,3 @@
-
 {craneLib}:
 craneLib.buildPackage rec {
   pname = "fleet-generator-helper";
@@ -9,6 +8,6 @@
   cargoExtraArgs = "--locked -p ${pname}";
 
   postInstall = ''
-		mv bin/${pname} bin/genhelper
+    mv bin/${pname} bin/genhelper
   '';
 }