Always allow opening org-protocol links in Brave browser on NixOS
I store my bookmarks in an org-mode file, using org-protocol to capture from the Brave browser.
By default, Brave prompts for permission to open these links using an external program. This is really annoying.
Brave policies
To allow opening org-protocol links without prompting for permission from all hosts, you have to set a policy.
Brave stores its policies in the /etc/brave/policies/managed/
folder.
Let's add a policy here that auto launches org-protocol links:
So to add a new policy that auto-launches org-protocol links you can
create a new file in this directory. Lets call it org-protocol.json
:
// file: /etc/brave/policies/managed/org-protocol.json { "AutoLaunchProtocolsFromOrigins": [ { "allowed_origins": [ "*" ], "protocol": "org-protocol" } ] }
This is fine to do on most systems, but if you use nixos, you should create this file from your nixos config.
Creating a brave policy for org-protocol links in NixOS
To create this policy using your nixos config, add the following to your configuration.nix
:
environment.etc = { # file name "brave/policies/managed/org-protocol.json" = { # file contents text = '' { "AutoLaunchProtocolsFromOrigins": [ { "allowed_origins": [ "*" ], "protocol": "org-protocol" } ] } ''; }; };
Then rebuild your configuration using nixos-rebuild switch
.