KeepassXC-Browser Extension Integration

Hi, I’m tring to integrate KeepassXC using the KeepassXC-Browser extension with Brave (currently a flatpak) and LibreWolf on my NixOS system. I tried the following instructions: KeePassXC: Getting Started Guide, but cannot connect to the database.

image

Is there a way to allow access by configuring my flake or with flatpak? Would be great if the extension could be declared or used as an option or override. Thanks!

Brave installed as flatpak for user:

{ config, pkgs, ... }:  

{
  services.flatpak.packages = [
  "com.brave.Browser"                    # Brave Browser 
  ];
}

Librewolf through home-manager:

{ config, pkgs, ... }:  

{
  home-manager.users.zonsopkomst = { pkgs, ... }: {
    home.packages = with pkgs; [
     librewolf                        # Firefox Web Browser Fork
    ];

      home.stateVersion = "22.11";
  };
}

I tried reaching out to KeePassXC on Matrix first:

Hey @Zonsopkomst, I found your post while searching for the same thing and I don’t know if you got it working or not, but I thought I’d share my progress for anyone looking for this in the future as well.

As far as I know, flatpak integration is still an issue. However, some people found a workaround to get KeepassXC (flatpak version) integration working with flatpaked browsers (including Brave):

That being said, integration with normal Brave and Librewolf (installed from nikpkgs) works without any issues:

  • For Brave, you just go to Settings > Browser Integration > General and tick Brave.

  • For Librewolf, you go to Settings > Browser Integration > Advanced and you tick Use a custom browser configuration location

    • Browser type: Firefox
    • Config Location: ~/.librewolf/native-messaging-hosts

You just need to keep in mind that KeepassXC needs to be open before you open any browsers. You can also autostart it in your DE so you don’t forget.

Hope this helps :smile:

1 Like

@blankparticle Thanks for the comment and sorry I haven’t gotten back in a timely manner. I too ended up going back to the normal Brave and had that working, but couldn’t figure out Librewolf. I was looking for native-messaging-hosts per documentation and could not find the subdirectory for the life of me. Lo and behold, giving it one more try, I copied and pasted your config location into KeePass’ browser integration settings, and it just worked! Turns out the folder is created after this setting is made! :man_facepalming: Thanks so much!

And I think there is a way to to use flatseal or adjust configs another way for flatpaks to integrate better into NixOS, but now that I have this working I have taken the fail and moved on to other issues that I have not yet solved that are more pertinent to me. :grin:

Thanks again!

1 Like

I’m glad to hear this :grin:
Hope you solve your other issues in next to no time. Happy nixing :snowflake:

I’m sure I will get there with time. :grinning: You too! :snowflake:

1 Like

With home-manager, it is sufficient to set

programs.firefox.nativeMessagingHosts = [ pkgs.keepassxc ];

As a side effect, the integration is updated whenever KeePassXC is updated.

2 Likes

Good to know. Thanks. I did not see an option specifically for KeePassXC listed under home-manager options

I wonder if the same would work for Librewolf, even though there is not any option listed for nativeMessageHosts? May have to try when I have some spare time.

The programs.firefox.nativeMessagingHosts option simply links all files under lib/mozilla/native-messaging-hosts/*.json of the listed derivations (see here). So just check whether librewolf exposes such a file.

The ‘magic’ behind how that code works is above my level at the moment, but thank you for the info. :slight_smile: