mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 08:00: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 (
|
(inputs.flake-utils.lib.eachDefaultSystem (
|
||||||
system: let
|
system:
|
||||||
|
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 = attrs @ {
|
evalModules =
|
||||||
module ? null,
|
attrs @ { module ? null
|
||||||
modules ? [module],
|
, modules ? [ module ]
|
||||||
...
|
, ...
|
||||||
}: let
|
}:
|
||||||
lib' = lib.extend (lib: _self: import ./lib/upstreamables.nix {inherit lib pkgs;});
|
let
|
||||||
attrs' = builtins.removeAttrs attrs ["module"];
|
lib' = lib.extend (lib: _self: import ./lib/upstreamables.nix { inherit lib pkgs; });
|
||||||
in
|
attrs' = builtins.removeAttrs attrs [ "module" ];
|
||||||
|
in
|
||||||
lib'.evalModules (lib.recursiveUpdate
|
lib'.evalModules (lib.recursiveUpdate
|
||||||
{
|
{
|
||||||
modules =
|
modules =
|
||||||
|
|
@ -58,7 +60,8 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
attrs');
|
attrs');
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
inherit evalModules pkgs;
|
inherit evalModules pkgs;
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
|
|
@ -133,9 +136,9 @@
|
||||||
|
|
||||||
packages =
|
packages =
|
||||||
inputs.flake-utils.lib.flattenTree
|
inputs.flake-utils.lib.flattenTree
|
||||||
{
|
{
|
||||||
inherit (pkgs) kubernetes kubectl;
|
inherit (pkgs) kubernetes kubectl;
|
||||||
}
|
}
|
||||||
// {
|
// {
|
||||||
cli = pkgs.callPackage ./pkgs/kubenix.nix {
|
cli = pkgs.callPackage ./pkgs/kubenix.nix {
|
||||||
inherit (self.packages.${system});
|
inherit (self.packages.${system});
|
||||||
|
|
@ -149,25 +152,25 @@
|
||||||
# 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 = let
|
checks =
|
||||||
wasSuccess = suite:
|
let
|
||||||
if suite.success
|
wasSuccess = suite:
|
||||||
then pkgs.runCommandNoCC "testing-suite-config-assertions-for-${suite.name}-succeeded" {} "echo success > $out"
|
if suite.success
|
||||||
else pkgs.runCommandNoCC "testing-suite-config-assertions-for-${suite.name}-failed" {} "exit 1";
|
then pkgs.runCommandNoCC "testing-suite-config-assertions-for-${suite.name}-succeeded" { } "echo success > $out"
|
||||||
examples = import ./docs/content/examples;
|
else pkgs.runCommandNoCC "testing-suite-config-assertions-for-${suite.name}-failed" { } "exit 1";
|
||||||
mkK8STests = attrs:
|
examples = import ./docs/content/examples;
|
||||||
(import ./tests {inherit evalModules;})
|
mkK8STests = attrs:
|
||||||
({registry = "docker.io/gatehub";} // attrs);
|
(import ./tests { inherit evalModules; })
|
||||||
in
|
({ registry = "docker.io/gatehub"; } // attrs);
|
||||||
|
in
|
||||||
{
|
{
|
||||||
# TODO: access "success" derivation with nice testing utils for nice output
|
# TODO: access "success" derivation with nice testing utils for nice output
|
||||||
testing = wasSuccess examples.testing.config.testing;
|
testing = wasSuccess examples.testing.config.testing;
|
||||||
|
|
@ -175,7 +178,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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue