The --raw flag for nix eval is described as changing whether printed strings are quoted or not, but in practice seems to also control whether deep evaluation is used (like the --strict flag for nix-instantiate).
This means that expressions that cannot be strictly evaluated (see guitarix example below) must also be printed with --raw. This is problematic when raw output is unsuitable (for example, evaluating a set of derivations).
Proposed Solution: Strictness controlled by flag?
If nothing else this is unexpected and perhaps should be controlled using a new --strict flag instead?
Recommend having control-C ready before running this one:
$ nix eval -f channel:nixos-17.09 hello
trace: lib.zip is deprecated, use lib.zipAttrsWith instead
trace: `mkStrict' is obsolete; use `mkOverride 0' instead.
trace: `types.list' is deprecated; use `types.listOf' instead
trace: types.optionSet is deprecated; use types.submodule instead
{ __ignoreNulls = true; all = [ { __ignoreNulls = true; all = <CYCLE>; (truncated)
'Guitarix' Example
This is just an example of how this difference can be problematic in practice:
$ nix eval -f channel:nixos-17.09 guitarix
trace: lib.zip is deprecated, use lib.zipAttrsWith instead
trace: `mkStrict' is obsolete; use `mkOverride 0' instead.
trace: `types.list' is deprecated; use `types.listOf' instead
trace: types.optionSet is deprecated; use types.submodule instead
error: Package ‘python2.7-dosage-2016.03.17’ in /nix/store/9vzyf1g2yaa0yc9iglq58byfnyijdfp7-nixexprs.tar.xz/pkgs/top-level/python-packages.nix:1753 is marked as broken, refusing to evaluate.
a) For `nixos-rebuild` you can set
{ nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.
b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowBroken = true; }
to ~/.config/nixpkgs/config.nix.
(use '--show-trace' to show detailed location information)
Summary
The
--raw
flag fornix eval
is described as changing whether printed strings are quoted or not, but in practice seems to also control whether deep evaluation is used (like the--strict
flag fornix-instantiate
).This means that expressions that cannot be strictly evaluated (see
guitarix
example below) must also be printed with --raw. This is problematic when raw output is unsuitable (for example, evaluating a set of derivations).Proposed Solution: Strictness controlled by flag?
If nothing else this is unexpected and perhaps should be controlled using a new
--strict
flag instead?'Hello' Example
Raw
Normal
Recommend having control-C ready before running this one:
'Guitarix' Example
This is just an example of how this difference can be problematic in practice:
Raw
Normal