fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Sefa Eyeoglugnome-keyring: fix pass-secret-service assertion (#3963)3f3fa731

master
1.5 KiB59 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7  cfg = config.services.gnome-keyring;
8
9in {
10  meta.maintainers = [ maintainers.rycee ];
11
12  options = {
13    services.gnome-keyring = {
14      enable = mkEnableOption "GNOME Keyring";
15
16      components = mkOption {
17        type = types.listOf (types.enum [ "pkcs11" "secrets" "ssh" ]);
18        default = [ ];
19        description = ''
20          The GNOME keyring components to start. If empty then the
21          default set of components will be started.
22        '';
23      };
24    };
25  };
26
27  config = mkIf cfg.enable {
28    assertions = [
29      (lib.hm.assertions.assertPlatform "services.gnome-keyring" pkgs
30        lib.platforms.linux)
31      {
32        assertion = !config.services.pass-secret-service.enable;
33        message = ''
34          Only one secrets service per user can be enabled at a time.
35          Other services enabled:
36          - pass-secret-service
37        '';
38      }
39    ];
40
41    systemd.user.services.gnome-keyring = {
42      Unit = {
43        Description = "GNOME Keyring";
44        PartOf = [ "graphical-session-pre.target" ];
45      };
46
47      Service = {
48        ExecStart = let
49          args = concatStringsSep " " ([ "--start" "--foreground" ]
50            ++ optional (cfg.components != [ ])
51            ("--components=" + concatStringsSep "," cfg.components));
52        in "${pkgs.gnome.gnome-keyring}/bin/gnome-keyring-daemon ${args}";
53        Restart = "on-abort";
54      };
55
56      Install = { WantedBy = [ "graphical-session-pre.target" ]; };
57    };
58  };
59}