and the result of the evaluation (with sudo nixos-rebuild test --fast for example) gives
building the system configuration...
error: while evaluating the attribute 'config.system.build.toplevel' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/lib/eval-config.nix:64:5:
while evaluating 'evalModules' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:62:17, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/lib/eval-config.nix:58:12:
while evaluating 'mapAttrsRecursiveCond' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:289:36, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:139:28:
while evaluating 'recurse' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:291:23, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:299:8:
while evaluating the attribute 'matchedOptions' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:414:14:
while evaluating 'flip' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:138:16, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:382:23:
while evaluating 'byName' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:362:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:370:21:
while evaluating 'reverseList' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:393:17, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:131:33:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:249:37, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:127:25:
while evaluating 'filterModules' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:239:36, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:250:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:243:31, called from undefined position:
while evaluating the attribute 'disabled' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:221:13:
while evaluating the attribute 'disabled' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:221:13:
while evaluating 'loadModule' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:188:53, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:226:22:
while evaluating 'unifyModuleSyntax' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:254:34, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:191:14:
while evaluating 'applyIfFunction' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:284:29, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:191:59:
while evaluating anonymous function at /home/sirc/whatever/1/firefox.nix:1:1, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:310:8:
while evaluating the module argument `pkgs' in "/home/sirc/whatever/1/firefox.nix":
infinite recursion encountered, at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:303:28
My questions are then:
why is infinite recursion is triggered ?
and (of course) how can I have this wrapping of Firefox in a separate file ?
The only difference I see from our two setups is that you directly import conf in the configuration.nix and I do this :
# modules/default.nix
{ lib, config, options, pkgs, ... }:
with lib;
let
# Recursively constructs an attrset of a given folder, recursing on directories, value of attrs is the filetype
getDir = dir:
mapAttrs
(file: type: if type == "directory" then getDir "${dir}/${file}" else type)
(builtins.readDir dir);
# Collects all files of a directory as a list of strings of paths
files = dir:
collect isString
(mapAttrsRecursive (path: type: concatStringsSep "/" path) (getDir dir));
# Filters out directories that don't end with .nix or are this file, also makes the strings absolute
validFiles = dir:
map (file: ./. + "/${file}")
(filter (file: hasSuffix ".nix" file && file != "default.nix") (files dir));
in
{
imports = validFiles ./.;
# Sending the locations of the configuration files for the options here
options.perso.dotfiles = mkOption {
type = types.path;
default = ../dotfiles;
description = "Location of the configuration files.";
};
}
It is but why would nix point to the file for Firefox and when I remove that file and replace it by the content in-line it works ? I want to understand that phenomenon.