1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-31 04:04:32 +00:00
This commit is contained in:
Ihar Hrachyshka 2025-03-27 22:49:44 +07:00 committed by GitHub
commit 1b53c9c5ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 65 additions and 67 deletions

View file

@ -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;
@ -192,10 +191,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}.
'';
};

View file

@ -304,6 +304,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
@ -451,10 +455,6 @@ in import nmtSrc {
./modules/programs/cavalier
./modules/programs/distrobox
./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

View file

@ -16,6 +16,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;
}

View file

@ -66,9 +66,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 \
@ -76,7 +82,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 \

View file

@ -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}
'';
});

View file

@ -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}
'';
});

View file

@ -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}
'';
});

View file

@ -196,6 +196,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):
@ -228,11 +233,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}
assertFirefoxSearchContent \

View file

@ -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}
'';
});

View file

@ -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
'';
});
}