<arianvp>
Question. What is the semantic difference between the substituters and trusted-substituters option in nix.conf ?
<arianvp>
I see that --substituters _option_ sets the trusted-substituters config option. but why doesn't it set the "substituters" one
<arianvp>
why this split?
<gchristensen>
are not used by default, but can be enabled by users of the Nix daemon by specifying --option substituters urls on the command line. Unprivileged users are only allowed to pass a subset of the URLs listed in substituters and trusted-substituters.
<arianvp>
yes I just read that. it doesnt explain why substituters and trusted-substituters aren't combined into one option though right?
<gchristensen>
well you might have a binary cache you don't want to use by default, but you do want to allow users to opt in to it
<arianvp>
is it such that trusted-substituters "extends" whatever is in "substituters" because otherwise it would replace it and that's not what you want?
<gchristensen>
I'm having a hard time knowing how to explain it, because what is written makes perfect sense to me :P
<__monty__>
Fwiw, arianvp, I think you've got it right in your last message.
<gchristensen>
it doesn't extend it ... it adds a list of optional, trusted substituters
<infinisil>
Profpatsch: I think it would be better to call this something along the lines of "compose"
<infinisil>
Because it's really just function composition
<infinisil>
And I'd flip around the argument positions
<Profpatsch>
infinisil: No, it’s explicitely this way around
<Profpatsch>
That’s the base idea.
<Profpatsch>
Forward application, not backward
<Profpatsch>
You don’t write your pipes like this: grep "foo" | sed 's/bar/foo/' | echo "abc", do you?
<Profpatsch>
Especially since lists are left-to-right data structures.
<Profpatsch>
Eta-conversion usually does not help readability very much, and that would be the only reason why you’d want to have the data to the right.
<infinisil>
Profpatsch: It's harder to compose that way though
<infinisil>
`compose [ <f1> <f2> ]` is just another function
<jonringer>
maybe it's just my background with haskell, but I think it should be right associative as well
<Profpatsch>
infinisil: compose would be flipped around
jonringer has quit [Quit: Leaving.]
jonringer has joined #nixos-dev
<Profpatsch>
compose [ <f2> <f1> ] data
<Profpatsch>
jtojnar and worldofpeace were talking about F#’s |>.
<Profpatsch>
(or clojure’s (->) macro)
<infinisil>
Hmm..
<Profpatsch>
First rule of good API/language design: either left to right or right to left, don’t change direction.
<Profpatsch>
Maybe not the first rule, but pretty far up.
<infinisil>
I'm not sure, [ <f1> <f2> ] seems like the more natural direction for me. The first element of the list is used first, then the second
<infinisil>
Even with compose
<Profpatsch>
Then that’s another reason why compose shouldn’t exist.
<infinisil>
Hm though I guess we don't really have anything like that in nix already, so maybe the other direction would work too
<infinisil>
pipe x [ f1 ... fn ] = fn (... (f1 x))
<infinisil>
compose [ fn ... f1 ] x = fn (... (f1 x))
<infinisil>
I think the nix world would be more used to the latter
<infinisil>
Since we're always composing functions like fn (... (f1 x)) already
<Profpatsch>
I don’t think appeal to authority is a good way to argue, especially for some nebulous authority like “the nix world”
<Profpatsch>
:)
<infinisil>
That's not an authority..? I'm just saying most nix people would probably find the compose direction more natural
<Profpatsch>
The primary thing that pipe gives you is forward-readability of pipelines.
<Profpatsch>
infinisil: Okay, I’m saying it would be the other way around.
<Profpatsch>
Especially after working with pipe for some time.
<infinisil>
I have to say, the pipe way looks nicer
<infinisil>
But the compose way composes better and people are more used to it
<infinisil>
I guess we should have a vote on this :P
<Profpatsch>
compose doesn’t give us anything. Well, apart from unecessary overhead
<infinisil>
It gives the same thing as pipe, just in different order..?
<Profpatsch>
compose [ fn ... f1 ] is right-to-left and has the overhead of list allocation.
<Profpatsch>
while compose [ f1 ... fn ] might seem more natural, but it changes direction.
<infinisil>
Why would pipe not have that overhead?
<infinisil>
lists in nix are arrays, not linked lists
<Profpatsch>
pipe is the “natural” pipe, it still has the overhead but the direction is the right way around
<Profpatsch>
I’d also argue we should have either pipe or compose, because otherwise people can’t remember the order in which the functions should appear in the list.
<infinisil>
Probably, though we also have forEach and map
<Profpatsch>
Non-Haskell languages are already moving in the direction of “forward is better UX”, and even in Haskell, (#) is used more and more often.
<Profpatsch>
infinisil: forEach and map don’t fold
<infinisil>
Just as an example of flipped arguments
<Profpatsch>
The order of the list doesn’t matter
<Profpatsch>
Yes, but those cannot be confused.
<Profpatsch>
If the order of the list matters you have 4 possibilities, and as we have seen it’s quite arbitrary which one is chosen.
<Profpatsch>
So if one exists in trivial.nix, the other should not.
<kl3>
is offline documentation available for nix repl? no manual, and except for two examples in the html docs under nixos-help i could not find anything
<clever>
kl3: there is :?, and it accepts some basic things that all nix tools accept, like --arg, --argstr, and -I
<Profpatsch>
worldofpeace: Oh, I have more ideas :)
<Profpatsch>
e.g. document all builtins in the stdlib as well instead of only exporting them.
<kl3>
clever: i was looking for documentation, that is to say more than a usage text on `nix repl --help`
<clever>
kl3: no man page exists for the new `nix` command
drakonis has quit [Ping timeout: 240 seconds]
drakonis1 has quit [Ping timeout: 250 seconds]
drakonis has joined #nixos-dev
drakonis1 has joined #nixos-dev
<kl3>
another question: configuration.nix(5) says for fileSystems.<name?>.neededForBoot (Default: false) "By default, this applies to the root file system [..]", yet I see
<clever>
kl3: the real logic, is an `op` operation, against neededForBoot, or being present in this list
<clever>
`or` operation*
<worldofpeace>
infinisil: I don't think the bot is safe to parse my joy
<kl3>
clever: i see, so it's internally treated as neededForBoot=true unconditionally - makes sense, although it's confusing to still see the false there
<clever>
kl3: yeah
drakonis1 has quit [Quit: WeeChat 2.6]
justanotheruser has quit [Ping timeout: 264 seconds]
drakonis_ has joined #nixos-dev
drakonis1 has joined #nixos-dev
drakonis has quit [Ping timeout: 268 seconds]
drakonis has joined #nixos-dev
drakonis_ has quit [Ping timeout: 246 seconds]
jonringer has quit [Ping timeout: 240 seconds]
justanotheruser has joined #nixos-dev
drakonis1 has quit [Ping timeout: 246 seconds]
MichaelRaskin has joined #nixos-dev
ris has joined #nixos-dev
<gchristensen>
clever: can you poke disasm for me?