firefox: extract an overlay common to all tests

This commit is contained in:
Damien Cassou 2023-10-13 08:33:10 +02:00 committed by Robert Helgesson
parent 3b67ae3f66
commit f033205b25
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 217 additions and 229 deletions

View file

@ -2,35 +2,20 @@
with lib;
lib.mkIf config.test.enableBig {
{
imports = [ ./setup-firefox-mock-overlay.nix ];
config = lib.mkIf config.test.enableBig {
programs.firefox = {
enable = true;
enableGnomeExtensions = true;
};
nixpkgs.overlays = [
(self: super: {
firefox-unwrapped = pkgs.runCommandLocal "firefox-0" {
meta.description = "I pretend to be Firefox";
passthru.gtk3 = null;
} ''
mkdir -p "$out"/{bin,lib}
touch "$out/bin/firefox"
chmod 755 "$out/bin/firefox"
'';
chrome-gnome-shell =
pkgs.runCommandLocal "dummy-chrome-gnome-shell" { } ''
mkdir -p $out/lib/mozilla/native-messaging-hosts
touch $out/lib/mozilla/native-messaging-hosts/dummy
'';
})
];
test.asserts.warnings.expected = [''
Using 'programs.firefox.enableGnomeExtensions' has been deprecated and
will be removed in the future. Please change to overriding the package
configuration using 'programs.firefox.package' instead. You can refer to
its example for how to do this.
''];
};
}

View file

@ -2,7 +2,10 @@
with lib;
lib.mkIf config.test.enableBig {
{
imports = [ ./setup-firefox-mock-overlay.nix ];
config = lib.mkIf config.test.enableBig {
programs.firefox = {
enable = true;
profiles.basic.isDefault = true;
@ -33,7 +36,8 @@ lib.mkIf config.test.enableBig {
name = "wikipedia";
tags = [ "wiki" ];
keyword = "wiki";
url = "https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
url =
"https://en.wikipedia.org/wiki/Special:Search?search=%s&go=Go";
}
{
name = "kernel.org";
@ -140,20 +144,6 @@ lib.mkIf config.test.enableBig {
};
};
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"
'';
})
];
nmt.script = ''
assertFileRegex \
home-path/bin/firefox \
@ -199,4 +189,5 @@ lib.mkIf config.test.enableBig {
home-files/.mozilla/firefox/searchWithoutDefault/search.json.mozlz4 \
${./profile-settings-expected-search-without-default.json}
'';
};
}

View file

@ -0,0 +1,22 @@
{ pkgs, ... }:
{
nixpkgs.overlays = [
(self: super: {
firefox-unwrapped = pkgs.runCommandLocal "firefox-0" {
meta.description = "I pretend to be Firefox";
passthru.gtk3 = null;
} ''
mkdir -p "$out"/{bin,lib}
touch "$out/bin/firefox"
chmod 755 "$out/bin/firefox"
'';
chrome-gnome-shell =
pkgs.runCommandLocal "dummy-chrome-gnome-shell" { } ''
mkdir -p $out/lib/mozilla/native-messaging-hosts
touch $out/lib/mozilla/native-messaging-hosts/dummy
'';
})
];
}

View file

@ -2,28 +2,18 @@
with lib;
lib.mkIf config.test.enableBig {
{
imports = [ ./setup-firefox-mock-overlay.nix ];
config = lib.mkIf config.test.enableBig {
home.stateVersion = "19.09";
programs.firefox.enable = true;
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"
'';
})
];
nmt.script = ''
assertFileRegex \
home-path/bin/firefox \
MOZ_APP_LAUNCHER
'';
};
}