mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 20:39:18 -08:00
feat: add minio+cockroachdb
This commit is contained in:
parent
bdd402ffeb
commit
2d615951a2
11 changed files with 121 additions and 12 deletions
|
|
@ -62,6 +62,7 @@ in {
|
|||
_module.args.tf = mapNullable (target: target.tf) target;
|
||||
out = jsonConfig;
|
||||
deploy.tf = {
|
||||
terraform.environment.ESPHOME = "${pkgs.esphome}";
|
||||
attrs = [ "import" "imports" "out" "attrs" "triggers" ];
|
||||
import = genAttrs cfg.tf.imports (target: meta.deploy.targets.${target}.tf);
|
||||
out.set = removeAttrs cfg.tf cfg.tf.attrs;
|
||||
|
|
@ -75,7 +76,7 @@ in {
|
|||
provider = "local";
|
||||
type = "file";
|
||||
inputs = {
|
||||
filename = "${tf.terraform.dataDir}/esphome-${name}-secrets.json";
|
||||
filename = "${builtins.toString tf.terraform.dataDir}/esphome-${name}-secrets.json";
|
||||
content = secretsFile;
|
||||
};
|
||||
};
|
||||
|
|
@ -86,10 +87,13 @@ in {
|
|||
provisioners = [
|
||||
{
|
||||
type = "local-exec";
|
||||
local-exec.command = ''
|
||||
${pkgs.esphome}/bin/esphome compile ${closureConfig} ${tf.resources."${name}-secrets".refAttr "filename"}
|
||||
${pkgs.esphome}/bin/esphome upload ${closureConfig} --device ${name}.local
|
||||
'';
|
||||
local-exec = {
|
||||
working_dir = builtins.toString tf.terraform.dataDir;
|
||||
command = ''
|
||||
${pkgs.esphome}/bin/esphome compile ${closureConfig} ${tf.resources."${name}-secrets".refAttr "filename"}
|
||||
${pkgs.esphome}/bin/esphome upload ${closureConfig} ${tf.resources."${name}-secrets".refAttr "filename"} --device ${name}.local
|
||||
'';
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
|
@ -103,7 +107,7 @@ in {
|
|||
path = if length parts > 1 then head parts else "password";
|
||||
in nameValuePair "${config.esphome.name}-secret-${name}" ({
|
||||
value.shellCommand = let
|
||||
bitw = pkgs.writeShellScriptBin "bitw" ''${pkgs.rbw-bitw}/bin/bitw -p gpg://${config.network.nodes.all.${builtins.getEnv "HOME_HOSTNAME"}.secrets.repo.bitw.source} "$@"'';
|
||||
bitw = pkgs.writeShellScriptBin "bitw" ''${pkgs.rbw-bitw}/bin/bitw -p gpg://${meta.network.nodes.all.${builtins.getEnv "HOME_HOSTNAME"}.secrets.repo.bitw.source} "$@"'';
|
||||
in "${bitw}/bin/bitw get ${path} -f ${field}";
|
||||
type = "string";
|
||||
sensitive = true;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
{ config, pkgs, lib, ... }: {
|
||||
_module.args.pkgs = lib.mkDefault pkgs;
|
||||
{ config, pkgs, lib, meta, ... }: {
|
||||
_module.args.pkgs = lib.mkDefault meta.pkgs;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue