Nixos-install keeps borking itself with a syntax error

This is really bugging me, because this son of a b*tch won’t install

error: syntax error, unexpected '}', expecting ';'

       at /mnt/etc/nixos/configuration.nix:88:1:

           87|      hashedPassword = "$6$uG1MvA/CwdcJMq.Y$zB3u7DRHZxh0oaEXouHuy58GpDS0x9SJO.xXdaREi9rxtw73JW4c9K1l3pP9.dQxkm8MAve0hgArnFE/yMQU20"
           88| };
             | ^
           89|

       … while evaluating 'isFunction'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:441:16:

          440|   */
          441|   isFunction = f: builtins.isFunction f ||
             |                ^
          442|     (f ? __functor && isFunction (f.__functor f));

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:386:68:

          385|
          386|   applyIfFunction = key: f: args@{ config, options, lib, ... }: if isFunction f then
             |                                                                    ^
          387|     let

       … while evaluating 'applyIfFunction'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:386:29:

          385|
          386|   applyIfFunction = key: f: args@{ config, options, lib, ... }: if isFunction f then
             |                             ^
          387|     let

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:289:59:

          288|           throw "Module imports can't be nested lists. Perhaps you meant to remove one level of lists? Definitions: ${showDefs defs}"
          289|         else unifyModuleSyntax (toString m) (toString m) (applyIfFunction (toString m) (import m) args);
             |                                                           ^
          290|

       … while evaluating 'unifyModuleSyntax'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:356:34:

          355|      of ‘options’, ‘config’ and ‘imports’ attributes. */
          356|   unifyModuleSyntax = file: key: m:
             |                                  ^
          357|     let

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:289:14:

          288|           throw "Module imports can't be nested lists. Perhaps you meant to remove one level of lists? Definitions: ${showDefs defs}"
          289|         else unifyModuleSyntax (toString m) (toString m) (applyIfFunction (toString m) (import m) args);
             |              ^
          290|

       … while evaluating 'loadModule'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:283:53:

          282|       # Like unifyModuleSyntax, but also imports paths and calls functions if necessary
          283|       loadModule = args: fallbackFile: fallbackKey: m:
             |                                                     ^
          284|         if isFunction m || isAttrs m then

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:324:22:

          323|           let
          324|             module = loadModule args parentFile "${parentKey}:anon-${toString n}" x;
             |                      ^
          325|             collectedImports = collectStructuredModules module._file module.key module.imports args;

       … while evaluating the attribute 'disabled'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:319:13:

          318|           collectResults = modules: {
          319|             disabled = concatLists (catAttrs "disabled" modules);
             |             ^
          320|             inherit modules;

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:341:31:

          340|           disabledKeys = map moduleKey disabled;
          341|           keyFilter = filter (attrs: ! elem attrs.key disabledKeys);
             |                               ^
          342|         in map (attrs: attrs.module) (builtins.genericClosure {

       … from call site

       … while evaluating 'filterModules'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:337:36:

          336|       # modules recursively. It returns the final list of unique-by-key modules
          337|       filterModules = modulesPath: { disabled, modules }:
             |                                    ^
          338|         let

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:7:

          347|     in modulesPath: initialModules: args:
          348|       filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args);
             |       ^
          349|

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:347:37:

          346|
          347|     in modulesPath: initialModules: args:
             |                                     ^
          348|       filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args);

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:193:25:

          192|       merged =
          193|         let collected = collectModules
             |                         ^
          194|           (specialArgs.modulesPath or "")

       … while evaluating 'reverseList'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:394:17:

          393|   */
          394|   reverseList = xs:
             |                 ^
          395|     let l = length xs; in genList (n: elemAt xs (l - n - 1)) l;

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:197:33:

          196|           ({ inherit lib options config specialArgs; } // specialArgs);
          197|         in mergeModules prefix (reverseList collected);
             |                                 ^
          198|

       … while evaluating 'byName'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:462:25:

          461|       */
          462|       byName = attr: f: modules:
             |                         ^
          463|         zipAttrsWith (n: concatLists)

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:479:21:

          478|       # an attrset 'name' => list of submodules that declare ‘name’.
          479|       declsByName = byName "options" (module: option:
             |                     ^
          480|           [{ inherit (module) _file; options = option; }]

       … while evaluating the attribute 'matchedOptions'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:558:14:

          557|     in {
          558|       inherit matchedOptions;
             |              ^
          559|

       … while evaluating 'mapAttrsRecursiveCond'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:393:36:

          392|   */
          393|   mapAttrsRecursiveCond = cond: f: set:
             |                                    ^
          394|     let

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:205:28:

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

       … while evaluating the attribute 'config.system.build.toplevel'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:270:9:

          269|         options = checked options;
          270|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          271|         _module = checked (config._module);

I don’t have a clue about this. Can someone please help me?

1 Like

You need a semicolon at the end of the hashedPassword line

2 Likes

Found this thread based on searching for this error – for me the issue was a conflict in defining users.packages as well as home-manager.