flake: format

This commit is contained in:
Bryton Hall 2023-06-12 02:36:52 -04:00
parent ea8fe3bd9c
commit 9492528225
3 changed files with 34 additions and 36 deletions

View file

@ -20,6 +20,7 @@ As such, on a server node, we can write kubenix's output there.
''; '';
} }
``` ```
{{< hint danger >}} {{< hint danger >}}
**WARN**: this will write all manifests to the nix store and is therefore not suitable for inline sensitive data. **WARN**: this will write all manifests to the nix store and is therefore not suitable for inline sensitive data.
{{< /hint >}} {{< /hint >}}

View file

@ -13,34 +13,32 @@
}; };
}; };
outputs = inputs @ { self, ... }: outputs = inputs @ {self, ...}:
(inputs.flake-utils.lib.eachDefaultSystem ( (inputs.flake-utils.lib.eachDefaultSystem (
system: system: let
let
pkgs = import inputs.nixpkgs { pkgs = import inputs.nixpkgs {
inherit system; inherit system;
overlays = [ self.overlays.default ]; overlays = [self.overlays.default];
config.allowUnsupportedSystem = true; config.allowUnsupportedSystem = true;
}; };
inherit (pkgs) lib; inherit (pkgs) lib;
kubenix = { kubenix = {
lib = import ./lib { inherit lib pkgs; }; lib = import ./lib {inherit lib pkgs;};
evalModules = self.evalModules.${system}; evalModules = self.evalModules.${system};
modules = self.nixosModules.kubenix; modules = self.nixosModules.kubenix;
}; };
# evalModules with same interface as lib.evalModules and kubenix as # evalModules with same interface as lib.evalModules and kubenix as
# special argument # special argument
evalModules = evalModules = attrs @ {
attrs @ { module ? null module ? null,
, modules ? [ module ] modules ? [module],
, ... ...
}: }: let
let lib' = lib.extend (lib: _self: import ./lib/upstreamables.nix {inherit lib pkgs;});
lib' = lib.extend (lib: _self: import ./lib/upstreamables.nix { inherit lib pkgs; }); attrs' = builtins.removeAttrs attrs ["module"];
attrs' = builtins.removeAttrs attrs [ "module" ];
in in
lib'.evalModules (lib.recursiveUpdate lib'.evalModules (lib.recursiveUpdate
{ {
@ -60,8 +58,7 @@
}; };
} }
attrs'); attrs');
in in {
{
inherit evalModules pkgs; inherit evalModules pkgs;
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
@ -152,24 +149,24 @@
# the submodules module currently doesn't evaluate: # the submodules module currently doesn't evaluate:
# error: No module found name/latest # error: No module found name/latest
# not sure how important that documentation is a this time # not sure how important that documentation is a this time
self.nixosModules.kubenix [ "submodule" "submodules" ]); self.nixosModules.kubenix ["submodule" "submodules"]);
}).options; })
.options;
}; };
} }
// import ./jobs { // import ./jobs {
inherit pkgs; inherit pkgs;
}; };
checks = checks = let
let
wasSuccess = suite: wasSuccess = suite:
if suite.success if suite.success
then pkgs.runCommandNoCC "testing-suite-config-assertions-for-${suite.name}-succeeded" { } "echo success > $out" then pkgs.runCommandNoCC "testing-suite-config-assertions-for-${suite.name}-succeeded" {} "echo success > $out"
else pkgs.runCommandNoCC "testing-suite-config-assertions-for-${suite.name}-failed" { } "exit 1"; else pkgs.runCommandNoCC "testing-suite-config-assertions-for-${suite.name}-failed" {} "exit 1";
examples = import ./docs/content/examples; examples = import ./docs/content/examples;
mkK8STests = attrs: mkK8STests = attrs:
(import ./tests { inherit evalModules; }) (import ./tests {inherit evalModules;})
({ registry = "docker.io/gatehub"; } // attrs); ({registry = "docker.io/gatehub";} // attrs);
in in
{ {
# TODO: access "success" derivation with nice testing utils for nice output # TODO: access "success" derivation with nice testing utils for nice output
@ -178,7 +175,7 @@
// builtins.listToAttrs (builtins.map // builtins.listToAttrs (builtins.map
(v: { (v: {
name = "test-k8s-${builtins.replaceStrings ["."] ["_"] v}"; name = "test-k8s-${builtins.replaceStrings ["."] ["_"] v}";
value = wasSuccess (mkK8STests { k8sVersion = v; }); value = wasSuccess (mkK8STests {k8sVersion = v;});
}) })
(import ./versions.nix).versions); (import ./versions.nix).versions);
} }