firefox: fix bookmarks backwards compatibility
The legacy attrset option type for `firefox.profiles.<name>.bookmarks`
was accidentally removed in 9d55428. This adds back support for this
type by refactoring the bookmarks submodule. This also adds a new test
ensuring this won't happen again.
This commit is contained in:
parent
5ff90f09d1
commit
62d6a8931e
7 changed files with 167 additions and 70 deletions
|
|
@ -5,6 +5,7 @@ builtins.mapAttrs (test: module: import module [ "programs" name ]) {
|
|||
"${name}-final-package" = ./final-package.nix;
|
||||
"${name}-policies" = ./policies.nix;
|
||||
"${name}-profiles-bookmarks" = ./profiles/bookmarks;
|
||||
"${name}-profiles-bookmarks-attrset" = ./profiles/bookmarks/attrset.nix;
|
||||
"${name}-profiles-containers" = ./profiles/containers;
|
||||
"${name}-profiles-containers-duplicate-ids" =
|
||||
./profiles/containers/duplicate-ids.nix;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
modulePath:
|
||||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
|
||||
cfg = lib.getAttrFromPath modulePath config;
|
||||
|
||||
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
|
||||
|
||||
in {
|
||||
imports = [ firefoxMockOverlay ];
|
||||
|
||||
config = lib.mkIf config.test.enableBig (lib.setAttrByPath modulePath {
|
||||
enable = true;
|
||||
profiles.bookmarks = {
|
||||
settings = { "general.smoothScroll" = false; };
|
||||
bookmarks = {
|
||||
home-manager = {
|
||||
toolbar = true;
|
||||
bookmarks = [{
|
||||
name = "Home Manager";
|
||||
url = "https://wiki.nixos.org/wiki/Home_Manager";
|
||||
}];
|
||||
};
|
||||
wikipedia = {
|
||||
name = "wikipedia";
|
||||
tags = [ "wiki" ];
|
||||
keyword = "wiki";
|
||||
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
|
||||
};
|
||||
kernel-org = {
|
||||
name = "kernel.org";
|
||||
url = "https://www.kernel.org";
|
||||
};
|
||||
nix-sites = {
|
||||
name = "Nix sites";
|
||||
bookmarks = [
|
||||
{
|
||||
name = "homepage";
|
||||
url = "https://nixos.org/";
|
||||
}
|
||||
{
|
||||
name = "wiki";
|
||||
tags = [ "wiki" "nix" ];
|
||||
url = "https://wiki.nixos.org/";
|
||||
}
|
||||
{
|
||||
name = "Nix sites";
|
||||
bookmarks = [
|
||||
{
|
||||
name = "homepage";
|
||||
url = "https://nixos.org/";
|
||||
}
|
||||
{
|
||||
name = "wiki";
|
||||
url = "https://wiki.nixos.org/";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
} // {
|
||||
nmt.script = ''
|
||||
bookmarksUserJs=$(normalizeStorePaths \
|
||||
home-files/${cfg.configPath}/bookmarks/user.js)
|
||||
|
||||
assertFileContent \
|
||||
$bookmarksUserJs \
|
||||
${./expected-bookmarks-user.js}
|
||||
|
||||
bookmarksFile="$(sed -n \
|
||||
'/browser.bookmarks.file/ {s|^.*\(/nix/store[^"]*\).*|\1|;p}' \
|
||||
$TESTED/home-files/${cfg.configPath}/bookmarks/user.js)"
|
||||
|
||||
assertFileContent \
|
||||
$bookmarksFile \
|
||||
${./expected-bookmarks.html}
|
||||
'';
|
||||
});
|
||||
}
|
||||
|
|
@ -24,13 +24,6 @@ in {
|
|||
url = "https://wiki.nixos.org/wiki/Home_Manager";
|
||||
}];
|
||||
}
|
||||
{
|
||||
name = "wikipedia";
|
||||
tags = [ "wiki" ];
|
||||
keyword = "wiki";
|
||||
url =
|
||||
"https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
|
||||
}
|
||||
{
|
||||
name = "kernel.org";
|
||||
url = "https://www.kernel.org";
|
||||
|
|
@ -62,6 +55,13 @@ in {
|
|||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
name = "wikipedia";
|
||||
tags = [ "wiki" ];
|
||||
keyword = "wiki";
|
||||
url =
|
||||
"https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
<DL><p>
|
||||
<DT><A HREF="https://wiki.nixos.org/wiki/Home_Manager" ADD_DATE="1" LAST_MODIFIED="1">Home Manager</A>
|
||||
</DL><p>
|
||||
<DT><A HREF="https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go" ADD_DATE="1" LAST_MODIFIED="1" SHORTCUTURL="wiki" TAGS="wiki">wikipedia</A>
|
||||
<DT><A HREF="https://www.kernel.org" ADD_DATE="1" LAST_MODIFIED="1">kernel.org</A>
|
||||
<DT><H3 ADD_DATE="1" LAST_MODIFIED="1">Nix sites</H3>
|
||||
<DL><p>
|
||||
|
|
@ -22,4 +21,5 @@
|
|||
<DT><A HREF="https://wiki.nixos.org/" ADD_DATE="1" LAST_MODIFIED="1">wiki</A>
|
||||
</DL><p>
|
||||
</DL><p>
|
||||
<DT><A HREF="https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go" ADD_DATE="1" LAST_MODIFIED="1" SHORTCUTURL="wiki" TAGS="wiki">wikipedia</A>
|
||||
</DL>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue