stdenv: throw from ghcjs.cc.outputs rather than ghcjs.cc#208993
Conversation
|
This might still be a good idea, but note both of you that I made a |
Yeah, I used that in an earlier revision of this PR, but it really uglifies the caller because (for some reason I didn't track down) And of course, callers have to remember to do that. Which I'm sure they won't, unless they are using ghcjs. So I went looking for a more automatic way to accomplish the goal and came up with this. |
|
@ofborg eval The Darwin builders appear to be stuck. |
`pkgsCross.ghcjs.stdenv.cc` currently `throw`s, and it is (a good) part of the Nix semantics that exceptions transmit no information to an enclosing `tryEval`. This makes it impossible to express the fact that the answer to "is the C compiler from GNU?" should be `false` when no compiler exists. The reason why `pkgsCross.ghcjs.stdenv.cc` is a `throw` is explained here: https://github.com/NixOS/nixpkgs/blob/aa371581dd110352b217e214867dd2a83660fa3c/pkgs/stdenv/cross/default.nix#L67 which refers to this check in `splice.nix`: https://github.com/NixOS/nixpkgs/blob/aa371581dd110352b217e214867dd2a83660fa3c/pkgs/top-level/splice.nix#L59 Since the result of that check is always passed to `getOutputs`, which is strict in its argument's `outputs` attribtue, we can simply move the `throw` deeper into the `stdenv.cc` attrset. This leaves room to provide a useful value for attributes like `isGNU` and `isClang` when the compiler is "none". Hopefully this removes the need for the change in b6ac11d8a69ad2a04bbbdbaa287da8ba5f7596d8 from #208947.
Description of changes
pkgsCross.ghcjs.stdenv.cccurrentlythrows, and it is (a good) part of the Nix semantics that exceptions transmit no information to an enclosingtryEval. This makes it impossible to express the fact that the answer to "is the C compiler from GNU?" should befalsewhen no compiler exists.The reason why
pkgsCross.ghcjs.stdenv.ccis athrowis explained here:nixpkgs/pkgs/stdenv/cross/default.nix
Lines 66 to 71 in aa37158
which refers to this check in
splice.nix:nixpkgs/pkgs/top-level/splice.nix
Lines 58 to 63 in aa37158
Since the result of that check is always passed to
getOutputs, which is strict in its argument'soutputsattribute, we can simply move thethrowdeeper into thestdenv.ccattrset. This leaves room to provide a useful value for attributes likeisGNUandisClangwhen the compiler is "none".Hopefully this removes the need for 1ee0f4c from #208947.
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes