pass-secret-service: Fix default info, modularize conflict checks

Signed-off-by: Cynthia Fox <cyntheticfox@gh0st.sh>
This commit is contained in:
Cynthia Fox 2023-05-07 16:25:29 -04:00
parent 4620e68b19
commit 851df4fe49
No known key found for this signature in database
GPG Key ID: 5960278CE235F821
1 changed files with 16 additions and 6 deletions

View File

@ -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
<filename>$HOME/.password-store</filename> if the
<option>programs.password-store</option> module is not enabled, and
<option>programs.password-store.PASSWORD_STORE_DIR</option> if it is.
Absolute path to password store. Defaults to
<filename>$HOME/.password-store</filename> if the
<option>programs.password-store</option> module is not enabled, and
<option>programs.password-store.settings.PASSWORD_STORE_DIR</option> 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
<ul>
${map (v: ''
<li><option>${v}</option></li>
'') (getConflicts conflictingModules)}
</ul>
'';
}
];