1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-04-13 15:57:47 +00:00
home-manager/tests/modules/programs/firefox/profiles/settings/default.nix
Ihar Hrachyshka d3ebdb59a3 tests: Enable firefox tests for darwin
This change also removes checks for MOZ_APP_LAUNCHER set for wrapped
package: the wrapped binary is in a different location on Darwin; but
the check seems out of place for Home Manager since it doesn't control
exact variables set by nixpkgs package.

This change also removes handling of state version < 19.09 when the
firefox package was not wrapped. It's time to clean up.

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
2025-03-19 10:15:13 -04:00

43 lines
1,011 B
Nix

modulePath:
{ config, lib, pkgs, ... }:
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 = {
basic.isDefault = true;
test = {
id = 1;
settings = {
"general.smoothScroll" = false;
"browser.newtabpage.pinned" = [{
title = "NixOS";
url = "https://nixos.org";
}];
};
};
};
} // {
nmt.script = let
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
profilePath = if isDarwin then
"Library/Application Support/Firefox/Profiles"
else
".mozilla/firefox";
in ''
assertDirectoryExists "home-files/${profilePath}/basic"
assertFileContent \
"home-files/${profilePath}/test/user.js" \
${./expected-user.js}
'';
});
}