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/
hmpffff has joined #nix-lang
hmpffff_ has quit [Ping timeout: 265 seconds]
evanjs- has quit [Quit: ZNC 1.7.5 - https://znc.in]
evanjs has joined #nix-lang
ddellacosta has quit [Ping timeout: 265 seconds]
andi- has quit [Ping timeout: 264 seconds]
andi- has joined #nix-lang
__monty__ has joined #nix-lang
hmpffff_ has joined #nix-lang
hmpffff has quit [Ping timeout: 272 seconds]
{`-`} has joined #nix-lang
hmpffff has joined #nix-lang
hmpffff_ has quit [Ping timeout: 264 seconds]
ddellacosta has joined #nix-lang
evanjs has quit [Quit: ZNC 1.7.5 - https://znc.in]
evanjs has joined #nix-lang
hmpffff has quit [Quit: nchrrrr…]
__monty__ has quit [Quit: leaving]
pie_[bnc] has joined #nix-lang
<pie_[bnc]> oh oops looks like i forgot to rejoin here
<infinisil> o/
<pie_[bnc]> anyway, consider: if nix didnt forget the damn default arguments, you could have half decent overridable let expressions with lib.makeOverridable ({ a ? 1, b ? 2}: whatever)
<pie_[bnc]> at least thats my hypothesis
<pie_[bnc]> i forgot about it and coded myself into a corner
<pie_[bnc]> i've got a lot of https://bpaste.net/J2DA and cant meaningfully override because old arguments are missing
<pie_[bnc]> hm wel actually i guess that just means i cant do appends
<pie_[bnc]> hm, well actually i guess that just means i cant do appends. but thats a good chunk of useful overrides gone nevertheless.
<MichaelRaskin> Wait. you care about simple defaults or about cross-dependent defaults?
<pie_[bnc]> both?
<pie_[bnc]> you mean like { a? 1 , b ? 2} vs { a ? 1 , b ? a}
<pie_[bnc]> ?
<MichaelRaskin> Yes
<pie_[bnc]> the problem is `f = lib.makeOverridable ({ a ? 1 }: a)` forgets `a` for f.override (old: { a = a.old + 1; })
<pie_[bnc]> * old.a
<pie_[bnc]> so it will complain about no attribute a for old
<pie_[bnc]> > let f = lib.makeOverridable ({ a ? 1 }: a); in f.override (old: { a = old.a + 1; })
<{^_^}> value is a function while a set was expected, at (string):296:48
<pie_[bnc]> > let f = lib.makeOverridable ({ a ? 1 }: a); in (f {}).override (old: { a = old.a + 1; })
<{^_^}> value is an integer while a set was expected, at (string):296:48
<MichaelRaskin> And basically for such a construction you need both halves — argument set with overrides _and_ argument set without overrides
<MichaelRaskin> (To allow cross-dependencies of defaults to rerun)
<pie_[bnc]> i cant figure out how to use my own functions lol
<pie_[bnc]> hold on
<pie_[bnc]> MichaelRaskin: im not sure what you mena
<pie_[bnc]> mean
<pie_[bnc]> > let f = lib.makeOverridable ({ a ? 1 }: { inherit a; }); in (f {}).override (old: { a = old.a + 1; })
<{^_^}> { a = <CODE>; override = <CODE>; overrideDerivation = <CODE>; }
<pie_[bnc]> > builtins.traceValSeqN 2 (let f = lib.makeOverridable ({ a ? 1 }: { inherit a; }); in (f {}).override (old: { a = old.a + 1; }))
<{^_^}> attribute 'traceValSeqN' missing, at (string):296:1
<pie_[bnc]> > lib.traceValSeqN 2 (let f = lib.makeOverridable ({ a ? 1 }: { inherit a; }); in (f {}).override (old: { a = old.a + 1; }))
<{^_^}> attribute 'a' missing, at (string):296:109
<pie_[bnc]> there we go
<MichaelRaskin> If I have {a ? 1, b ? a, c? b}: … and override b to be old.b+1, I need something like f (oldBrief // { b = oldFull.b + 1; })
<MichaelRaskin> Neither just the brief nor just the full is sufficient here
<pie_[bnc]> oh you mean if i want c to change after the override?
<MichaelRaskin> Yes
<pie_[bnc]> i think id be fine with having to manually update the other fields
<pie_[bnc]> as it is currently in other situations
<MichaelRaskin> Actually no
<MichaelRaskin> in self:super: pattern the overrides propagate
<pie_[bnc]> yeah but im not using fixpoints here
<MichaelRaskin> True, but you might be in search of the cheapest construct to replicate the good without replicating the expensive
<pie_[bnc]> here's the WIP corner i coded myself into https://bpaste.net/D6KQ
<pie_[bnc]> line 132 doesnt work
<pie_[bnc]> sorry, line 133
<pie_[bnc]> initialCommand = old.initialCommand.override (old: old // { inherit headers; });
<pie_[bnc]> theres no initialCommand
<pie_[bnc]> anyway I'd be quite happy if the default attrs wouldnt just disappear
<pie_[bnc]> i really like being able to override stuff and imo that kind of sucks in nix right now
<pie_[bnc]> man i really dont want to rewrite this, ive grown attached to it