mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-31 04:04:32 +00:00
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>
This commit is contained in:
parent
22a36aa709
commit
d3ebdb59a3
10 changed files with 65 additions and 67 deletions
|
@ -16,8 +16,7 @@ let
|
|||
|
||||
supportedPlatforms = flatten (attrVals (attrNames platforms) lib.platforms);
|
||||
|
||||
isWrapped = versionAtLeast config.home.stateVersion "19.09"
|
||||
&& wrappedPackageName != null;
|
||||
isWrapped = wrappedPackageName != null;
|
||||
|
||||
defaultPackageName =
|
||||
if isWrapped then wrappedPackageName else unwrappedPackageName;
|
||||
|
@ -243,10 +242,8 @@ in {
|
|||
}
|
||||
'';
|
||||
description = ''
|
||||
The ${appName} package to use. If state version ≥ 19.09 then
|
||||
this should be a wrapped ${appName} package. For earlier state
|
||||
versions it should be an unwrapped ${appName} package.
|
||||
Set to `null` to disable installing ${appName}.
|
||||
The ${appName} package to use. This should be a wrapped ${appName}
|
||||
package. Set to `null` to disable installing ${appName}.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -298,6 +298,10 @@ in import nmtSrc {
|
|||
./modules/programs/emacs
|
||||
./modules/programs/fastfetch
|
||||
./modules/programs/feh
|
||||
./modules/programs/firefox
|
||||
./modules/programs/firefox/firefox.nix
|
||||
./modules/programs/firefox/floorp.nix
|
||||
./modules/programs/firefox/librewolf.nix
|
||||
./modules/programs/fish
|
||||
./modules/programs/gallery-dl
|
||||
./modules/programs/gh
|
||||
|
@ -437,10 +441,6 @@ in import nmtSrc {
|
|||
./modules/programs/boxxy
|
||||
./modules/programs/cavalier
|
||||
./modules/programs/eww
|
||||
./modules/programs/firefox
|
||||
./modules/programs/firefox/firefox.nix
|
||||
./modules/programs/firefox/floorp.nix
|
||||
./modules/programs/firefox/librewolf.nix
|
||||
./modules/programs/foot
|
||||
./modules/programs/freetube
|
||||
./modules/programs/fuzzel
|
||||
|
|
|
@ -15,6 +15,5 @@ builtins.mapAttrs (test: module: import module [ "programs" name ]) {
|
|||
"${name}-profiles-overwrite" = ./profiles/overwrite;
|
||||
"${name}-profiles-search" = ./profiles/search;
|
||||
"${name}-profiles-settings" = ./profiles/settings;
|
||||
"${name}-state-version-19_09" = ./state-version-19_09.nix;
|
||||
"${name}-profiles-shared-path" = ./profiles/shared-path.nix;
|
||||
}
|
||||
|
|
|
@ -68,9 +68,15 @@ in {
|
|||
];
|
||||
};
|
||||
} // {
|
||||
nmt.script = ''
|
||||
nmt.script = let
|
||||
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
|
||||
profilePath = if isDarwin then
|
||||
"Library/Application Support/Firefox/Profiles"
|
||||
else
|
||||
".mozilla/firefox";
|
||||
in ''
|
||||
bookmarksUserJs=$(normalizeStorePaths \
|
||||
home-files/${cfg.configPath}/bookmarks/user.js)
|
||||
"home-files/${profilePath}/bookmarks/user.js")
|
||||
|
||||
assertFileContent \
|
||||
$bookmarksUserJs \
|
||||
|
@ -78,7 +84,9 @@ in {
|
|||
|
||||
bookmarksFile="$(sed -n \
|
||||
'/browser.bookmarks.file/ {s|^.*\(/nix/store[^"]*\).*|\1|;p}' \
|
||||
$TESTED/home-files/${cfg.configPath}/bookmarks/user.js)"
|
||||
$TESTED/home-files/'${profilePath}'/bookmarks/user.js)"""
|
||||
|
||||
echo "bookmarksFile: $bookmarksFile"
|
||||
|
||||
assertFileContent \
|
||||
$bookmarksFile \
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
modulePath:
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
|
||||
cfg = lib.getAttrFromPath modulePath config;
|
||||
|
||||
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
let firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
|
||||
in {
|
||||
imports = [ firefoxMockOverlay ];
|
||||
|
||||
|
@ -20,9 +15,15 @@ in {
|
|||
};
|
||||
};
|
||||
} // {
|
||||
nmt.script = ''
|
||||
nmt.script = let
|
||||
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
|
||||
profilePath = if isDarwin then
|
||||
"Library/Application Support/Firefox/Profiles"
|
||||
else
|
||||
".mozilla/firefox";
|
||||
in ''
|
||||
assertFileContent \
|
||||
home-files/${cfg.configPath}/containers/containers.json \
|
||||
"home-files/${profilePath}/containers/containers.json" \
|
||||
${./expected-containers.json}
|
||||
'';
|
||||
});
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
modulePath:
|
||||
{ config, lib, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = lib.getAttrFromPath modulePath config;
|
||||
|
||||
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
|
||||
let firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
|
||||
in {
|
||||
imports = [ firefoxMockOverlay ];
|
||||
|
||||
|
@ -27,9 +24,15 @@ in {
|
|||
};
|
||||
};
|
||||
} // {
|
||||
nmt.script = ''
|
||||
nmt.script = let
|
||||
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
|
||||
profilePath = if isDarwin then
|
||||
"Library/Application Support/Firefox/Profiles"
|
||||
else
|
||||
".mozilla/firefox";
|
||||
in ''
|
||||
assertFileContent \
|
||||
home-files/${cfg.configPath}/extensions/browser-extension-data/uBlock0@raymondhill.net/storage.js \
|
||||
"home-files/${profilePath}/extensions/browser-extension-data/uBlock0@raymondhill.net/storage.js" \
|
||||
${./expected-storage.js}
|
||||
'';
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
modulePath:
|
||||
{ config, lib, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
|
@ -26,15 +26,17 @@ in {
|
|||
};
|
||||
};
|
||||
} // {
|
||||
nmt.script = ''
|
||||
assertFileRegex \
|
||||
home-path/bin/${cfg.wrappedPackageName} \
|
||||
MOZ_APP_LAUNCHER
|
||||
|
||||
assertDirectoryExists home-files/${cfg.configPath}/basic
|
||||
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/${cfg.configPath}/test/user.js \
|
||||
"home-files/${profilePath}/test/user.js" \
|
||||
${./expected-user.js}
|
||||
'';
|
||||
});
|
||||
|
|
|
@ -93,6 +93,11 @@ in {
|
|||
};
|
||||
} // {
|
||||
nmt.script = let
|
||||
isDarwin = pkgs.stdenv.hostPlatform.isDarwin;
|
||||
profilePath = if isDarwin then
|
||||
"Library/Application Support/Firefox/Profiles"
|
||||
else
|
||||
".mozilla/firefox";
|
||||
|
||||
noHashQuery = ''
|
||||
'def walk(f):
|
||||
|
@ -125,11 +130,11 @@ in {
|
|||
}
|
||||
|
||||
assertFirefoxSearchContent \
|
||||
home-files/${cfg.configPath}/search/search.json.mozlz4 \
|
||||
"home-files/${profilePath}/search/search.json.mozlz4" \
|
||||
${withName ./expected-search.json}
|
||||
|
||||
assertFirefoxSearchContent \
|
||||
home-files/${cfg.configPath}/searchWithoutDefault/search.json.mozlz4 \
|
||||
"home-files/${profilePath}/searchWithoutDefault/search.json.mozlz4" \
|
||||
${withName ./expected-search-without-default.json}
|
||||
'';
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
modulePath:
|
||||
{ config, lib, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
|
@ -26,15 +26,17 @@ in {
|
|||
};
|
||||
};
|
||||
} // {
|
||||
nmt.script = ''
|
||||
assertFileRegex \
|
||||
home-path/bin/${cfg.wrappedPackageName} \
|
||||
MOZ_APP_LAUNCHER
|
||||
|
||||
assertDirectoryExists home-files/${cfg.configPath}/basic
|
||||
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/${cfg.configPath}/test/user.js \
|
||||
"home-files/${profilePath}/test/user.js" \
|
||||
${./expected-user.js}
|
||||
'';
|
||||
});
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
modulePath:
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = lib.getAttrFromPath modulePath config;
|
||||
|
||||
firefoxMockOverlay = import ./setup-firefox-mock-overlay.nix modulePath;
|
||||
in {
|
||||
imports = [ firefoxMockOverlay ];
|
||||
|
||||
config = lib.mkIf config.test.enableBig ({
|
||||
home.stateVersion = "19.09";
|
||||
} // lib.setAttrByPath modulePath { enable = true; } // {
|
||||
nmt.script = ''
|
||||
assertFileRegex \
|
||||
home-path/bin/${cfg.wrappedPackageName} \
|
||||
MOZ_APP_LAUNCHER
|
||||
'';
|
||||
});
|
||||
}
|
Loading…
Add table
Reference in a new issue