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/
rajivr has quit [Quit: Connection closed for inactivity]
<Profpatsch> puck: how are you so cursed
rajivr has joined #nix-lang
ddellacosta has quit [Ping timeout: 246 seconds]
kalbasit_ has quit [Ping timeout: 240 seconds]
cfinch has joined #nix-lang
<puck> Profpatsch: built in fuzzer
<puck> it's how i am so soft
<puck> and also good at finding weird edge cases
cfinch has quit [Read error: Connection reset by peer]
cfinch has joined #nix-lang
qyliss has quit [Quit: bye]
<infinisil> Hah nice
qyliss has joined #nix-lang
<Profpatsch> fuzzy llama funny llama llama in pyjama llama llama llama duck
__monty__ has joined #nix-lang
WilliButz has quit [Remote host closed the connection]
WilliButz has joined #nix-lang
cfinch has quit [Ping timeout: 256 seconds]
Dotz0cat has quit [Ping timeout: 264 seconds]
ddellacosta has joined #nix-lang
tilpner has joined #nix-lang
<Profpatsch> infinisil: What’s the best way to compare if two attrsets have the same keys?
<infinisil> Probably == on attrNames
<Profpatsch> infinisil: Ah, right, wrong question
<Profpatsch> I have one list of keys (not generated by attrNames) and an attrs
<Profpatsch> And I want to check if attrs has exactly these keys
<infinisil> Then I guess == between the list you have and the attrNames of the attrset :)
<Profpatsch> but I don’t know the sort order of attrNames
<Profpatsch> So I need to sort both first?
<infinisil> Ah attrNames is always sorted
<infinisil> (so if your list comes from somewhere other than attrNames you need to sort it first)
<Profpatsch> infinisil: is `builtins.sort lessThan` the same sorting?
<infinisil> Yea
<Profpatsch> oki, thx
<Profpatsch> mapIfAttrs = attrKeys: f: attrs:
<Profpatsch> # lib.attrNames is always sorted like (lib.sort lib.lessThan)
<Profpatsch> if (lib.sort lib.lessThan attrKeys) == (lib.attrNames attrs)
<Profpatsch> then f attrs
<Profpatsch> else attrs;
<Profpatsch> helpful for recursive mapping
<Profpatsch> lib.mapAttrsRecursive
<Profpatsch> (_path: attrs: mapIfAttrs [ "_configVariable" ] transformConfigVariable attrs)
ddellacosta has quit [Ping timeout: 256 seconds]
kalbasit has joined #nix-lang
<Profpatsch> I forgot again, is there a way to go from a "./foo.nix" string to an absolute path object?
<lukegb> like the (./. + "/" + "./foo.nix") magic
<lukegb> with more parens or something
<Profpatsch> lukegb: yeah, but holy hell
<Profpatsch> nix-repl> ./. + "/" + "./default.nix"
<Profpatsch> /home/philip/vuizvui./default.nix
<Profpatsch> nix-repl> ./. + ("/" + "./default.nix")
<Profpatsch> /home/philip/vuizvui/default.nix
<lukegb> yes :P
<infinisil> > /. + "/default.nix"
<{^_^}> /default.nix
<infinisil> > ./. + "/default.nix"
<{^_^}> /var/lib/nixbot/state/nixpkgs/default.nix
<infinisil> > ./. + "./default.nix"
<{^_^}> /var/lib/nixbot/state/nixpkgs./default.nix
<Profpatsch> > (x: x) ? foo
<{^_^}> false
<Profpatsch> trivially true!
<Profpatsch> But completely unhelpful
Dotz0cat has joined #nix-lang
rajivr has quit [Quit: Connection closed for inactivity]
<puck> > import (builtins.toFile "./default.nix")
<{^_^}> cannot coerce the partially applied built-in function 'toFile' to a string, at (string):460:1
<puck> > import (builtins.toFile "foo.nix" "./default.nix")
<{^_^}> cannot import '/nix/store/80pw7ps5py3bj1cl683pgcc5y9yar65b-foo.nix', since path '/nix/store/80pw7ps5py3bj1cl683pgcc5y9yar65b-foo.nix' is not valid, at (string):460:1
<puck> oh, huh, that doesn't quite work, lmao
<puck> (outputs /nix/store/default.nix)
ddellacosta has joined #nix-lang
ddellacosta has quit [Quit: WeeChat 2.8]
ddellacosta has joined #nix-lang
tilpner_ has joined #nix-lang
tilpner has quit [Remote host closed the connection]
tilpner_ is now known as tilpner
__monty__ has quit [Quit: leaving]
ddellacosta has quit [Ping timeout: 260 seconds]