rbw: simplify 'pinentry' type

Following some upstream changes [1], it's now possible to use a simplified
package type for the option.

[1]: https://github.com/NixOS/nixpkgs/pull/133542
This commit is contained in:
Bruno BELANYI 2024-03-10 10:24:45 +00:00 committed by Robert Helgesson
parent 01e4a5143e
commit 1ab3cec3a1
No known key found for this signature in database
GPG Key ID: 96E745BD17AA17ED
5 changed files with 19 additions and 20 deletions

View File

@ -1452,6 +1452,15 @@ in {
'services.gpg-agent.pinentryPackage'.
'';
}
{
time = "2024-03-14T07:22:59+00:00";
condition = config.programs.rbw.enable;
message = ''
'programs.rbw.pinentry' has been simplified to only accept 'null' or
a package.
'';
}
];
};
}

View File

@ -41,9 +41,9 @@ let
};
pinentry = mkOption {
type = with types; either package (enum pkgs.pinentry.flavors);
example = "gnome3";
default = "gtk2";
type = types.nullOr types.package;
example = literalExpression "pkgs.pinentry-gnome3";
default = null;
description = ''
Which pinentry interface to use. Beware that
`pinentry-gnome3` may not work on non-Gnome
@ -52,15 +52,9 @@ let
```nix
services.dbus.packages = [ pkgs.gcr ];
```
For this reason, the default is `gtk2` for
now.
'';
# we want the program in the config
apply = val:
if builtins.isString val then
"${pkgs.pinentry.${val}}/bin/pinentry"
else
"${val}/${val.binaryPath or "bin/pinentry"}";
apply = val: if val == null then val else lib.getExe val;
};
};
};
@ -87,7 +81,7 @@ in {
{
email = "name@example.com";
lock_timeout = 300;
pinentry = "gnome3";
pinentry = pkgs.pinentry-gnome3;
}
'';
description = ''

View File

@ -5,12 +5,8 @@
nixpkgs.overlays = [
(self: super: {
pinentry = {
gnome3 =
config.lib.test.mkStubPackage { outPath = "@pinentry-gnome3@"; };
gtk2 = config.lib.test.mkStubPackage { outPath = "@pinentry-gtk2@"; };
flavors = [ "gnome3" "gtk2" ];
};
pinentry-gnome3 =
config.lib.test.mkStubPackage { outPath = "@pinentry-gnome3@"; };
})
];
}

View File

@ -14,7 +14,7 @@ let
"email": "name@example.com",
"identity_url": "identity.example.com",
"lock_timeout": 300,
"pinentry": "@pinentry-gnome3@/bin/pinentry"
"pinentry": "@pinentry-gnome3@/bin/dummy"
}
'';
in {
@ -27,7 +27,7 @@ in {
base_url = "bitwarden.example.com";
identity_url = "identity.example.com";
lock_timeout = 300;
pinentry = "gnome3";
pinentry = pkgs.pinentry-gnome3;
};
};

View File

@ -14,7 +14,7 @@ let
"email": "name@example.com",
"identity_url": null,
"lock_timeout": 3600,
"pinentry": "@pinentry-gtk2@/bin/pinentry"
"pinentry": null
}
'';
in {