2019-08-18 10:57:30 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2022-01-02 10:22:50 +01:00
|
|
|
lib.mkIf config.test.enableBig {
|
|
|
|
programs.firefox = {
|
|
|
|
enable = true;
|
|
|
|
profiles.basic.isDefault = true;
|
2021-05-24 17:28:12 +02:00
|
|
|
|
2022-01-02 10:22:50 +01:00
|
|
|
profiles.test = {
|
|
|
|
id = 1;
|
2023-02-05 11:23:22 +01:00
|
|
|
settings = {
|
|
|
|
"general.smoothScroll" = false;
|
|
|
|
"browser.newtabpage.pinned" = [{
|
|
|
|
title = "NixOS";
|
|
|
|
url = "https://nixos.org";
|
|
|
|
}];
|
|
|
|
};
|
2022-01-02 10:22:50 +01:00
|
|
|
};
|
2021-09-29 08:39:17 +02:00
|
|
|
|
2022-01-02 10:22:50 +01:00
|
|
|
profiles.bookmarks = {
|
|
|
|
id = 2;
|
|
|
|
settings = { "general.smoothScroll" = false; };
|
2022-06-20 16:58:26 +02:00
|
|
|
bookmarks = [
|
2022-07-22 15:32:45 +02:00
|
|
|
{
|
|
|
|
toolbar = true;
|
|
|
|
bookmarks = [{
|
|
|
|
name = "Home Manager";
|
|
|
|
url = "https://nixos.wiki/wiki/Home_Manager";
|
|
|
|
}];
|
|
|
|
}
|
2022-06-20 16:58:26 +02:00
|
|
|
{
|
|
|
|
name = "wikipedia";
|
2023-05-04 16:58:13 +02:00
|
|
|
tags = [ "wiki" ];
|
2022-01-02 10:22:50 +01:00
|
|
|
keyword = "wiki";
|
|
|
|
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
|
2022-06-20 16:58:26 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "kernel.org";
|
|
|
|
url = "https://www.kernel.org";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "Nix sites";
|
|
|
|
bookmarks = [
|
|
|
|
{
|
|
|
|
name = "homepage";
|
|
|
|
url = "https://nixos.org/";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "wiki";
|
2023-05-04 16:58:13 +02:00
|
|
|
tags = [ "wiki" "nix" ];
|
2022-06-20 16:58:26 +02:00
|
|
|
url = "https://nixos.wiki/";
|
|
|
|
}
|
2022-08-27 03:28:57 +02:00
|
|
|
{
|
|
|
|
name = "Nix sites";
|
|
|
|
bookmarks = [
|
|
|
|
{
|
|
|
|
name = "homepage";
|
|
|
|
url = "https://nixos.org/";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "wiki";
|
|
|
|
url = "https://nixos.wiki/";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
2022-06-20 16:58:26 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
2019-08-18 10:57:30 +02:00
|
|
|
};
|
2022-05-28 02:01:44 +02:00
|
|
|
|
|
|
|
profiles.search = {
|
|
|
|
id = 3;
|
|
|
|
search = {
|
|
|
|
force = true;
|
|
|
|
default = "DuckDuckGo";
|
|
|
|
order = [ "Nix Packages" "NixOS Wiki" ];
|
|
|
|
engines = {
|
|
|
|
"Nix Packages" = {
|
|
|
|
urls = [{
|
|
|
|
template = "https://search.nixos.org/packages";
|
|
|
|
params = [
|
|
|
|
{
|
|
|
|
name = "type";
|
|
|
|
value = "packages";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "query";
|
|
|
|
value = "{searchTerms}";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}];
|
|
|
|
|
|
|
|
icon =
|
|
|
|
"/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
|
|
|
|
|
|
|
|
definedAliases = [ "@np" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
"NixOS Wiki" = {
|
|
|
|
urls = [{
|
|
|
|
template = "https://nixos.wiki/index.php?search={searchTerms}";
|
|
|
|
}];
|
|
|
|
iconUpdateURL = "https://nixos.wiki/favicon.png";
|
|
|
|
updateInterval = 24 * 60 * 60 * 1000;
|
|
|
|
definedAliases = [ "@nw" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
"Bing".metaData.hidden = true;
|
|
|
|
"Google".metaData.alias = "@g";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-01-07 01:13:13 +01:00
|
|
|
|
|
|
|
profiles.searchWithoutDefault = {
|
|
|
|
id = 4;
|
|
|
|
search = {
|
|
|
|
force = true;
|
|
|
|
order = [ "Google" "Nix Packages" ];
|
|
|
|
engines = {
|
|
|
|
"Nix Packages" = {
|
|
|
|
urls = [{
|
|
|
|
template = "https://search.nixos.org/packages";
|
|
|
|
params = [
|
|
|
|
{
|
|
|
|
name = "type";
|
|
|
|
value = "packages";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "query";
|
|
|
|
value = "{searchTerms}";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}];
|
|
|
|
|
|
|
|
definedAliases = [ "@np" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-01-02 10:22:50 +01:00
|
|
|
};
|
2019-08-18 10:57:30 +02:00
|
|
|
|
2022-01-02 10:22:50 +01:00
|
|
|
nixpkgs.overlays = [
|
|
|
|
(self: super: {
|
|
|
|
firefox-unwrapped = pkgs.runCommand "firefox-0" {
|
|
|
|
meta.description = "I pretend to be Firefox";
|
|
|
|
preferLocalBuild = true;
|
|
|
|
passthru.gtk3 = null;
|
|
|
|
} ''
|
|
|
|
mkdir -p "$out"/{bin,lib}
|
|
|
|
touch "$out/bin/firefox"
|
|
|
|
chmod 755 "$out/bin/firefox"
|
|
|
|
'';
|
|
|
|
})
|
|
|
|
];
|
2019-10-08 22:46:27 +02:00
|
|
|
|
2022-01-02 10:22:50 +01:00
|
|
|
nmt.script = ''
|
|
|
|
assertFileRegex \
|
|
|
|
home-path/bin/firefox \
|
|
|
|
MOZ_APP_LAUNCHER
|
2019-08-18 10:57:30 +02:00
|
|
|
|
2022-01-02 10:22:50 +01:00
|
|
|
assertDirectoryExists home-files/.mozilla/firefox/basic
|
2021-05-24 17:28:12 +02:00
|
|
|
|
2022-01-02 10:22:50 +01:00
|
|
|
assertFileContent \
|
|
|
|
home-files/.mozilla/firefox/test/user.js \
|
|
|
|
${./profile-settings-expected-user.js}
|
2021-09-29 08:39:17 +02:00
|
|
|
|
2022-01-02 10:22:50 +01:00
|
|
|
bookmarksUserJs=$(normalizeStorePaths \
|
|
|
|
home-files/.mozilla/firefox/bookmarks/user.js)
|
2021-09-29 08:39:17 +02:00
|
|
|
|
2022-01-02 10:22:50 +01:00
|
|
|
assertFileContent \
|
|
|
|
$bookmarksUserJs \
|
|
|
|
${./profile-settings-expected-bookmarks-user.js}
|
2021-09-29 08:39:17 +02:00
|
|
|
|
2022-01-02 10:22:50 +01:00
|
|
|
bookmarksFile="$(sed -n \
|
|
|
|
'/browser.bookmarks.file/ {s|^.*\(/nix/store[^"]*\).*|\1|;p}' \
|
|
|
|
$TESTED/home-files/.mozilla/firefox/bookmarks/user.js)"
|
2021-09-29 08:39:17 +02:00
|
|
|
|
2022-01-02 10:22:50 +01:00
|
|
|
assertFileContent \
|
|
|
|
$bookmarksFile \
|
|
|
|
${./profile-settings-expected-bookmarks.html}
|
2022-05-28 02:01:44 +02:00
|
|
|
|
2023-01-07 01:13:13 +01:00
|
|
|
function assertFirefoxSearchContent() {
|
|
|
|
compressedSearch=$(normalizeStorePaths "$1")
|
2022-05-28 02:01:44 +02:00
|
|
|
|
2023-01-07 01:13:13 +01:00
|
|
|
decompressedSearch=$(dirname $compressedSearch)/search.json
|
|
|
|
${pkgs.mozlz4a}/bin/mozlz4a -d "$compressedSearch" >(${pkgs.jq}/bin/jq . > "$decompressedSearch")
|
2022-05-28 02:01:44 +02:00
|
|
|
|
2023-01-07 01:13:13 +01:00
|
|
|
assertFileContent \
|
|
|
|
$decompressedSearch \
|
|
|
|
"$2"
|
|
|
|
}
|
|
|
|
|
|
|
|
assertFirefoxSearchContent \
|
|
|
|
home-files/.mozilla/firefox/search/search.json.mozlz4 \
|
2022-05-28 02:01:44 +02:00
|
|
|
${./profile-settings-expected-search.json}
|
2023-01-07 01:13:13 +01:00
|
|
|
|
|
|
|
assertFirefoxSearchContent \
|
|
|
|
home-files/.mozilla/firefox/searchWithoutDefault/search.json.mozlz4 \
|
|
|
|
${./profile-settings-expected-search-without-default.json}
|
2022-01-02 10:22:50 +01:00
|
|
|
'';
|
2019-08-18 10:57:30 +02:00
|
|
|
}
|