summaryrefslogtreecommitdiffstats
path: root/nixos/modules/programs
diff options
context:
space:
mode:
authorSilvan Mosberger <infinisil@icloud.com>2019-03-31 23:12:07 +0200
committerSilvan Mosberger <infinisil@icloud.com>2019-04-01 01:24:54 +0200
commite98ee8d70c29de95682c10819ec46e2ee5eaabff (patch)
treed80fe32810e6f0d743d5c65d84355746ec5bccba /nixos/modules/programs
parent6104fba188a084c3f7230ec39da43146d4203786 (diff)
nixos/browserpass: update for v3
See https://github.com/browserpass/browserpass-native/issues/31 Additionally browserpass was removed from systemPackages, because it doesn't need to be installed, browsers will get the path to the binary from the native messaging host JSON.
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r--nixos/modules/programs/browserpass.nix33
1 files changed, 26 insertions, 7 deletions
diff --git a/nixos/modules/programs/browserpass.nix b/nixos/modules/programs/browserpass.nix
index 5f8a44a9848e..47b9d1ccb1f6 100644
--- a/nixos/modules/programs/browserpass.nix
+++ b/nixos/modules/programs/browserpass.nix
@@ -4,15 +4,34 @@ with lib;
{
- ###### interface
- options = {
- programs.browserpass.enable = mkEnableOption "the NativeMessaging configuration for Chromium, Chrome, and Vivaldi.";
- };
+ options.programs.browserpass.enable = mkEnableOption "Browserpass native messaging host";
- ###### implementation
config = mkIf config.programs.browserpass.enable {
- environment.systemPackages = [ pkgs.browserpass ];
- environment.etc = {
+ environment.etc = let
+ appId = "com.github.browserpass.native.json";
+ source = part: "${pkgs.browserpass}/lib/browserpass/${part}/${appId}";
+ in {
+ # chromium
+ "chromium/native-messaging-hosts/${appId}".source = source "hosts/chromium";
+ "chromium/policies/managed/${appId}".source = source "policies/chromium";
+
+ # chrome
+ "opt/chrome/native-messaging-hosts/${appId}".source = source "hosts/chromium";
+ "opt/chrome/policies/managed/${appId}".source = source "policies/chromium";
+
+ # vivaldi
+ "opt/vivaldi/native-messaging-hosts/${appId}".source = source "hosts/chromium";
+ "opt/vivaldi/policies/managed/${appId}".source = source "policies/chromium";
+
+ # brave
+ "opt/brave/native-messaging-hosts/${appId}".source = source "hosts/chromium";
+ "opt/brave/policies/managed/${appId}".source = source "policies/chromium";
+ }
+ # As with the v2 backwards compatibility in the pkgs.browserpass
+ # declaration, this part can be removed once the browser extension
+ # auto-updates to v3 (planned 2019-04-13, see
+ # https://github.com/browserpass/browserpass-native/issues/31)
+ // {
"chromium/native-messaging-hosts/com.dannyvankooten.browserpass.json".source = "${pkgs.browserpass}/etc/chrome-host.json";
"chromium/policies/managed/com.dannyvankooten.browserpass.json".source = "${pkgs.browserpass}/etc/chrome-policy.json";
"opt/chrome/native-messaging-hosts/com.dannyvankooten.browserpass.json".source = "${pkgs.browserpass}/etc/chrome-host.json";