users: clean up sopsFile stuff a bit

This commit is contained in:
Aaron Bieber 2024-03-22 08:21:55 -06:00
parent 2b2425bf51
commit 269a67b52d
No known key found for this signature in database

View File

@ -25,8 +25,10 @@ in
config = config =
let let
inherit (config.networking) hostName;
secretAttrs = config.xin-secrets.${hostName}.user_passwords;
hasQbit = hasQbit =
if builtins.hasAttr "qbit" config.xin-secrets.${config.networking.hostName}.user_passwords then if builtins.hasAttr "qbit" secretAttrs then
true true
else false; else false;
in in
@ -39,7 +41,7 @@ in
root_hash = root_hash =
{ {
name = "hash"; name = "hash";
sopsFile = config.xin-secrets.${config.networking.hostName}.user_passwords.root; sopsFile = secretAttrs.root;
owner = "root"; owner = "root";
mode = "400"; mode = "400";
neededForUsers = true; neededForUsers = true;
@ -47,7 +49,7 @@ in
} }
(mkIf hasQbit { (mkIf hasQbit {
qbit_hash = { qbit_hash = {
sopsFile = config.xin-secrets.${config.networking.hostName}.user_passwords.qbit; sopsFile = secretAttrs.qbit;
owner = "root"; owner = "root";
mode = "400"; mode = "400";
neededForUsers = true; neededForUsers = true;