mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
browserpass: add brave support
This commit is contained in:
parent
0520e387dc
commit
d123fca83c
2 changed files with 24 additions and 7 deletions
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let browsers = [ "chrome" "chromium" "firefox" "vivaldi" ];
|
let
|
||||||
|
cfg = config.programs.browserpass;
|
||||||
|
browsers = [ "brave" "chrome" "chromium" "firefox" "vivaldi" ];
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
programs.browserpass = {
|
programs.browserpass = {
|
||||||
|
@ -17,10 +19,22 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf config.programs.browserpass.enable {
|
config = mkIf cfg.enable {
|
||||||
home.file = foldl' (a: b: a // b) { } (concatMap (x:
|
home.file = foldl' (a: b: a // b) { } (concatMap (x:
|
||||||
with pkgs.stdenv;
|
with pkgs.stdenv;
|
||||||
if x == "chrome" then
|
if x == "brave" then
|
||||||
|
let
|
||||||
|
dir = if isDarwin then
|
||||||
|
"Library/Application Support/BraveSoftware/Brave-Browser/NativeMessagingHosts"
|
||||||
|
else
|
||||||
|
".config/BraveSoftware/Brave-Browser/NativeMessagingHosts";
|
||||||
|
in [{
|
||||||
|
# Policies are read from `/etc/brave/policies` only
|
||||||
|
# https://github.com/brave/brave-browser/issues/19052
|
||||||
|
"${dir}/com.github.browserpass.native.json".source =
|
||||||
|
"${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
|
||||||
|
}]
|
||||||
|
else if x == "chrome" then
|
||||||
let
|
let
|
||||||
dir = if isDarwin then
|
dir = if isDarwin then
|
||||||
"Library/Application Support/Google/Chrome/NativeMessagingHosts"
|
"Library/Application Support/Google/Chrome/NativeMessagingHosts"
|
||||||
|
@ -71,6 +85,6 @@ in {
|
||||||
"${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
|
"${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
|
||||||
}]
|
}]
|
||||||
else
|
else
|
||||||
throw "unknown browser ${x}") config.programs.browserpass.browsers);
|
throw "unknown browser ${x}") cfg.browsers);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,11 @@ with lib;
|
||||||
config = {
|
config = {
|
||||||
programs.browserpass = {
|
programs.browserpass = {
|
||||||
enable = true;
|
enable = true;
|
||||||
browsers = [ "chrome" "chromium" "firefox" "vivaldi" ];
|
browsers = [ "brave" "chrome" "chromium" "firefox" "vivaldi" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
nmt.script = if pkgs.stdenv.hostPlatform.isDarwin then ''
|
nmt.script = if pkgs.stdenv.hostPlatform.isDarwin then ''
|
||||||
for dir in "Google/Chrome" "Chromium" "Mozilla" "Vivaldi"; do
|
for dir in "BraveSoftware/Brave-Browser" "Google/Chrome" "Chromium" "Mozilla" "Vivaldi"; do
|
||||||
assertFileExists "home-files/Library/Application Support/$dir/NativeMessagingHosts/com.github.browserpass.native.json"
|
assertFileExists "home-files/Library/Application Support/$dir/NativeMessagingHosts/com.github.browserpass.native.json"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -18,8 +18,11 @@ with lib;
|
||||||
assertFileExists "home-files/Library/Application Support/$dir/policies/managed/com.github.browserpass.native.json"
|
assertFileExists "home-files/Library/Application Support/$dir/policies/managed/com.github.browserpass.native.json"
|
||||||
done
|
done
|
||||||
'' else ''
|
'' else ''
|
||||||
for dir in "google-chrome" "chromium" "vivaldi"; do
|
for dir in "BraveSoftware/Brave-Browser" "google-chrome" "chromium" "vivaldi"; do
|
||||||
assertFileExists "home-files/.config/$dir/NativeMessagingHosts/com.github.browserpass.native.json"
|
assertFileExists "home-files/.config/$dir/NativeMessagingHosts/com.github.browserpass.native.json"
|
||||||
|
done
|
||||||
|
|
||||||
|
for dir in "google-chrome" "chromium" "vivaldi"; do
|
||||||
assertFileExists "home-files/.config/$dir/policies/managed/com.github.browserpass.native.json"
|
assertFileExists "home-files/.config/$dir/policies/managed/com.github.browserpass.native.json"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue