From 851df4fe49edfdb03fb196074ed1c0d7c21f713b Mon Sep 17 00:00:00 2001 From: Cynthia Fox Date: Sun, 7 May 2023 16:25:29 -0400 Subject: [PATCH] pass-secret-service: Fix default info, modularize conflict checks Signed-off-by: Cynthia Fox --- modules/services/pass-secret-service.nix | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/modules/services/pass-secret-service.nix b/modules/services/pass-secret-service.nix index d7eb48a28..2a4acbd66 100644 --- a/modules/services/pass-secret-service.nix +++ b/modules/services/pass-secret-service.nix @@ -5,6 +5,12 @@ with lib; let cfg = config.services.pass-secret-service; + conflictingModules = [ "services.gnome-keyring" ]; + + moduleIsEnabled = v: config.${v}.enable or false; + hasConflicts = modulePathName: !(any moduleIsEnabled modulePathName); + getConflicts = filter moduleIsEnabled; + busName = "org.freedesktop.secrets"; in { meta.maintainers = with maintainers; [ cab404 cyntheticfox ]; @@ -20,10 +26,10 @@ in { defaultText = "$HOME/.password-store"; example = "/home/user/.local/share/password-store"; description = '' - Absolute path to password store. Defaults to - $HOME/.password-store if the - module is not enabled, and - if it is. + Absolute path to password store. Defaults to + $HOME/.password-store if the + module is not enabled, and + else. ''; }; }; @@ -33,11 +39,15 @@ in { (hm.assertions.assertPlatform "services.pass-secret-service" pkgs platforms.linux) { - assertion = !config.services.gnome-keyring.enable; + assertion = hasConflicts conflictingModules; message = '' Only one secrets service per user can be enabled at a time. Other services enabled: - - gnome-keyring + ''; } ];