[Help] setting up firefox with home-manager

I am trying to set up Firefox with home-manager, all going well, except that option for search mainly for search.default and search.engines

Here is the error, I get it, but IDK why. I am getting it :slightly_frowning_face:

warning: Git tree '/home/mahmoud/.config/nixpkgs' is dirty
building the system configuration...
warning: Git tree '/home/mahmoud/.config/nixpkgs' is dirty
error: The option `home-manager.users.mahmoud.programs.firefox.profiles.mahmoud.search' does not exist. Definition values:
       - In `/nix/store/z11w3maxz4g275a1p5zrwbvg7x4jw3sc-source/modules/programs/firefox.nix':
           {
             default = "DuckDuckGo";
             engines = {
               "Amazon.com" = {
                 metaData = {
           ...
(use '--show-trace' to show detailed location information)

And here is my setting

{ config, pkgs, theme, ... }:

{
    programs.firefox = {
        enable = true;
        package = pkgs.wrapFirefox pkgs.firefox-unwrapped {
            extraPolicies = {
                CaptivePortal = false;
                DisableFirefoxStudies = true;
                DisablePocket = true;
                DisableTelemetry = true;
                DisableFirefoxAccounts = false;
                NoDefaultBookmarks = true;
                OfferToSaveLogins = false;
                OfferToSaveLoginsDefault = false;
                PasswordManagerEnabled = false;
                FirefoxHome = {
                    Search = true;
                    Pocket = false;
                    Snippets = false;
                    TopSites = false;
                    Highlights = false;
                };
                UserMessaging = {
                    ExtensionRecommendations = false;
                    SkipOnboarding = true;
                };
            };
        };
        extensions = with pkgs.nur.repos.rycee.firefox-addons; [
            ublock-origin
            privacy-badger
            https-everywhere
            bitwarden
            clearurls
            decentraleyes
            duckduckgo-privacy-essentials
            floccus
            ghostery
            privacy-redirect
            privacy-badger
            languagetool
            disconnect
            react-devtools
        ];
        profiles = {
            mahmoud = {
                id = 0;
                name = "mahmoud";
                search = {
                    force = true;
                    default = "DuckDuckGo";
                    engines = {
                        "Nix Packages" = {
                            urls = [{
                                template = "https://search.nixos.org/packages";
                                params = [
                                    { name = "type"; value = "packages"; }
                                    { name = "query"; value = "{searchTerms}"; }
                                ];
                            }];
                            icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
                            definedAliases = [ "@np" ];
                        };
                        "NixOS Wiki" = {
                            urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}"; }];
                            iconUpdateURL = "https://nixos.wiki/favicon.png";
                            updateInterval = 24 * 60 * 60 * 1000;
                            definedAliases = [ "@nw" ];
                        };
                        "Wikipedia (en)".metaData.alias = "@wiki";
                        "Google".metaData.hidden = true;
                        "Amazon.com".metaData.hidden = true;
                        "Bing".metaData.hidden = true;
                        "eBay".metaData.hidden = true;
                    };
                };
                settings = {
                    "general.smoothScroll" = true;
                };
                extraConfig = ''
                    user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);
                    user_pref("full-screen-api.ignore-widgets", true);
                    user_pref("media.ffmpeg.vaapi.enabled", true);
                    user_pref("media.rdd-vpx.enabled", true);
                '';
                userChrome = ''
                 # a css 
                ";
                userContent = ''
                 # Here too
                '';
            };
        };
    };
}

This is fairly new, what commit of home manager are you using? This is a flake, right?

nix flake lock --update-input home-manager or such should do it, assuming you’re using the master branch.

Also.thanks for pointing out this exists now, I need to dig into the magic sometime. My previous attempts at implementing it failed horribly :slight_smile:

1 Like

Yes, flakes and home-manager as module. I am using nixos-rebuild switch --flake '.#labbi'

Yep, as I said, you will probably need to update your flake inputs then.

Flakes don’t use channels, but instead the versions of inputs listed in flake.lock. If you look into that file you’ll probably see a reference to home-manager, and that it’s not up-to-date with master.

If you’re on NixOS unstable, you can just use the command I mentioned to update that (or perhaps nix flake update to update all of them, sounds like that might be a good idea).

If you are on stable, however, you might need to wait until the end of the month for the 22.11 update, otherwise your home-manager and nixpkgs might go a bit out of sync.

1 Like

Thanks, I think this solved my problem.
Dramatically I ended with new one, that are so unclear

building the system configuration...
error: value is a list while a set was expected
(use '--show-trace' to show detailed location information

Any clue on how to debug this one!
MyConfig

The link is broken.

And this post needs 20 characters at least.

Yea, sorry. Fixed it now. Please recheck it.

Hard to say without a --show-trace, sadly.

Here you go. Thanks for helping me out!

EDIT: This was a hard one, but figured it out. was in vscode. Thank you all!

building the system configuration...
error: value is a list while a set was expected

       … while evaluating the attribute 'condition'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:870:14:

          869|     { _type = "if";
          870|       inherit condition content;
             |              ^
          871|     };

       … while evaluating 'dischargeProperties'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:799:25:

          798|   */
          799|   dischargeProperties = def:
             |                         ^
          800|     if def._type or "" == "merge" then

       … from call site

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:801:7:

          800|     if def._type or "" == "merge" then
          801|       concatMap dischargeProperties def.contents
             |       ^
          802|     else if def._type or "" == "if" then

       … while evaluating 'dischargeProperties'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:799:25:

          798|   */
          799|   dischargeProperties = def:
             |                         ^
          800|     if def._type or "" == "merge" then

       … from call site

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:805:11:

          804|         if def.condition then
          805|           dischargeProperties def.content
             |           ^
          806|         else

       … while evaluating 'dischargeProperties'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:799:25:

          798|   */
          799|   dischargeProperties = def:
             |                         ^
          800|     if def._type or "" == "merge" then

       … from call site

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:728:137:

          727|         defs' = concatMap (m:
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          729|         ) defs;

       … while evaluating definitions from `/nix/store/dgmfs9lvhhifcxpw1yrdk4dpkj2d81hc-source/modules/programs/vscode.nix':

       … while evaluating anonymous lambda

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:727:28:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                            ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … from call site

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:727:17:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                 ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating the attribute 'values'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:840:7:

          839|     in {
          840|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          841|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:741:9:

          740|       in {
          741|         values = defs''';
             |         ^
          742|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'mergedValue'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:747:5:

          746|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          747|     mergedValue =
             |     ^
          748|       if isDefined then

       … while evaluating the option `home-manager.users.mahmoud.home.file':

       … while evaluating the attribute 'value'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:712:9:

          711|     in warnDeprecation opt //
          712|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          713|         inherit (res.defsFinal') highestPrio;

       … while evaluating anonymous lambda

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:265:72:

          264|           # For definitions that have an associated option
          265|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          266|

       … from call site

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/attrsets.nix:401:20:

          400|               then recurse (path ++ [name]) value
          401|               else f (path ++ [name]) value;
             |                    ^
          402|         in mapAttrs g;

       … while evaluating 'g'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … from call site

       … while evaluating 'mapAttrsToList'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/attrsets.nix:355:23:

          354|   */
          355|   mapAttrsToList = f: attrs:
             |                       ^
          356|     map (name: f name attrs.${name}) (attrNames attrs);

       … from call site

       at /nix/store/dgmfs9lvhhifcxpw1yrdk4dpkj2d81hc-source/modules/files.nix:48:14:

           47|             (foldAttrs (acc: v: acc + v) 0
           48|             (mapAttrsToList (n: v: { ${v.target} = 1; }) cfg)));
             |              ^
           49|         dupsStr = concatStringsSep ", " dups;

       … while evaluating 'fold''

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/lists.nix:56:15:

           55|       len = length list;
           56|       fold' = n:
             |               ^
           57|         if n == len

       … from call site

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/lists.nix:60:8:

           59|         else op (elemAt list n) (fold' (n + 1));
           60|     in fold' 0;
             |        ^
           61|

       … while evaluating 'foldr'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/lists.nix:53:20:

           52|   */
           53|   foldr = op: nul: list:
             |                    ^
           54|     let

       … from call site

       at /nix/store/dgmfs9lvhhifcxpw1yrdk4dpkj2d81hc-source/modules/files.nix:47:14:

           46|             (filterAttrs (n: v: v > 1)
           47|             (foldAttrs (acc: v: acc + v) 0
             |              ^
           48|             (mapAttrsToList (n: v: { ${v.target} = 1; }) cfg)));

       … while evaluating 'filterAttrs'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/attrsets.nix:224:23:

          223|   */
          224|   filterAttrs = pred: set:
             |                       ^
          225|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

       … from call site

       at /nix/store/dgmfs9lvhhifcxpw1yrdk4dpkj2d81hc-source/modules/files.nix:46:14:

           45|           attrNames
           46|             (filterAttrs (n: v: v > 1)
             |              ^
           47|             (foldAttrs (acc: v: acc + v) 0

       … while evaluating the attribute 'assertion'

       at /nix/store/dgmfs9lvhhifcxpw1yrdk4dpkj2d81hc-source/modules/files.nix:51:9:

           50|       in {
           51|         assertion = dups == [];
             |         ^
           52|         message = ''

       … while evaluating the attribute 'assertion'

       at /nix/store/dgmfs9lvhhifcxpw1yrdk4dpkj2d81hc-source/nixos/common.nix:105:28:

          104|       flip map config.assertions (assertion: {
          105|         inherit (assertion) assertion;
             |                            ^
          106|         message = "${user} profile: ${assertion.message}";

       … while evaluating anonymous lambda

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/nixos/modules/system/activation/top-level.nix:114:50:

          113|
          114|   failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
             |                                                  ^
          115|

       … from call site

       … while evaluating 'fold''

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/lists.nix:56:15:

           55|       len = length list;
           56|       fold' = n:
             |               ^
           57|         if n == len

       … from call site

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/lists.nix:60:8:

           59|         else op (elemAt list n) (fold' (n + 1));
           60|     in fold' 0;
             |        ^
           61|

       … while evaluating 'foldr'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/lists.nix:53:20:

           52|   */
           53|   foldr = op: nul: list:
             |                    ^
           54|     let

       … from call site

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/nixos/modules/system/activation/top-level.nix:121:12:

          120|   # Replace runtime dependencies
          121|   system = foldr ({ oldDependency, newDependency }: drv:
             |            ^
          122|       pkgs.replaceDependency { inherit oldDependency newDependency drv; }

       … while evaluating the attribute 'value'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:552:44:

          551|       defnsByName' = byName "config" (module: value:
          552|           [{ inherit (module) file; inherit value; }]
             |                                            ^
          553|         ) configs;

       … while evaluating 'dischargeProperties'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:799:25:

          798|   */
          799|   dischargeProperties = def:
             |                         ^
          800|     if def._type or "" == "merge" then

       … from call site

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:728:137:

          727|         defs' = concatMap (m:
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          729|         ) defs;

       … while evaluating definitions from `/nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/nixos/modules/system/activation/top-level.nix':

       … while evaluating anonymous lambda

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:727:28:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                            ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … from call site

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:727:17:

          726|         # Process mkMerge and mkIf properties.
          727|         defs' = concatMap (m:
             |                 ^
          728|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating the attribute 'values'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:840:7:

          839|     in {
          840|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          841|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:741:9:

          740|       in {
          741|         values = defs''';
             |         ^
          742|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'mergedValue'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:747:5:

          746|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          747|     mergedValue =
             |     ^
          748|       if isDefined then

       … while evaluating the option `system.build.toplevel':

       … while evaluating the attribute 'value'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:712:9:

          711|     in warnDeprecation opt //
          712|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          713|         inherit (res.defsFinal') highestPrio;

       … while evaluating anonymous lambda

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/modules.nix:265:72:

          264|           # For definitions that have an associated option
          265|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          266|

       … from call site

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/attrsets.nix:401:20:

          400|               then recurse (path ++ [name]) value
          401|               else f (path ++ [name]) value;
             |                    ^
          402|         in mapAttrs g;

       … while evaluating 'g'

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … from call site

       … while evaluating anonymous lambda

       at /nix/store/p6xfpp6i1a2h4ia3v81d1r414v6a603i-source/lib/attrsets.nix:518:24:

          517|     let f = attrPath:
          518|       zipAttrsWith (n: values:
             |                        ^
          519|         let here = attrPath ++ [n]; in

       … from call site