about summary refs log tree commit diff
path: root/home/profiles/security/default.nix
blob: 2201f3e1132d442374260567026a9371242880dc (plain)
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
43
44
45
46
47
48
49
{ config, lib, pkgs, ... }:
let cfg = config.profiles.security;
in
{
  options.profiles.security = {
    enable = lib.mkEnableOption
      "Profile for security-related packages";
  };

  config = lib.mkIf cfg.enable {
    home.packages = [
      pkgs.yubikey-manager
      pkgs.age-plugin-yubikey

      pkgs.bitwarden
      pkgs.bitwarden-cli

      pkgs.keyutils

      pkgs.protonvpn-gui
    ];

    systemd.user = lib.mkIf pkgs.stdenv.isLinux {
      sockets.yubikey-touch-detector = {
        Unit.Description = "Unix socket activation for YubiKey touch detector service";
        Socket = {
          ListenStream = "%t/yubikey-touch-detector.socket";
          RemoveOnStop = true;
        };
        Install.WantedBy = [ "sockets.target" ];
      };

      services.yubikey-touch-detector = {
        Unit = {
          Description = "Detects when your YubiKey is waiting for a touch";
          Requires = "yubikey-touch-detector.socket";
        };
        Service = {
          ExecStart = "${lib.getExe pkgs.yubikey-touch-detector} --libnotify -v";
          EnvironmentFile = "-%E/yubikey-touch-detector/service.conf";
        };
        Install = {
          Also = "yubikey-touch-detector.socket";
          WantedBy = [ "default.target" ];
        };
      };
    };
  };
}