1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-27 20:29:47 +01:00

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 Mikilio
parent 7ad922a956
commit 132e212203
No known key found for this signature in database
GPG key ID: 5B2F1A890CF33F3F
4 changed files with 217 additions and 229 deletions

View file

@ -2,35 +2,20 @@
with lib; with lib;
lib.mkIf config.test.enableBig { {
imports = [ ./setup-firefox-mock-overlay.nix ];
config = lib.mkIf config.test.enableBig {
programs.firefox = { programs.firefox = {
enable = true; enable = true;
enableGnomeExtensions = 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 = ['' test.asserts.warnings.expected = [''
Using 'programs.firefox.enableGnomeExtensions' has been deprecated and Using 'programs.firefox.enableGnomeExtensions' has been deprecated and
will be removed in the future. Please change to overriding the package will be removed in the future. Please change to overriding the package
configuration using 'programs.firefox.package' instead. You can refer to configuration using 'programs.firefox.package' instead. You can refer to
its example for how to do this. its example for how to do this.
'']; ''];
};
} }

View file

@ -2,7 +2,10 @@
with lib; with lib;
lib.mkIf config.test.enableBig { {
imports = [ ./setup-firefox-mock-overlay.nix ];
config = lib.mkIf config.test.enableBig {
programs.firefox = { programs.firefox = {
enable = true; enable = true;
profiles.basic.isDefault = true; profiles.basic.isDefault = true;
@ -33,7 +36,8 @@ lib.mkIf config.test.enableBig {
name = "wikipedia"; name = "wikipedia";
tags = [ "wiki" ]; tags = [ "wiki" ];
keyword = "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"; 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 = '' nmt.script = ''
assertFileRegex \ assertFileRegex \
home-path/bin/firefox \ home-path/bin/firefox \
@ -199,4 +189,5 @@ lib.mkIf config.test.enableBig {
home-files/.mozilla/firefox/searchWithoutDefault/search.json.mozlz4 \ home-files/.mozilla/firefox/searchWithoutDefault/search.json.mozlz4 \
${./profile-settings-expected-search-without-default.json} ${./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; with lib;
lib.mkIf config.test.enableBig { {
imports = [ ./setup-firefox-mock-overlay.nix ];
config = lib.mkIf config.test.enableBig {
home.stateVersion = "19.09"; home.stateVersion = "19.09";
programs.firefox.enable = true; 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 = '' nmt.script = ''
assertFileRegex \ assertFileRegex \
home-path/bin/firefox \ home-path/bin/firefox \
MOZ_APP_LAUNCHER MOZ_APP_LAUNCHER
''; '';
};
} }