1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 06:59:45 +01:00

browserpass: use attribute set to define files

To avoid warning message concerning deprecation of the `loaOf` type.
This commit is contained in:
Robert Helgesson 2020-01-11 19:26:32 +01:00
parent 00e26ceffe
commit 8ace1ab1b0
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -24,19 +24,19 @@ in {
}; };
config = mkIf config.programs.browserpass.enable { config = mkIf config.programs.browserpass.enable {
home.file = builtins.concatLists (with pkgs.stdenv; map (x: home.file =
foldl' (a: b: a // b) {}
(concatMap (x: with pkgs.stdenv;
if x == "chrome" then if x == "chrome" then
let dir = if isDarwin let dir = if isDarwin
then "Library/Application Support/Google/Chrome/NativeMessagingHosts" then "Library/Application Support/Google/Chrome/NativeMessagingHosts"
else ".config/google-chrome/NativeMessagingHosts"; else ".config/google-chrome/NativeMessagingHosts";
in [ in [
{ {
target = "${dir}/com.github.browserpass.native.json"; "${dir}/com.github.browserpass.native.json".source =
source = "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
} "${dir}/../policies/managed/com.github.browserpass.native.json".source =
{ "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
target = "${dir}/../policies/managed/com.github.browserpass.native.json";
source = "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
} }
] ]
else if x == "chromium" then else if x == "chromium" then
@ -45,36 +45,37 @@ in {
else ".config/chromium/NativeMessagingHosts"; else ".config/chromium/NativeMessagingHosts";
in [ in [
{ {
target = "${dir}/com.github.browserpass.native.json"; "${dir}/com.github.browserpass.native.json".source =
source = "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
} }
{ {
target = "${dir}/../policies/managed/com.github.browserpass.native.json"; "${dir}/../policies/managed/com.github.browserpass.native.json".source =
source = "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json"; "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
} }
] ]
else if x == "firefox" then else if x == "firefox" then
[ { let dir = if isDarwin
target = (if isDarwin
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"; in [
source = "${pkgs.browserpass}/lib/browserpass/hosts/firefox/com.github.browserpass.native.json"; {
} ] "${dir}/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
then "Library/Application Support/Vivaldi/NativeMessagingHosts" then "Library/Application Support/Vivaldi/NativeMessagingHosts"
else ".config/vivaldi/NativeMessagingHosts"; else ".config/vivaldi/NativeMessagingHosts";
in [ in [
{ {
target = "${dir}/com.github.browserpass.native.json"; "${dir}/com.github.browserpass.native.json".source =
source = "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
} "${dir}/../policies/managed/com.github.browserpass.native.json".source =
{ "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
target = "${dir}/../policies/managed/com.github.browserpass.native.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
);
}; };
} }