mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
tests: fix firefox program tests
This commit is contained in:
@@ -1,11 +1,22 @@
|
||||
name:
|
||||
{ lib, name }:
|
||||
let
|
||||
withDefaultStateVersion = module: {
|
||||
imports = [ module ];
|
||||
|
||||
# Stronger than the global test default, but weaker than any test-local
|
||||
# stateVersion assignment.
|
||||
home.stateVersion = lib.mkOverride 900 "26.05";
|
||||
};
|
||||
in
|
||||
builtins.mapAttrs
|
||||
(
|
||||
_test: module:
|
||||
import module [
|
||||
"programs"
|
||||
name
|
||||
]
|
||||
withDefaultStateVersion (
|
||||
import module [
|
||||
"programs"
|
||||
name
|
||||
]
|
||||
)
|
||||
)
|
||||
{
|
||||
"${name}-deprecated-native-messenger" = ./deprecated-native-messenger.nix;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
"firefox-config-path-explicit-legacy" = ./config-path-explicit-legacy.nix;
|
||||
"firefox-config-path-explicit-xdg" = ./config-path-explicit-xdg.nix;
|
||||
@@ -5,6 +6,6 @@
|
||||
"firefox-config-path-warning" = ./config-path-warning.nix;
|
||||
"firefox-multiple-derivatives" = ./multiple-derivatives.nix;
|
||||
}
|
||||
// (import ./firefox.nix)
|
||||
// (import ./floorp.nix)
|
||||
// (import ./librewolf.nix)
|
||||
// (import ./firefox.nix { inherit lib; })
|
||||
// (import ./floorp.nix { inherit lib; })
|
||||
// (import ./librewolf.nix { inherit lib; })
|
||||
|
||||
@@ -22,8 +22,6 @@ lib.mkIf config.test.enableBig (
|
||||
}
|
||||
)
|
||||
// {
|
||||
home.stateVersion = "19.09";
|
||||
|
||||
_module.args.pkgs = lib.mkForce realPkgs;
|
||||
|
||||
nmt.script = ''
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
import ./common.nix "firefox"
|
||||
{ lib, ... }:
|
||||
import ./common.nix {
|
||||
inherit lib;
|
||||
name = "firefox";
|
||||
}
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
import ./common.nix "floorp"
|
||||
{ lib, ... }:
|
||||
import ./common.nix {
|
||||
inherit lib;
|
||||
name = "floorp";
|
||||
}
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
import ./common.nix "librewolf"
|
||||
{ lib, ... }:
|
||||
import ./common.nix {
|
||||
inherit lib;
|
||||
name = "librewolf";
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
lib.mkIf config.test.enableBig {
|
||||
home.stateVersion = "26.05";
|
||||
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
package = null;
|
||||
|
||||
@@ -16,10 +16,7 @@ in
|
||||
imports = [ firefoxMockOverlay ];
|
||||
|
||||
config = lib.mkIf config.test.enableBig (
|
||||
{
|
||||
home.stateVersion = "23.05";
|
||||
}
|
||||
// lib.setAttrByPath modulePath {
|
||||
lib.setAttrByPath modulePath {
|
||||
enable = true;
|
||||
configPath = lib.mkIf pkgs.stdenv.hostPlatform.isLinux ".mozilla/firefox";
|
||||
policies = {
|
||||
@@ -40,9 +37,17 @@ in
|
||||
else
|
||||
"${cfg.finalPackage}/lib/${cfg.finalPackage.unwrapped.libName or cfg.wrappedPackageName}";
|
||||
config_file = "${libDir}/distribution/policies.json";
|
||||
config_file_browser = "${libDir}/browser/distribution/policies.json";
|
||||
in
|
||||
''
|
||||
jq=${lib.getExe pkgs.jq}
|
||||
if [[ -f "${config_file}" ]]; then
|
||||
config_file="${config_file}"
|
||||
elif [[ -f "${config_file_browser}" ]]; then
|
||||
config_file="${config_file_browser}"
|
||||
else
|
||||
fail "Expected ${libDir}/distribution/policies.json to exist but it was not found."
|
||||
fi
|
||||
|
||||
assertFileExists "${config_file}"
|
||||
|
||||
|
||||
@@ -18,11 +18,7 @@ in
|
||||
imports = [ firefoxMockOverlay ];
|
||||
|
||||
config = lib.mkIf config.test.enableBig (
|
||||
{
|
||||
# Required for bookmark policy to get set
|
||||
home.stateVersion = "19.09";
|
||||
}
|
||||
// lib.setAttrByPath modulePath {
|
||||
lib.setAttrByPath modulePath {
|
||||
enable = true;
|
||||
configPath = lib.mkIf pkgs.stdenv.hostPlatform.isLinux ".mozilla/firefox";
|
||||
profiles.bookmarks = {
|
||||
@@ -95,8 +91,17 @@ in
|
||||
else
|
||||
"${cfg.finalPackage}/lib/${cfg.finalPackage.unwrapped.libName or cfg.wrappedPackageName}";
|
||||
config_file = "${libDir}/distribution/policies.json";
|
||||
config_file_browser = "${libDir}/browser/distribution/policies.json";
|
||||
in
|
||||
''
|
||||
if [[ -f "${config_file}" ]]; then
|
||||
config_file="${config_file}"
|
||||
elif [[ -f "${config_file_browser}" ]]; then
|
||||
config_file="${config_file_browser}"
|
||||
else
|
||||
fail "Expected ${libDir}/distribution/policies.json to exist but it was not found."
|
||||
fi
|
||||
|
||||
assertFileExists "${config_file}"
|
||||
|
||||
noDefaultBookmarks_actual_value="$(${lib.getExe pkgs.jq} ".policies.NoDefaultBookmarks" ${config_file})"
|
||||
|
||||
@@ -46,7 +46,7 @@ in
|
||||
in
|
||||
''
|
||||
assertFileRegex \
|
||||
"home-path/${binPath}/${cfg.wrappedPackageName}" \
|
||||
"home-path/${binPath}/${cfg.finalPackage.meta.mainProgram}" \
|
||||
MOZ_APP_LAUNCHER
|
||||
|
||||
assertDirectoryExists "home-files/${cfg.profilesPath}/basic"
|
||||
|
||||
@@ -48,7 +48,7 @@ in
|
||||
in
|
||||
''
|
||||
assertFileRegex \
|
||||
"home-path/${binPath}/${cfg.wrappedPackageName}" \
|
||||
"home-path/${binPath}/${cfg.finalPackage.meta.mainProgram}" \
|
||||
MOZ_APP_LAUNCHER
|
||||
|
||||
assertDirectoryExists "home-files/${cfg.profilesPath}/basic"
|
||||
|
||||
@@ -44,7 +44,7 @@ in
|
||||
in
|
||||
''
|
||||
assertFileRegex \
|
||||
"home-path/${binPath}/${cfg.wrappedPackageName}" \
|
||||
"home-path/${binPath}/${cfg.finalPackage.meta.mainProgram}" \
|
||||
MOZ_APP_LAUNCHER
|
||||
|
||||
assertDirectoryExists "home-files/${cfg.profilesPath}/basic"
|
||||
|
||||
@@ -25,7 +25,7 @@ in
|
||||
binaryName = cfg.wrappedPackageName;
|
||||
gtk3 = null;
|
||||
meta.description = "I pretend to be ${cfg.name}";
|
||||
meta.mainProgram = lib.toLower cfg.name;
|
||||
meta.mainProgram = cfg.wrappedPackageName;
|
||||
};
|
||||
outPath = null;
|
||||
buildScript =
|
||||
|
||||
Reference in New Issue
Block a user