2025-12-14 20:28:48 -05:00
|
|
|
# unpackPhase
|
|
|
|
|
# patchPhase
|
|
|
|
|
# configurePhase
|
|
|
|
|
# buildPhase
|
|
|
|
|
# checkPhase
|
|
|
|
|
# installPhase
|
|
|
|
|
# fixupPhase
|
|
|
|
|
# installCheckPhase
|
|
|
|
|
# distPhase
|
|
|
|
|
{
|
2025-12-27 21:03:25 -05:00
|
|
|
pkgs,
|
2025-12-14 20:28:48 -05:00
|
|
|
stdenv,
|
|
|
|
|
runCommand,
|
|
|
|
|
...
|
|
|
|
|
}:
|
|
|
|
|
let
|
2025-12-27 21:15:00 -05:00
|
|
|
to_yaml_file = ((import ../../../functions/to_yaml.nix) {inherit pkgs;}).to_yaml_file;
|
2025-12-14 20:28:48 -05:00
|
|
|
kube_encryption_key = runCommand "kube_encryption_key" { } ''
|
|
|
|
|
head -c 32 /dev/urandom | base64 | tee $out
|
|
|
|
|
'';
|
|
|
|
|
kube_encryption_config = {
|
|
|
|
|
kind = "EncryptionConfig";
|
|
|
|
|
apiVersion = "v1";
|
|
|
|
|
resources = [
|
|
|
|
|
{
|
|
|
|
|
resources = [ "secrets" ];
|
|
|
|
|
providers = [
|
|
|
|
|
{
|
|
|
|
|
aescbc = {
|
|
|
|
|
keys = [
|
|
|
|
|
{
|
|
|
|
|
name = "key1";
|
|
|
|
|
secret = (builtins.readFile "${kube_encryption_key}");
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
{ identity = { }; }
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
};
|
2025-12-27 21:03:25 -05:00
|
|
|
kube_encryption_config_yaml = (to_yaml_file "encryption-config.yaml" kube_encryption_config);
|
2025-12-14 20:28:48 -05:00
|
|
|
in
|
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
|
name = "k8s-encryption-key";
|
|
|
|
|
nativeBuildInputs = [ ];
|
|
|
|
|
buildInputs = [ ];
|
|
|
|
|
|
|
|
|
|
unpackPhase = "true";
|
|
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
|
mkdir "$out"
|
|
|
|
|
cp "${kube_encryption_config_yaml}" $out/encryption-config.yaml
|
|
|
|
|
'';
|
|
|
|
|
})
|