mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-31 04:04:32 +00:00
firefox: migrate search config to v11
This commit is contained in:
parent
252cb97a01
commit
e65def07f9
6 changed files with 76 additions and 5 deletions
|
@ -57,7 +57,10 @@ let
|
|||
in if requiredInput.isAppProvided then
|
||||
requiredInput
|
||||
else
|
||||
processCustomEngineInput (input // requiredInput);
|
||||
pipe (input // requiredInput) [
|
||||
migrateEngineToV11
|
||||
processCustomEngineInput
|
||||
];
|
||||
|
||||
buildEngineConfig = name: input:
|
||||
mapAttrs' (name: value: {
|
||||
|
@ -91,7 +94,7 @@ let
|
|||
};
|
||||
|
||||
settings = {
|
||||
version = 7;
|
||||
version = 11;
|
||||
engines = sortEngineConfigs (mapAttrs buildEngineConfig engineInput);
|
||||
|
||||
metaData = optionalAttrs (config.default != null) {
|
||||
|
@ -323,6 +326,23 @@ let
|
|||
}' instead of '${engine}'" engineNameToId.${engine}
|
||||
else
|
||||
engine;
|
||||
|
||||
migrateEngineToV11 = engine:
|
||||
engine // lib.optionalAttrs (engine ? iconMapObj) {
|
||||
iconMapObj = mapAttrs' (name: value:
|
||||
let nameToIntResult = builtins.tryEval (toInt name);
|
||||
in {
|
||||
name = if nameToIntResult.success then
|
||||
name
|
||||
else
|
||||
let size = toString (builtins.fromJSON name).width;
|
||||
in warn
|
||||
"JSON object names for 'iconMapObj' are deprecated, use '${size}' instead of '${name}'"
|
||||
size;
|
||||
|
||||
inherit value;
|
||||
}) engine.iconMapObj;
|
||||
};
|
||||
in {
|
||||
imports = [ (pkgs.path + "/nixos/modules/misc/meta.nix") ];
|
||||
|
||||
|
|
|
@ -142,6 +142,27 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
migrateIconsV11 = {
|
||||
id = 3;
|
||||
search = {
|
||||
force = true;
|
||||
engines = {
|
||||
nixos-wiki = {
|
||||
name = "NixOS Wiki";
|
||||
|
||||
urls = [{
|
||||
template =
|
||||
"https://wiki.nixos.org/w/index.php?search={searchTerms}";
|
||||
}];
|
||||
|
||||
iconMapObj."{\"width\":16,\"height\":16}" =
|
||||
"https://wiki.nixos.org/favicon.ico";
|
||||
|
||||
definedAliases = [ "@nw" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
} // {
|
||||
nmt.script = let
|
||||
|
@ -187,6 +208,10 @@ in {
|
|||
assertFirefoxSearchContent \
|
||||
home-files/${cfg.configPath}/migrateSearchV7/search.json.mozlz4 \
|
||||
${withName ./expected-migrate-search-v7.json}
|
||||
|
||||
assertFirefoxSearchContent \
|
||||
home-files/${cfg.configPath}/migrateIconsV11/search.json.mozlz4 \
|
||||
${withName ./expected-migrate-icons-v11.json}
|
||||
'';
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"engines": [
|
||||
{
|
||||
"_definedAliases": [
|
||||
"@nw"
|
||||
],
|
||||
"_iconMapObj": {
|
||||
"16": "https://wiki.nixos.org/favicon.ico"
|
||||
},
|
||||
"_isAppProvided": false,
|
||||
"_loadPath": "[home-manager]/programs.@name@.profiles.migrateIconsV11.search.engines.nixos-wiki",
|
||||
"_metaData": {},
|
||||
"_name": "NixOS Wiki",
|
||||
"_urls": [
|
||||
{
|
||||
"template": "https://wiki.nixos.org/w/index.php?search={searchTerms}"
|
||||
}
|
||||
],
|
||||
"id": "nixos-wiki"
|
||||
}
|
||||
],
|
||||
"metaData": {
|
||||
"useSavedOrder": false
|
||||
},
|
||||
"version": 11
|
||||
}
|
|
@ -75,5 +75,5 @@
|
|||
"privateDefaultEngineIdHash": "@privateHash@",
|
||||
"useSavedOrder": true
|
||||
},
|
||||
"version": 7
|
||||
"version": 11
|
||||
}
|
||||
|
|
|
@ -38,5 +38,5 @@
|
|||
"metaData": {
|
||||
"useSavedOrder": true
|
||||
},
|
||||
"version": 7
|
||||
"version": 11
|
||||
}
|
||||
|
|
|
@ -75,5 +75,5 @@
|
|||
"privateDefaultEngineIdHash": "@privateHash@",
|
||||
"useSavedOrder": true
|
||||
},
|
||||
"version": 7
|
||||
"version": 11
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue