File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -1324,8 +1324,10 @@ struct CmdFlakeShow : FlakeCommand, MixJSON
13241324 try {
13251325 if (visitor.isDerivation ())
13261326 showDerivation ();
1327- else
1328- throw Error (" expected a derivation" );
1327+ else {
1328+ auto name = visitor.getAttrPathStr (state->s .name );
1329+ logger->warn (fmt (" %s is not a derivation" , name));
1330+ }
13291331 } catch (IFDError & e) {
13301332 if (!json) {
13311333 logger->cout (
Original file line number Diff line number Diff line change 107107assert show_output.packages.${builtins.currentSystem}.default == { };
108108true
109109'
110+
111+
112+ # Test that nix keeps going even when packages.$SYSTEM contains not derivations
113+ cat > flake.nix << EOF
114+ {
115+ outputs = inputs: {
116+ packages.$system = {
117+ drv1 = import ./simple.nix;
118+ not-a-derivation = 42;
119+ drv2 = import ./simple.nix;
120+ };
121+ };
122+ }
123+ EOF
124+ nix flake show --json --all-systems > show-output.json
125+ # shellcheck disable=SC2016
126+ nix eval --impure --expr '
127+ let show_output = builtins.fromJSON (builtins.readFile ./show-output.json);
128+ in
129+ assert show_output.packages.${builtins.currentSystem}.not-a-derivation == {};
130+ true
131+ '
132+
You can’t perform that action at this time.
0 commit comments