about summary refs log tree commit diff
path: root/users/fcuny/desktop/trust/pass.nix
blob: d9c9010325bdd99db8c149b21e48713b2fe22177 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{ pkgs, config, ... }:

{
  programs.password-store = {
    enable = true;
    settings = {
      PASSWORD_STORE_DIR = "${config.xdg.dataHome}/password-store";
      PASSWORD_STORE_GENERATED_LENGTH = "30";
      PASSWORD_STORE_CHARACTER_SET = "a-zA-Z0-9~!@#$%^&*()-_=+[]{};:,.<>?";
      PASSWORD_STORE_KEY = config.programs.gpg.settings.default-key;
    };
  };

  systemd.user.services.git-password-store = {
    Unit = {
      Description = "password-store synchronization to git";
      Documentation = [
        "man:pass(1)"
        "https://git.fcuny.net/fcuny/password-store"
      ];
      ConditionPathIsDirectory = "${config.programs.password-store.settings.PASSWORD_STORE_DIR}/.git";
    };
    Service = {
      Type = "oneshot";
      Environment = "PASSWORD_STORE_DIR=${config.programs.password-store.settings.PASSWORD_STORE_DIR}";
      WorkingDirectory = config.programs.password-store.settings.PASSWORD_STORE_DIR;
      ExecStart = "${pkgs.git}/bin/git push origin %H";
    };
  };

  systemd.user.timers.git-password-store = {
    Unit = {
      Description = "password-store synchronization timer";
      Documentation = "man:pass(1)";
    };
    Timer = {
      OnBootSec = "20m";
      OnUnitActiveSec = "60m";
    };
    Install = { WantedBy = [ "timers.target" ]; };
  };
}