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/
ddellacosta has joined #nix-lang
ddellacosta has quit [Ping timeout: 268 seconds]
ddellacosta has joined #nix-lang
ddellacosta has quit [Ping timeout: 268 seconds]
pie_ has quit [Ping timeout: 268 seconds]
hmpffff has joined #nix-lang
__monty__ has joined #nix-lang
sphalerite has quit [Ping timeout: 246 seconds]
sphalerite has joined #nix-lang
pie_ has joined #nix-lang
pie_ has quit [Ping timeout: 258 seconds]
pie_ has joined #nix-lang
hmpffff has quit [Quit: nchrrrr…]
ddellacosta has joined #nix-lang
ddellaco1 has joined #nix-lang
ddellacosta has quit [Ping timeout: 240 seconds]
pie_ has quit [Ping timeout: 268 seconds]
ddellacosta has joined #nix-lang
ddellaco1 has quit [Ping timeout: 240 seconds]
pie_ has joined #nix-lang
<evanjs> is there something like lib.optionals with an explicit false branch? Or should I just use e.g. `if x then y else z` ?
<pie_> is there some way to do this that will actually work? (this infrecs):
<pie_> config.systemd.services."container@retiolum.service".serviceConfig.postStart;
<pie_> config.systemd.services."container@retiolum.service".serviceConfig.preStart + "\n"+
<pie_> systemd.services."container@retiolum.service".serviceConfig.preStart =
<pie_> evanjs: i mean, if it doesnt exist and you really want it its pretty easy to implement
<pie_> so, basically id like some thing like what an imperative = would do in my case
evanjs has quit [Quit: ZNC 1.7.4 - https://znc.in]
evanjs has joined #nix-lang
hmpffff has joined #nix-lang
<infinisil> pie_: How about `preStart = mkAfter postStart`
<pie_> infinisil: ill try again in a second, i managed to make some dumb mistakes so i dont even know what was and wasnt broken anymore
<pie_> infinisil: prestart = mkafter (prestart + poststart) will work? i dont think it worked for me
<infinisil> No just `prestart = mkAfter postStart`
<pie_> infinisil: isnt that just an override
<infinisil> Multiple assignments get merged together
<pie_> oh. hm.
<pie_> riiiight.
<pie_> so for the sake of argument, what if you wanted to add something to the middle of the string
<infinisil> In the middle of what string?
<infinisil> The previous preStart? You can't
<pie_> ok
<pie_> :(
<pie_> that kinda sucks
<pie_> sure, most of the time you dont want that
<pie_> well, not that I intend to argue for it, I don't have the energy nor the rationale
<infinisil> pie_: I mean the module system is flexible, but you can't do everything you can imagine
<pie_> sure
<infinisil> It could be possible with a special type that supports that somehow
<infinisil> But creating an interface for it that's not horrible seems difficult
<infinisil> Or impossible even actually
<infinisil> Since "insert something inbetween the previous string" doesn't mean anything when there's no order of operations
<pie_> right, youd have to impose some kind of ordering
<pie_> which is not entirely alien to the module system given mkOverride takes an integer argument
<pie_> its just going to become very unwieldy very quickly
<pie_> by the way, let expressions suck for composability
<pie_> still
<infinisil> pie_: Imagine let's would be exposed in Haskell
<infinisil> That would be super weird and problematic
hmpffff has quit [Quit: nchrrrr…]
<pie_> in haskell you arent trying to overide stuff
<pie_> a bunch of things in nixpkgs should basically be libraries
<pie_> and they are
<pie_> but nothing is exposed
<pie_> because lets are opaque
<infinisil> They're just local variables
<infinisil> Which aren't exposed like in all other languages
<pie_> to be pedantic i mention python
<infinisil> And exposing let's doesn't make sense in a lot of contexts
<infinisil> > :p map (x: let y = x + 1; in y) [ 1 2 3 ]
<{^_^}> [ 2 3 4 ]
<pie_> well i stil think youre wrong but im going to use my excuseof being to tired again, to avoid trying too hard
<infinisil> Alright :)
<pie_> infinisil: i see no reason why i shouldnt have access to this function
<pie_> mumble mumble something something DSLs
<infinisil> I mean yes, some let's should be exposed
<infinisil> I'm not arguing against that. But Nix as a language can't default to exposing all of them
<pie_> i didnt say all lets should or must be exposed, but if you have a mechanism for exposing a sufficient number of lets such that it isnt massively unwieldy, exposing them all should be fine too
<pie_> if you expose some why not all
<pie_> oh
<infinisil> Well you can't expose them
<pie_> i didnt look at your example
<pie_> the problem is that its behind a function application right?
<infinisil> I guess, but that's not a problem
<pie_> anyway i dont know how to do this in a non-unwieldy way, and nested let contexts are probably inevitable, and also the only thing i came up with so far is the contexts would have to be assigned to a derivation after evaluation probably
<pie_> infinisil: oh, its not a problem?
<pie_> *in a non-unwieldy way (or at all)
<infinisil> I mean, let's aren't made to be exposed, they need to support things like being in functions and stuff
<infinisil> And "exposing them" wouldn't even be clearly defined
<pie_> a more tedious way to do this would be to dump a bunch of stuff in passthru
<infinisil> Yeah, I'd make a PR to nixpkgs to expose that however you want
<infinisil> Maybe put it in `container-lib.nix` next to `containers.nix`
<pie_> let letscope@ ( rec { ... }); in mkDerivation { passthru = {} // letscope }
<pie_> or whatever the syntax would be
<pie_> its ugly as hell of course
<infinisil> Why not just `let scope = rec { ... }; in`?
<pie_> works yeah that
<pie_> s/works//
samueldr has quit [*.net *.split]
samueldr has joined #nix-lang