From e98ee8d70c29de95682c10819ec46e2ee5eaabff Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Sun, 31 Mar 2019 23:12:07 +0200 Subject: 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. --- nixos/modules/programs/browserpass.nix | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'nixos/modules/programs') 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"; -- cgit v1.2.3