samhh / dotfiles

Configuring the universe with Nix.
51 stars 2 forks source link

Don't overuse my user #401

Closed samhh closed 1 year ago

samhh commented 1 year ago

Can access for example config.vdirsyncer.jobs.krabby.user rather than reusing config.username.

samhh commented 1 year ago
diff --git a/hosts/alakazam/misc.nix b/hosts/alakazam/misc.nix
index 3f6300c..b3561c0 100644
--- a/hosts/alakazam/misc.nix
+++ b/hosts/alakazam/misc.nix
@@ -18,8 +18,7 @@ in

     krabby = {
       file = ../../secrets/krabby.age;
-      # For vdirsyncer.
-      owner = config.username;
+      owner = config.services.vdirsyncer.jobs.krabby.user;
     };
   };

@@ -41,8 +40,7 @@ in
   services.vdirsyncer = {
     enable = true;
     jobs.krabby = {
-      # So that we can read the decryped secret, which is owned by this user.
-      user = config.username;
+      user = "vdirsyncer";
       group = "users";
       forceDiscover = true;
       config = {
[agenix] chowning...
chown: invalid user: ‘vdirsyncer:0’
Activation script snippet 'agenixChown' failed (1)

:shrug: