switch formatting to nixpkgs-fmt

This commit is contained in:
Bryton Hall 2023-07-07 22:01:34 -04:00
parent 3598716c73
commit 2712e89716
65 changed files with 4839 additions and 5222 deletions

View file

@ -1,42 +1,32 @@
{lib}:
{ lib }:
with lib; rec {
# TODO: refactor with mkOptionType
mkSecretOption = {
description ? "",
default ? {},
allowNull ? true,
}:
mkSecretOption = { description ? "", default ? { }, allowNull ? true }:
mkOption {
inherit description;
type =
(
if allowNull
then types.nullOr
else id
) (types.submodule {
options = {
name = mkOption ({
description = "Name of the secret where secret is stored";
type = types.str;
default = default.name;
}
// (optionalAttrs (default ? "name") {
default = default.name;
}));
type = (
if allowNull
then types.nullOr
else id
) (types.submodule {
options = {
name = mkOption ({
description = "Name of the secret where secret is stored";
type = types.str;
default = default.name;
} // (optionalAttrs (default ? "name") {
default = default.name;
}));
key = mkOption ({
description = "Name of the key where secret is stored";
type = types.str;
}
// (optionalAttrs (default ? "key") {
default = default.key;
}));
};
});
default =
if default == null
then null
else {};
key = mkOption ({
description = "Name of the key where secret is stored";
type = types.str;
} // (optionalAttrs (default ? "key") {
default = default.key;
}));
};
});
default = if default == null then null else { };
};
secretToEnv = value: {
@ -46,10 +36,7 @@ with lib; rec {
};
# Creates kubernetes list from a list of kubernetes objects
mkList = {
items,
labels ? {},
}: {
mkList = { items, labels ? { } }: {
kind = "List";
apiVersion = "v1";
@ -57,27 +44,22 @@ with lib; rec {
};
# Creates hashed kubernetes list from a list of kubernetes objects
mkHashedList = {
items,
labels ? {},
}: let
hash = builtins.hashString "sha1" (builtins.toJSON items);
mkHashedList = { items, labels ? { } }:
let
hash = builtins.hashString "sha1" (builtins.toJSON items);
labeledItems =
map
(item:
recursiveUpdate item {
metadata.labels."kubenix/hash" = hash;
})
items;
in
labeledItems = map
(item:
recursiveUpdate item {
metadata.labels."kubenix/hash" = hash;
})
items;
in
mkList {
items = labeledItems;
labels =
{
"kubenix/hash" = hash;
}
// labels;
labels = {
"kubenix/hash" = hash;
} // labels;
};
inherit (lib) toBase64;