1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

mkFirefoxModule: revert userChrome changes (#6887)

Reverting all the recent userChrome changes because of too many issues
and bikeshedding.
This commit is contained in:
Austin Horstman 2025-04-22 18:44:48 -07:00 committed by GitHub
parent b99e3e46b8
commit c42f04c83f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 80 deletions

View file

@ -397,19 +397,12 @@ in
};
userChrome = mkOption {
type = types.nullOr (
types.oneOf [
types.lines
types.path
]
);
default = null;
description = ''
Custom ${appName} user chrome CSS.
This can be a path to a file or directory in the Nix store,
or a derivation, or a verbatim multi-line string.
'';
type = types.oneOf [
types.lines
types.path
];
default = "";
description = "Custom ${appName} user chrome CSS.";
example = ''
/* Hide tab bar in FF Quantum */
@-moz-document url(chrome://browser/content/browser.xul), url(chrome://browser/content/browser.xhtml) {
@ -868,35 +861,21 @@ in
]
++ lib.flip mapAttrsToList cfg.profiles (
_: profile:
let
chromePath =
if ((i: (lib.isPath i && lib.pathIsDirectory i) || lib.isDerivation i) profile.userChrome) then
"chrome"
else
"chrome/userChrome.css";
sourcePath =
if ((i: (lib.isPath i && lib.types.path.check i) || lib.isDerivation i) profile.userChrome) then
profile.userChrome
else
null;
in
# Merge the regular profile settings with extension settings
mkMerge (
[
(mkIf (profile.userChrome != null) {
"${profilesPath}/${profile.path}/${chromePath}" =
if sourcePath == null then
{
text = profile.userChrome;
}
else
{
source = sourcePath;
};
})
{
"${profilesPath}/${profile.path}/.keep".text = "";
"${profilesPath}/${profile.path}/chrome/userChrome.css" = mkIf (profile.userChrome != "") (
let
key = if builtins.isString profile.userChrome then "text" else "source";
in
{
"${key}" = profile.userChrome;
}
);
"${profilesPath}/${profile.path}/chrome/userContent.css" = mkIf (profile.userContent != "") (
let
key = if builtins.isString profile.userContent then "text" else "source";

View file

@ -1,12 +1,15 @@
modulePath:
{ config, lib, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = lib.getAttrFromPath modulePath config;
firefoxMockOverlay = import ../../setup-firefox-mock-overlay.nix modulePath;
in
{
imports = [ firefoxMockOverlay ];
@ -18,36 +21,15 @@ in
basic.isDefault = true;
lines = {
id = 1;
userChrome = ''
/*
This is a simple comment that should be written inside the `chrome/userChrome.css`
*/
#urlbar {
min-width: none !important;
border: none !important;
outline: none !important;
}
'';
userChrome = builtins.readFile ./chrome/userChrome.css;
};
path = {
file = {
id = 2;
userChrome = ./chrome/userChrome.css;
};
folder = {
id = 3;
userChrome = ./chrome;
};
derivation = {
derivation-file = {
id = 4;
userChrome = config.lib.test.mkStubPackage {
name = "wavefox";
buildScript = ''
mkdir -p $out
ln -s ${./chrome/userChrome.css} $out/userChrome.css
echo test > $out/README.md
'';
};
userChrome = pkgs.writeText "userChrome.css" (builtins.readFile ./chrome/userChrome.css);
};
};
}
@ -59,28 +41,18 @@ in
assertDirectoryExists home-files/${cfg.configPath}/basic
assertPathNotExists \
home-files/${cfg.configPath}/lines/chrome/extraFile.css
assertFileContent \
home-files/${cfg.configPath}/lines/chrome/userChrome.css \
${./chrome/userChrome.css}
assertFileContent \
home-files/${cfg.configPath}/file/chrome/userChrome.css \
${./chrome/userChrome.css}
assertPathNotExists \
home-files/${cfg.configPath}/path/chrome/extraFile.css
home-files/${cfg.configPath}/derivation-file/chrome/extraFile.css
assertFileContent \
home-files/${cfg.configPath}/path/chrome/userChrome.css \
${./chrome/userChrome.css}
assertFileExists \
home-files/${cfg.configPath}/folder/chrome/extraFile.css
assertFileContent \
home-files/${cfg.configPath}/folder/chrome/userChrome.css \
${./chrome/userChrome.css}
assertFileExists \
home-files/${cfg.configPath}/derivation/chrome/README.md
assertFileContent \
home-files/${cfg.configPath}/derivation/chrome/userChrome.css \
home-files/${cfg.configPath}/derivation-file/chrome/userChrome.css \
${./chrome/userChrome.css}
'';
}