Nix tries to import ./profiles/system

Im trying to add a profile system to my flake.
But it tries to import ./profiles/system,
And for home-manager ./profiles/home,
(Please refer to my git repo, i have it configured with:

  • profile=“rpi”
  • subprofile=“usb_otg”
  • system="aarch64-linux
    ).
    Im running nixos on an rpi5, you can see how i generated the sd-image in the repo.
warning: Git tree '/home/strix/.nix-config' is dirty
error:
       … while calling the 'seq' builtin

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:334:18:

          333|         options = checked options;
          334|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          335|         _module = checked (config._module);

       … while evaluating a branch condition

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:273:9:

          272|       checkUnmatched =
          273|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
             |         ^
          274|           let

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: getting status of '/nix/store/pp790jn8ifbx3jpykjb7h4s7k5xaiphg-source/profiles/system': No such file or directory
syncing home-manager at /home/strix/.nix-config#default

warning: Git tree '/home/strix/.nix-config' is dirty
error (ignored): error: executing SQLite statement 'insert or replace into Attributes(parent, name, type, value) values (4, 'default', 0, NULL)': attempt to write a readonly database, attempt to write a readonly database (in '/home/strix/.cache/nix/eval-cache-v5/035acb3081184a596c099256ecb50c2efb5e65b4f4d813978ce61bbb0b26a632.sqlite')
error:
       … while evaluating a branch condition

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/lists.nix:125:9:

          124|       fold' = n:
          125|         if n == len
             |         ^
          126|         then nul

       … while calling the 'length' builtin

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/lists.nix:123:13:

          122|     let
          123|       len = length list;
             |             ^
          124|       fold' = n:

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: getting status of '/nix/store/pp790jn8ifbx3jpykjb7h4s7k5xaiphg-source/profiles/user': No such file or directory

and full stace:

warning: Git tree '/home/strix/.nix-config' is dirty
error:
       … while calling the 'seq' builtin

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:334:18:

          333|         options = checked options;
          334|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          335|         _module = checked (config._module);

       … while evaluating a branch condition

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:273:9:

          272|       checkUnmatched =
          273|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
             |         ^
          274|           let

       … in the left operand of the AND (&&) operator

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:273:72:

          272|       checkUnmatched =
          273|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
             |                                                                        ^
          274|           let

       … in the left operand of the AND (&&) operator

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:273:33:

          272|       checkUnmatched =
          273|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
             |                                 ^
          274|           let

       … while evaluating a branch condition

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:266:12:

          265|
          266|         in if declaredConfig._module.freeformType == null then declaredConfig
             |            ^
          267|           # Because all definitions that had an associated option ended in

       … from call site

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:254:28:

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

       … while calling 'mapAttrsRecursiveCond'

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/attrsets.nix:1201:5:

         1200|     f:
         1201|     set:
             |     ^
         1202|     let

       … from call site

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:246:33:

          245|           ({ inherit lib options config specialArgs; } // specialArgs);
          246|         in mergeModules prefix (reverseList collected);
             |                                 ^
          247|

       … while calling 'reverseList'

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/lists.nix:1116:17:

         1115|   */
         1116|   reverseList = xs:
             |                 ^
         1117|     let l = length xs; in genList (n: elemAt xs (l - n - 1)) l;

       … from call site

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:241:25:

          240|       merged =
          241|         let collected = collectModules
             |                         ^
          242|           class

       … while calling anonymous lambda

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:452:37:

          451|
          452|     in modulesPath: initialModules: args:
             |                                     ^
          453|       filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args);

       … from call site

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:453:7:

          452|     in modulesPath: initialModules: args:
          453|       filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args);
             |       ^
          454|

       … while calling 'filterModules'

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:420:36:

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

       … while calling anonymous lambda

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:446:31:

          445|           disabledKeys = concatMap ({ file, disabled }: map (moduleKey file) disabled) disabled;
          446|           keyFilter = filter (attrs: ! elem attrs.key disabledKeys);
             |                               ^
          447|         in map (attrs: attrs.module) (genericClosure {

       … from call site

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:407:22:

          406|           let
          407|             module = checkModule (loadModule args parentFile "${parentKey}:anon-${toString n}" x);
             |                      ^
          408|             collectedImports = collectStructuredModules module._file module.key module.imports args;

       … while calling anonymous lambda

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:366:11:

          365|         then
          366|           m:
             |           ^
          367|             if m._class != null -> m._class == class

       … from call site

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:407:35:

          406|           let
          407|             module = checkModule (loadModule args parentFile "${parentKey}:anon-${toString n}" x);
             |                                   ^
          408|             collectedImports = collectStructuredModules module._file module.key module.imports args;

       … while calling 'loadModule'

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:348:53:

          347|       # Like unifyModuleSyntax, but also imports paths and calls functions if necessary
          348|       loadModule = args: fallbackFile: fallbackKey: m:
             |                                                     ^
          349|         if isFunction m then

       … from call site

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:361:14:

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

       … while calling 'unifyModuleSyntax'

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:461:34:

          460|      of ‘options’, ‘config’ and ‘imports’ attributes. */
          461|   unifyModuleSyntax = file: key: m:
             |                                  ^
          462|     let

       … from call site

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:361:59:

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

       … while calling 'applyModuleArgsIfFunction'

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:495:39:

          494|
          495|   applyModuleArgsIfFunction = key: f: args@{ config, ... }:
             |                                       ^
          496|     if isFunction f then applyModuleArgs key f args else f;

       … from call site

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/modules.nix:496:8:

          495|   applyModuleArgsIfFunction = key: f: args@{ config, ... }:
          496|     if isFunction f then applyModuleArgs key f args else f;
             |        ^
          497|

       … while calling 'isFunction'

         at /nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source/lib/trivial.nix:1000:16:

          999|   */
         1000|   isFunction = f: builtins.isFunction f ||
             |                ^
         1001|     (f ? __functor && isFunction (f.__functor f));

       error: getting status of '/nix/store/pp790jn8ifbx3jpykjb7h4s7k5xaiphg-source/profiles/system': No such file or directory

Welcome! I’d like to take a look at your repository, but there’s a problem with the hyperlink you posted. Can you post it again?

I think they accidentally used the wrong slashes, here’s the link: GitHub - Strix-Vyxlor/nix-config: my nix configuration

(see their raw message)

The issue is: in profiles/rpi/usb_otg/configuration.nix, you import system/hardware/mesa.nix and friends with two levels of ../. You need 3: ../../../system/hardware/mesa.nix. Hence why profiles/system, that is profiles/rpi/usb_otg/../../system isn’t found.