infinisil changed the topic of #nix-lang to: Channel for discussing Nix as a language - https://nixos.org/nix/manual/#chap-writing-nix-expressions - Logs: https://logs.nix.samueldr.com/nix-lang/
colemickens has quit [Remote host closed the connection]
colemickens has joined #nix-lang
ekleog has quit [Quit: WeeChat 2.4]
ekleog has joined #nix-lang
<ekleog> … anyone understands what `builtins.tryEval darwin.apple_sdk.frameworks.AVFoundation` does? o.O
<ekleog> (on linux)
<ekleog> Like, it looks like it's correctly returning a derivation, but said derivation has as a store path `«error: [...]` (without closing » or so it seems)
<infinisil> > builtins.tryEval darwin.apple_sdk.frameworks.AVFoundation
<{^_^}> { success = true; value = { __ignoreNulls = true; all = <CODE>; args = <CODE>; buildInputs = <CODE>; builder = <CODE>; configureFlags = <CODE>; depsBuildBuild = <CODE>; depsBuildBuildPropagated = <COD...
<infinisil> > builtins.tryEval darwin.apple_sdk.frameworks.AVFoundation.drvPath
<{^_^}> { success = true; value = "/nix/store/9yfd7ysiwi2cf4xjaynskc3b8qh0jmjq-apple-framework-AVFoundation.drv"; }
<ekleog> looks like {^_^} is running on darwin
<infinisil> > builtins.currentSystem
<{^_^}> "x86_64-linux"
<ekleog> wat
<infinisil> Hmm..
<ekleog> does the weird behavior reproduce locally with your computer?
<infinisil> Well with nix-instantiate --eval I just get an error that it's not supported on x86_64-linux
<infinisil> > darwin.apple_sdk.frameworks.AVFoundation
<{^_^}> "<derivation /nix/store/9yfd7ysiwi2cf4xjaynskc3b8qh0jmjq-apple-framework-AVFoundation.drv>"
<infinisil> > :p darwin.apple_sdk.frameworks.AVFoundation
<{^_^}> "<derivation /nix/store/9yfd7ysiwi2cf4xjaynskc3b8qh0jmjq-apple-framework-AVFoundation.drv>"
<infinisil> Ahh
<infinisil> > :v pkgs
<{^_^}> pkgs = import <nixpkgs> { config = { allowUnfree = true; allowUnsupportedSystem = true; allowBroken = true; }; }
<infinisil> The pkgs here sets allowUnsupportedSystem = true
<ekleog> oh makes sense
<infinisil> I guess nix repl is a bit finnicky with errors
<ekleog> full log is http://ekleog.xelpaste.net/m8xwW3/raw here
<ekleog> my initial issue being that I have a `(builtins.tryEval old.${i}).success && toString old.${i}` failing with `old.${i}` being `darwin.apple_sdk.frameworks.AVFoundation` and I'm trying to understand how/why
<infinisil> Ah, it's lazy
<infinisil> It prints as much as it can until it gets to the part where it needs to evaluate the derivation
<infinisil> And it only needs to evaluate it when it tries to get drvPath
<infinisil> And that's just after «derivation
<ekleog> but it shouldn't be properly closing the set, then?
<infinisil> Doesn't it?
<infinisil> There's `»; }` at the end
<ekleog> well yes it does properly close the set, which is what I'm finding weird given it mis-parenthesizes the «»
<infinisil> Oh, the additional « before error?
<infinisil> That is a bit weird
<ekleog> so now yeah
<ekleog> -so now
<ekleog> looks like making it `builtins.tryEval (builtins.deepSeq a a)` instead of `builtins.tryEval a` does what I expected `tryEval` to do
<infinisil> Ah, that builtins.tryEval isn't catching the error
<infinisil> That's weird, I blame nix repl
<ekleog> I'm not at all sure whether it's a bug in tryEval or in my understanding of it, then, so…
<ekleog> no, same thing happens in nix-build
<ekleog> (with the old.${i} example quoted above)
<infinisil> I see
<infinisil> I guess tryEval only evals to whnf
<infinisil> And for some reason that doesn't include the drvPath
<infinisil> Hm..
freeman42[NixOS] has joined #nix-lang
<infinisil> ekleog: Ah, I think I got it, if you look at the implementation of mkDerivation (in pkgs/stdenv/generic/make-derivation.nix)
<infinisil> It uses lib.extendDerivation validity.handled, where validity.handled does the meta checks
<infinisil> And if you look at the implementation of extendDerivation in lib/customisation.nix, it only evaluates that argument when drvPath/outPath is evaluated
<ekleog> that kind of makes sense, but… why isn't drvPath evaluated by tryEval?
<infinisil> ekleog: Because tryEval only tries to eval whnf
<infinisil> > builtins.tryEval { value = throw "hello"; }
<{^_^}> { success = true; value = { value = <CODE>; }; }
<infinisil> In case of attributes, whnf is just the attribute names
<infinisil> In case of a list, whnf is just the list length
<infinisil> > builtins.tryEval [ (throw "") ]
<{^_^}> { success = true; value = [ <CODE> ]; }
<ekleog> makes sense I guess, though it's not what I'd have expected reading its doc
<infinisil> Hmm yeah that manual entry should be expanded with this
* ekleog writes down on todo-list to do that, if someone sees gets motivation before I get there some years from now, please ping me :)
hmpffff has joined #nix-lang
freeman[NixOS] has joined #nix-lang
freeman42[NixOS] has quit [Ping timeout: 246 seconds]
<infinisil> ekleog: I'm in the docs right now, how about changing "Try to evaluate e." to "Try to shallowly evaluate e"?
<infinisil> I could mentioned whnf, but it's not mentioned anywhere else in the whole nix source, so maybe rather not
<infinisil> Maybe an example would help more
<ekleog> “shallowly” makes sense to me, though an example would likely be even better, something like `builtins.tryEval (throw "a")` and `builtins.tryEval { a = throw "a"; }` I guess
<ekleog> (time to go for me, 'night)
hmpffff has quit [Quit: nchrrrr…]
freeman[NixOS] has quit [Remote host closed the connection]
freeman42[NixOS] has joined #nix-lang
freeman42[NixOS] has quit [Remote host closed the connection]
freeman42[NixOS] has joined #nix-lang
hmpffff has joined #nix-lang
hmpffff has quit [Quit: nchrrrr…]
vyorkin has joined #nix-lang
__monty__ has joined #nix-lang
freeman[NixOS] has joined #nix-lang
freeman42[NixOS] has quit [Ping timeout: 264 seconds]
noonien has joined #nix-lang
hmpffff has joined #nix-lang
freeman[NixOS] has quit [Ping timeout: 245 seconds]
freeman42[NixOS] has joined #nix-lang
hmpffff has quit [Quit: nchrrrr…]
hmpffff has joined #nix-lang
Synthetica has joined #nix-lang
jtojnar has quit [Quit: jtojnar]
jtojnar has joined #nix-lang
freeman42[NixOS] has quit [Remote host closed the connection]
freeman42[NixOS] has joined #nix-lang
freeman42[NixOS] has quit [Ping timeout: 245 seconds]
jtojnar has quit [Quit: jtojnar]
jtojnar has joined #nix-lang
freeman42[NixOS] has joined #nix-lang
freeman42[NixOS] has quit [Ping timeout: 245 seconds]
hmpffff has quit [Quit: nchrrrr…]
hmpffff has joined #nix-lang
hmpffff has quit [Quit: nchrrrr…]
evanjs has quit [Quit: Configuring ZNC, sorry for the joins/quits!]
evanjs has joined #nix-lang
Synthetica has quit [Quit: Connection closed for inactivity]
evanjs| has joined #nix-lang
evanjs| has quit [Quit: Configuring ZNC, sorry for the joins/quits!]
evanjs| has joined #nix-lang
vyorkin has quit [Ping timeout: 258 seconds]
evanjs| has quit [Quit: ZNC 1.7.4 - https://znc.in]
evanjs| has joined #nix-lang
evanjs| has quit [Client Quit]
evanjs| has joined #nix-lang
vyorkin has joined #nix-lang
vyorkin has quit [Client Quit]
hmpffff has joined #nix-lang
vyorkin` has joined #nix-lang
hmpffff has quit [Quit: nchrrrr…]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
hmpffff has joined #nix-lang
hmpffff has quit [Client Quit]
freeman42[NixOS] has joined #nix-lang
evanjs| has quit [Ping timeout: 258 seconds]
jtojnar has quit [Ping timeout: 245 seconds]
vyorkin`` has joined #nix-lang
vyorkin` has quit [Ping timeout: 246 seconds]
jtojnar has joined #nix-lang
evanjs| has joined #nix-lang
pie_ has joined #nix-lang
evanjs| has quit [Ping timeout: 244 seconds]
evanjs- has quit [Quit: Configuring ZNC, sorry for the joins/quits!]
evanjs- has joined #nix-lang
__monty__ has quit [Quit: leaving]
vyorkin`` has quit [Ping timeout: 245 seconds]
freeman[NixOS] has joined #nix-lang
freeman42[NixOS] has quit [Ping timeout: 245 seconds]
jtojnar has quit [Quit: jtojnar]
jtojnar_ has joined #nix-lang
evanjs| has joined #nix-lang