64 lines
1.8 KiB
Nix
64 lines
1.8 KiB
Nix
{
|
|
inputs = {
|
|
nix.url = "git+ssh://git@git.c3c.cz/C3C/nix";
|
|
};
|
|
|
|
outputs =
|
|
{ self, nix }:
|
|
{
|
|
formatter = nix.formatter;
|
|
|
|
devShells = nix.lib.forAllSystems (pkgs: {
|
|
default = nix.lib.mkDevenvShell {
|
|
inherit pkgs;
|
|
inputs = {
|
|
self = self;
|
|
nixpkgs = pkgs;
|
|
};
|
|
|
|
modules = [
|
|
{
|
|
packages = with pkgs; [
|
|
terraform
|
|
kyverno
|
|
];
|
|
|
|
scripts = {
|
|
menu = {
|
|
description = "Print this menu";
|
|
exec = ''
|
|
echo "Commands:"
|
|
echo -n '${
|
|
builtins.toJSON (
|
|
builtins.mapAttrs (s: value: value.description) self.devShells.${pkgs.system}.default.config.scripts
|
|
)
|
|
}' | ${pkgs.jq}/bin/jq -r 'to_entries | map(" \(.key)\n" + " - \(if .value == "" then "no description provided" else .value end)") | "" + .[]'
|
|
'';
|
|
};
|
|
|
|
fix = {
|
|
description = "Execute formatting tools";
|
|
exec = ''
|
|
${nix.lib.cd_root}
|
|
nix fmt ./*.nix
|
|
terraform fmt --recursive
|
|
${pkgs.yamlfmt}/bin/yamlfmt ./anydatacenter
|
|
'';
|
|
};
|
|
|
|
tests = {
|
|
description = "Run terraform and kyverno tests";
|
|
exec = ''
|
|
${nix.lib.cd_root}
|
|
terraform validate
|
|
${pkgs.kyverno}/bin/kyverno test ./anydatacenter/30-policy-demo --detailed-results
|
|
'';
|
|
};
|
|
};
|
|
}
|
|
];
|
|
};
|
|
});
|
|
};
|
|
}
|