Hello, I’m brand-new to Nix and NixOS. I like the concept, like the language, but hate the (some of the) syntax and the lack of documentation.
I am trying to split my config up into different modules in preparation for the future. One of the changes I’ve made is the use of Flakes.
The issue that I’m having now is that --flake
is complaining about my configuration being impure. Why wasn’t the regular command that used configuration.nix
directly flagging me down with similar complaints?
If I remove the following:
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowBroken = true;
From configuration.nix
, it complains about something else. But I need to get past this first.
error: cannot look up '<nixos-config>' in pure evaluation mode (use '--impure' to override)
at /nix/store/mrf1rcmvfwsgdcrcvgg06mfz12im6inf-source/nixos/modules/system/activation/top-level.nix:352:68:
351| config.system.copySystemConfiguration
352| ''ln -s '${import ../../../lib/from-env.nix "NIXOS_CONFIG" <nixos-config>}' \
| ^
353| "$out/configuration.nix"
(use '--show-trace' to show detailed location information)
I’ve run into some troubles learning how Nix works.
Specifically, the issue I’ve run into during the process is understanding what attributes are going to be passed to what functions, and what certain attribute values are expected to be, what keys they should have. For example, outputs.nixosConfigurations.<hostname>
contains whatever nixpkgs.lib.nixosSystem
decides to spit out. Can I please have a description of the attribute set that this will create? Maybe a description of the relationship between input and output? If it is available, I haven’t found a link for it, and I’ve scoured the website and wiki for documentation like this. Does it exist?