Skip to content

Commit

Permalink
fix monitoring profile for age
Browse files Browse the repository at this point in the history
  • Loading branch information
manveru committed Sep 28, 2021
1 parent 4d4adf8 commit 1bef416
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions profiles/monitoring.nix
Expand Up @@ -11,6 +11,9 @@ in {
./telegraf.nix
];

age.secrets.grafana-password.file = config.age.encryptedRoot
+ "/grafana/password.age";

services = {
vault.enable = lib.mkForce false;
consul.ui = true;
Expand Down Expand Up @@ -67,7 +70,7 @@ in {
}];
};

security = { adminPasswordFile = /var/lib/grafana/password; };
security.adminPasswordFile = config.age.secrets.grafana-password.path;
};

prometheus = {
Expand All @@ -87,24 +90,4 @@ in {
};
};
};

secrets.generate.grafana-password = ''
export PATH="${lib.makeBinPath (with pkgs; [ coreutils sops xkcdpass ])}"
if [ ! -s encrypted/grafana-password.json ]; then
xkcdpass \
| sops --encrypt --kms '${kms}' /dev/stdin \
> encrypted/grafana-password.json
fi
'';

secrets.install.grafana-password.script = ''
export PATH="${lib.makeBinPath (with pkgs; [ sops coreutils ])}"
mkdir -p /var/lib/grafana
cat ${config.secrets.encryptedRoot + "/grafana-password.json"} \
| sops -d /dev/stdin \
> /var/lib/grafana/password
'';
}

0 comments on commit 1bef416

Please sign in to comment.