1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00

browserpass: fix host/policy link sources

This commit is contained in:
Tad Fisher 2019-05-31 11:12:46 -07:00 committed by Robert Helgesson
parent e1535d2bd8
commit e25113bcf0
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 43 additions and 7 deletions

View file

@ -32,11 +32,11 @@ in {
in [ in [
{ {
target = "${dir}/com.github.browserpass.native.json"; target = "${dir}/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/etc/chrome-host.json"; source = "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
} }
{ {
target = "${dir}/../policies/managed/com.github.browserpass.native.json"; target = "${dir}/../policies/managed/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/etc/chrome-policy.json"; source = "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
} }
] ]
else if x == "chromium" then else if x == "chromium" then
@ -46,11 +46,11 @@ in {
in [ in [
{ {
target = "${dir}/com.github.browserpass.native.json"; target = "${dir}/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/etc/chrome-host.json"; source = "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
} }
{ {
target = "${dir}/../policies/managed/com.github.browserpass.native.json"; target = "${dir}/../policies/managed/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/etc/chrome-policy.json"; source = "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
} }
] ]
else if x == "firefox" then else if x == "firefox" then
@ -59,7 +59,7 @@ in {
then "Library/Application Support/Mozilla/NativeMessagingHosts" then "Library/Application Support/Mozilla/NativeMessagingHosts"
else ".mozilla/native-messaging-hosts") else ".mozilla/native-messaging-hosts")
+ "/com.github.browserpass.native.json"; + "/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/lib/mozilla/native-messaging-hosts/com.github.browserpass.native.json"; source = "${pkgs.browserpass}/lib/browserpass/hosts/firefox/com.github.browserpass.native.json";
} ] } ]
else if x == "vivaldi" then else if x == "vivaldi" then
let dir = if isDarwin let dir = if isDarwin
@ -68,11 +68,11 @@ in {
in [ in [
{ {
target = "${dir}/com.github.browserpass.native.json"; target = "${dir}/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/etc/chrome-host.json"; source = "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
} }
{ {
target = "${dir}/../policies/managed/com.github.browserpass.native.json"; target = "${dir}/../policies/managed/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/etc/chrome-policy.json"; source = "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
} }
] ]
else throw "unknown browser ${x}") config.programs.browserpass.browsers); else throw "unknown browser ${x}") config.programs.browserpass.browsers);

View file

@ -16,6 +16,7 @@ import nmt {
modules = import ../modules/modules.nix { inherit pkgs; lib = pkgs.lib; }; modules = import ../modules/modules.nix { inherit pkgs; lib = pkgs.lib; };
testedAttrPath = [ "home" "activationPackage" ]; testedAttrPath = [ "home" "activationPackage" ];
tests = { tests = {
browserpass = ./modules/programs/browserpass.nix;
files-executable = ./modules/files/executable.nix; files-executable = ./modules/files/executable.nix;
files-hidden-source = ./modules/files/hidden-source.nix; files-hidden-source = ./modules/files/hidden-source.nix;
files-source-with-spaces = ./modules/files/source-with-spaces.nix; files-source-with-spaces = ./modules/files/source-with-spaces.nix;

View file

@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.browserpass = {
enable = true;
browsers = [
"chrome"
"chromium"
"firefox"
"vivaldi"
];
};
nmt.script =
if pkgs.stdenv.hostPlatform.isDarwin then ''
for dir in "Google/Chrome" "Chromium" "Mozilla" "Vivaldi"; do
assertFileExists "home-files/Library/Application Support/$dir/NativeMessagingHosts/com.github.browserpass.native.json"
done
for dir in "Google/Chrome" "Chromium" "Vivaldi"; do
assertFileExists "home-files/Library/Application Support/$dir/policies/managed/com.github.browserpass.native.json"
done
'' else ''
for dir in "google-chrome" "chromium" "vivaldi"; do
assertFileExists "home-files/.config/$dir/NativeMessagingHosts/com.github.browserpass.native.json"
assertFileExists "home-files/.config/$dir/policies/managed/com.github.browserpass.native.json"
done
assertFileExists "home-files/.mozilla/native-messaging-hosts/com.github.browserpass.native.json"
'';
};
}