# output.nix
{ pkgs, config, lib, name ? "default-output", ... }:
with lib;
{
options = {
name = mkOption {
default = name;
type = types.str;
description = "Name of the output.";
};
script = mkOption {
default = null;
type = types.nullOr types.str;
#type = types.nullOr (types.either types.str types.path);
description = ''
Text of a script which will produce a JSON value.
<warning>Warning: This uses shell features and is potentially dangerous.</warning>
Environment variables:
<envar>$out</envar> is a temp directory available for use.
'';
};
executable = mkOption {
type = types.path;
description = "Generated executable that runs the script.";
};
value = mkOption {
default = null;
type = types.nullOr types.str;
description = "Result of running script.";
};
};
config = {
_type = "output";
executable = pkgs.writeScriptBin "nixops-${config.name}"
''
#!${pkgs.stdenv.shell}
${config.script}
'';
};
}
nix-instantiate --eval-only --strict --xml nix/mod.nix 1>/dev/null
trace: WARNING: `stdenv.isArm` is deprecated after 18.03. Please use `stdenv.isAarch32` instead
trace: lib.zip is deprecated, use lib.zipAttrsWith instead
trace: Warning: `showVal` is deprecated and will be removed in the next release, please use `traceSeqN`
trace: `mkStrict' is obsolete; use `mkOverride 0' instead.
trace: `lib.nixpkgsVersion` is deprecated, use `lib.version` instead!
error: stack overflow (possible infinite recursion)
I've hit this in https://github.com/NixOS/nixops/pull/1048. It's reproducible with the following steps:
Running nix-instantiate with --xml produces
While with --json: