Compare commits

...

2 Commits

Author SHA1 Message Date
Sam 3eb837c371 flake.lock conflict 2024-06-13 12:33:05 +01:00
Sam 2f3fec9e5c postgres credentials and dbt profiles 2024-06-13 12:30:21 +01:00
2 changed files with 41 additions and 4 deletions

View File

@ -20,6 +20,7 @@
btop
htop
postgresql
hugo
;
};
home.stateVersion = "23.11";

View File

@ -35,13 +35,15 @@ in
mode = "0644";
owner = "${username}";
};
"passwords/postgres" = { };
"software/postgres/btc_models/password" = { };
"software/postgres/btc_models/ip" = { };
"software/postgres/btc_models/username" = { };
"software/zotero/username" = { };
"software/zotero/password" = { };
"software/zotero/guid" = { };
};
# Setup postgres connections for db_ui
# Setup software specific templates for user
# Should be part of home-manager - waiting for templates functionality
# See here https://github.com/Mic92/sops-nix/issues/423 and here https://github.com/Mic92/sops-nix/issues/498
# TODO migrate db_ui connection to home-manager when issue 423 and 498 are resolved in github:Mic92/sops-nix
@ -52,14 +54,48 @@ in
content = ''
[
{
"url": "postgresql://postgres:${config.sops.placeholder."passwords/postgres"}@10.0.10.100/btc_models",
"url": "postgresql://${config.sops.placeholder."software/postgres/btc_models/username"}:${config.sops.placeholder."software/postgres/btc_models/password"}@${config.sops.placeholder."software/postgres/btc_models/ip"}/btc_models",
"name": "btc_models"
},
{
"url": "postgresql://${config.sops.placeholder."software/postgres/btc_models/username"}:${config.sops.placeholder."software/postgres/btc_models/password"}@${config.sops.placeholder."software/postgres/btc_models/ip"}/dev_btc_models",
"name": "dev_btc_models"
}
]
'';
};
# The containing folders are created as root and if this is the first entry when writing keys,
sops.templates."dbt_profiles.yml" = {
path = "/home/${username}/.config/dbt/profiles.yml";
owner = "${username}";
mode = "0600";
content = ''
bitcoin:
target: dev
outputs:
dev:
dbname: dev_btc_models
host: ${config.sops.placeholder."software/postgres/btc_models/ip"}
pass: '${config.sops.placeholder."software/postgres/btc_models/password"}'
port: 5432
schema: models
threads: 6
type: postgres
user: ${config.sops.placeholder."software/postgres/btc_models/username"}
prod:
dbname: btc_models
host: ${config.sops.placeholder."software/postgres/btc_models/ip"}
pass: '${config.sops.placeholder."software/postgres/btc_models/password"}'
port: 5432
schema: models
threads: 6
type: postgres
user: ${config.sops.placeholder."software/postgres/btc_models/username"}
'';
};
# The containing folders are created as root and if this is the first entry when writing files,
# the ownership is busted and home-manager can't target because it can't write to these dirs...
# FIXME: We might not need this depending on how https://github.com/Mic92/sops-nix/issues/381 is fixed
system.activationScripts.sopsSetOwnwership =