mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-11 23:50:06 +01:00
flake: format
This commit is contained in:
parent
5d95447b75
commit
32dc1a09cb
2 changed files with 34 additions and 31 deletions
63
flake.nix
63
flake.nix
|
|
@ -13,33 +13,35 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = inputs @ {self, ...}:
|
||||
outputs = inputs @ { self, ... }:
|
||||
(inputs.flake-utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
system:
|
||||
let
|
||||
pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
overlays = [self.overlays.default];
|
||||
overlays = [ self.overlays.default ];
|
||||
config.allowUnsupportedSystem = true;
|
||||
};
|
||||
|
||||
inherit (pkgs) lib;
|
||||
|
||||
kubenix = {
|
||||
lib = import ./lib {inherit lib pkgs;};
|
||||
lib = import ./lib { inherit lib pkgs; };
|
||||
evalModules = self.evalModules.${system};
|
||||
modules = self.nixosModules.kubenix;
|
||||
};
|
||||
|
||||
# evalModules with same interface as lib.evalModules and kubenix as
|
||||
# special argument
|
||||
evalModules = attrs @ {
|
||||
module ? null,
|
||||
modules ? [module],
|
||||
...
|
||||
}: let
|
||||
lib' = lib.extend (lib: _self: import ./lib/upstreamables.nix {inherit lib pkgs;});
|
||||
attrs' = builtins.removeAttrs attrs ["module"];
|
||||
in
|
||||
evalModules =
|
||||
attrs @ { module ? null
|
||||
, modules ? [ module ]
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
lib' = lib.extend (lib: _self: import ./lib/upstreamables.nix { inherit lib pkgs; });
|
||||
attrs' = builtins.removeAttrs attrs [ "module" ];
|
||||
in
|
||||
lib'.evalModules (lib.recursiveUpdate
|
||||
{
|
||||
modules =
|
||||
|
|
@ -58,7 +60,8 @@
|
|||
};
|
||||
}
|
||||
attrs');
|
||||
in {
|
||||
in
|
||||
{
|
||||
inherit evalModules pkgs;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
|
|
@ -133,9 +136,9 @@
|
|||
|
||||
packages =
|
||||
inputs.flake-utils.lib.flattenTree
|
||||
{
|
||||
inherit (pkgs) kubernetes kubectl;
|
||||
}
|
||||
{
|
||||
inherit (pkgs) kubernetes kubectl;
|
||||
}
|
||||
// {
|
||||
cli = pkgs.callPackage ./pkgs/kubenix.nix {
|
||||
inherit (self.packages.${system});
|
||||
|
|
@ -149,25 +152,25 @@
|
|||
# the submodules module currently doesn't evaluate:
|
||||
# error: No module found ‹name›/latest
|
||||
# not sure how important that documentation is a this time
|
||||
self.nixosModules.kubenix ["submodule" "submodules"]);
|
||||
})
|
||||
.options;
|
||||
self.nixosModules.kubenix [ "submodule" "submodules" ]);
|
||||
}).options;
|
||||
};
|
||||
}
|
||||
// import ./jobs {
|
||||
inherit pkgs;
|
||||
};
|
||||
|
||||
checks = let
|
||||
wasSuccess = suite:
|
||||
if suite.success
|
||||
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";
|
||||
examples = import ./docs/content/examples;
|
||||
mkK8STests = attrs:
|
||||
(import ./tests {inherit evalModules;})
|
||||
({registry = "docker.io/gatehub";} // attrs);
|
||||
in
|
||||
checks =
|
||||
let
|
||||
wasSuccess = suite:
|
||||
if suite.success
|
||||
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";
|
||||
examples = import ./docs/content/examples;
|
||||
mkK8STests = attrs:
|
||||
(import ./tests { inherit evalModules; })
|
||||
({ registry = "docker.io/gatehub"; } // attrs);
|
||||
in
|
||||
{
|
||||
# TODO: access "success" derivation with nice testing utils for nice output
|
||||
testing = wasSuccess examples.testing.config.testing;
|
||||
|
|
@ -175,7 +178,7 @@
|
|||
// builtins.listToAttrs (builtins.map
|
||||
(v: {
|
||||
name = "test-k8s-${builtins.replaceStrings ["."] ["_"] v}";
|
||||
value = wasSuccess (mkK8STests {k8sVersion = v;});
|
||||
value = wasSuccess (mkK8STests { k8sVersion = v; });
|
||||
})
|
||||
(import ./versions.nix).versions);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue