<infinisil>
I recently mentioned that listOf could potentially be removed from NixOS
rnhmjoj has joined #nix-lang
<infinisil>
I recently mentioned that listOf could potentially be removed from NixOS (for rnhmjoj)
<infinisil>
Replacing `environment.systemPackages = with pkgs; [ foo bar baz ]` with `environment.systemPackages = { inherit (pkgs) foo bar baz; }`
<infinisil>
Which would also harmonize with a removal of `with`
<infinisil>
But `with lib;` is just really convenient, so I honestly don't see it going away without a replacement
<clever>
infinisil: i sometimes see `let inherit (lib) foo bar; in`
<infinisil>
Yeah, though you have to list everything you need
<infinisil>
I guess a sane `with` could be possible if there's only one `with` scope at a time
<infinisil>
E.g. `with { foo = 1; }; with { bar = 2; }; foo` would give "foo is undefined"
<infinisil>
Because only the latest `with` would apply
<gchristensen>
kinda spooky
<infinisil>
I guess it should be named differently, not `with`
<clever>
infinisil: i believe with functions via scope chains
<rnhmjoj>
infinisil: uhm, i can see the benefit of that but the removing loaOf, which was a relatively uncommon type, already required a massive effort. i can't imagine what listOf would be
<infinisil>
rnhmjoj: Hehe yeah, would be a big effort, but it would be cool if it could be pulled off, as I think many `listOf`s are just issues waiting to be filed
julm has joined #nix-lang
<rnhmjoj>
i don't think i've ever mixed multiple `with`s. what happens when you have clashing attribute names? i guess something bad
<clever>
rnhmjoj: i think the narrowest (last) one takes priority
<infinisil>
rnhmjoj: Many people do `with lib;` and then later `with types;`
<infinisil>
Also sometimes something like `with pkgs; with lib; with types;`
<rnhmjoj>
well, it doesn't look too bad to me. if the cost of evaluating `with pkgs` and other huge sets is not an issue then i don't think it warrant a deprecation/removal. the only real bad side is that it breaks static analysis
<jtojnar>
the main issue is it makes reasoning about scope harder
<jtojnar>
e.g. what is in scope, where does given value come from…
<jtojnar>
(so basically human static analysis)
<rnhmjoj>
so it's a mostly problem for humans?
<jtojnar>
yup
<infinisil>
I've frequently had this problem: In a NixOS module I try to use e.g. `options.networking.hostNames`, but then I get the error that "networking doesn't exist". I then realize that `options` was coming from `lib.options`, and not from the argument list at the top
<infinisil>
So then I add `options` to the argument list to fix it, which then overrides the one from `lib`
<rnhmjoj>
this could be somewhat solved by discouraging the import of large sets. or maybe `lib` could be organized in a hierarchy of submodules, like you'd do in haskell packages. maybe it already is, i'm not sure
ddellacosta has quit [Ping timeout: 256 seconds]
abathur has joined #nix-lang
evanjs has quit [Ping timeout: 240 seconds]
evanjs has joined #nix-lang
colemickens has quit [Quit: killed]
rnhmjoj has quit [Quit: killed]
kyren has quit [Quit: killed]
jtojnar has quit [Quit: killed]
bachp has quit [Quit: killed]
colemickens has joined #nix-lang
rnhmjoj has joined #nix-lang
kyren has joined #nix-lang
bachp has joined #nix-lang
jtojnar has joined #nix-lang
__monty__ has joined #nix-lang
__monty__ has quit [Quit: leaving]
kqb has joined #nix-lang
__monty__ has joined #nix-lang
ekleog has quit [Remote host closed the connection]
ekleog_ has joined #nix-lang
ddellacosta has joined #nix-lang
adisbladis has joined #nix-lang
edef has quit [Read error: Connection reset by peer]
edef has joined #nix-lang
hmpffff has joined #nix-lang
hmpffff_ has joined #nix-lang
hmpffff has quit [Ping timeout: 272 seconds]
kqb has quit [Ping timeout: 260 seconds]
nix-build has quit [Remote host closed the connection]