gchristensen changed the topic of #nixos-chat to: NixOS but much less topical || https://logs.nix.samueldr.com/nixos-chat
nckx has quit [Ping timeout: 240 seconds]
nckx has joined #nixos-chat
jtojnar has quit [Quit: jtojnar]
jtojnar has joined #nixos-chat
lassulus_ has joined #nixos-chat
jtojnar has quit [Read error: Connection reset by peer]
lassulus has quit [Ping timeout: 272 seconds]
lassulus_ is now known as lassulus
jtojnar has joined #nixos-chat
Myrl-saki has joined #nixos-chat
{^_^} has quit [Ping timeout: 260 seconds]
{^_^} has joined #nixos-chat
vdemeester has quit [Ping timeout: 260 seconds]
benkolera has quit [Ping timeout: 260 seconds]
vdemeester has joined #nixos-chat
benkolera has joined #nixos-chat
simpson has quit [Ping timeout: 260 seconds]
sir_guy_carleton has joined #nixos-chat
simpson has joined #nixos-chat
drakonis_ has joined #nixos-chat
sir_guy_carleton has quit [Quit: WeeChat 2.0]
drakonis_ has quit [Remote host closed the connection]
<infinisil> Phew, I am pretty close to having a draft finished
<infinisil> It goes very in depth
<samueldr> :)
<etu> To nixcon or not to nixcon. My employer just planned some team event the same day as nixcon starts. I'm not a big fan of team-events so that gives a plus point to nixcon.
<etu> I need to look at travels and hotels.
<etu> I mean, going to nixcon is a solid excuse to not attend the team-event
__Sander__ has joined #nixos-chat
__monty__ has joined #nixos-chat
<andi-> Also you probably planned that months ahead ;)
<clever> to start with, a set is a `struct Value`, that has the `Binding*` set
<clever> and that is the address of a Binding (line 33) which is immediately followed by an array of Attr's (line 15)
<clever> and the "zero" length array on line 40 allows you to access that
jasongrossman has joined #nixos-chat
<clever> and each Attr contains a key, Value*, and Pos*
<clever> infinisil: so when you do `let foo = { ... }; in { a = foo; b = foo; }`
<clever> the a and b are just pointers to the original Value for foo
<clever> infinisil: but after running __path over things, it has to create a new Bindings and Attr array, for a&b, with a unique __path, and repeat down the entire tree
<clever> infinisil: i'm thinking there should be a top-level arg to nixpkgs, that enables or disables this
<infinisil> I might do some measurements how much slower it really is
<clever> infinisil: https://github.com/NixOS/nix/pull/2392 as well
<{^_^}> nix#2392 (by cleverca22, 3 days ago, open): Improve stats
<infinisil> Because it should really only increase memory usage for such duplicate attribute values, which don't appear very often, aliases being the most prominent one
<clever> infinisil: in the case of `pkgs.pkgs.pkgs.pkgs.hello`
<clever> for each step down, it has to copy the entire Attr array on the Bindings
<infinisil> Oh hum
<clever> > builtins.length (builtins.attrNames pkgs)
<{^_^}> 9342
<clever> so thats a 9342 element array
<infinisil> Okay, but still, who calls pkgs.pkgs.pkgs.pkgs :P
<clever> size of an attr: 24
<infinisil> (it does happen sometimes in nixpkgs out of necessity)
<clever> which comes out to 224,208 bytes
<infinisil> clever: Question regarding setFunctionArgs
<infinisil> Why __functor = self: f?
<infinisil> What's the self for?
<clever> where does setFunctionArgs occur?
<infinisil> ,find lib/trivial.nix
<clever> ah, *reads*
<clever> my first guess, is that when you run a __functor via a set, nix passes the set as an arg
<clever> > let foo = { __functor = self: self // { a=5; }; } in foo { b = 3; }
<{^_^}> error: syntax error, unexpected IN, expecting ';', at (string):179:51
<clever> > let foo = { __functor = self: self // { a=5; }; }; in foo { b = 3; }
<{^_^}> error: stack overflow (possible infinite recursion)
<clever> let me just go to the source
<clever> , sFunctor(symbols.create("__functor"))
<infinisil> > let foo = { __functor == a: b: b; }; in foo 1
<{^_^}> error: syntax error, unexpected EQ, expecting '.' or '=', at (string):179:23
<infinisil> > let foo = { __functor = a: b: b; }; in foo 1
<{^_^}> 1
<clever> infinisil: very very early on in the startup of nix, that name is turned into a symbol, and its ID is stored in sFunctor
<clever> oh right
<clever> duh
<clever> > let foo = { __functor = self: value: self // { a=value; }; b=3; }; in foo 3
<{^_^}> { __functor = <LAMBDA>; a = 3; b = 3; }
<clever> the set that contains __functor, is passed as the 1st arg
<infinisil> Ah yeah I see it too in the source now
<clever> but if your trying to mutate a normal function, into a set containing its args and the func, it doesnt expect that
<infinisil> > foo = { __functor = self: value: self; }
<{^_^}> foo defined
<infinisil> > foo
<{^_^}> { __functor = <CODE>; }
<infinisil> > foo = { __functor = self: value: self; bar = 2; }
<{^_^}> foo defined
<infinisil> > foo
<{^_^}> { __functor = <CODE>; bar = 2; }
<infinisil> > foo 2
<{^_^}> { __functor = <LAMBDA>; bar = 2; }
<clever> infinisil: its also been fun reading other parts of eval.cc, for example, https://github.com/NixOS/nix/blob/bc65e02d9671ef6af2c25b4cc7a0a34944d98a2d/src/libexpr/eval.cc#L1330-L1356
<clever> > builtins.concatLists [] [ 1 2 3 ] []
<{^_^}> attempt to call something which is not a function but a list, at (string):179:1
<clever> > builtins.concatLists [ [] [ 1 2 3 ] [] ]
<{^_^}> [ 1 2 3 ]
<clever> infinisil: if the sum of the lenghts of the lists (0+3+0) matches the length of the last non-empty list (3), then just return the last non-empty list, and dont even concat
<infinisil> Heh nice, makes sense
<infinisil> I also recently learned from the nix source that lists are really arrays and tail is O(n) :/
<infinisil> elemAt is efficient
<clever> infinisil: there are also 3 types of arrays
<infinisil> I only knew about 2
<infinisil> The third being an empty array maybe?
<clever> list1, list2, and listn
<clever> for list1, only smallList[0] is used, and there is no length field
<clever> for list2, smallList[0] and smallList[1] are the values, no length field
<clever> for listn, biglist.size and biglist.elems are used
<clever> so lists of size 1 or 2, save a pointer redirection
<clever> slightly smaller memory usage as well
<clever> size of a value: 24
<clever> > (64/8) * 3
<{^_^}> value is a path while an integer was expected, at (string):179:1
<clever> every single Value object in nix, is a set of 3 64bit fields
<clever> > (64 / 8) * 3
<{^_^}> 24
<clever> the first is the ValueType enum (which could be 1 byte, but eh)
<clever> the last 16 bytes is a union of many things, none of which may exceed 16 bytes
<infinisil> Neato
<clever> so whenever nix is dealing with an int, bool, or float, the raw value is directly in the Value object, and there is no extra storage cost
<clever> for strings, the Value contains a pointer to the c-string, and a pointer to the list of context
<clever> for paths, its just a c-string pointer, and nothing else
<clever> for sets, it has a pointer to a Binding, which is followed by an array of Attr's, so the size depends on how many attrs it contains
<clever> and the keys must all be known when creating the Binding+Attr[], so recursion can be an issue
<clever> mkIf within modules helps there
<clever> and the rest are also just pointers to other things of varying sizes
aszlig has quit [Ping timeout: 272 seconds]
aszlig has joined #nixos-chat
sir_guy_carleton has joined #nixos-chat
jasongrossman has quit [Ping timeout: 272 seconds]
<gchristensen> I made a quick cheat-sheet for how to do common stuff with docbook: https://docbook.rocks/ check it out! is it helpful? am I showing too much? am I missing something obvious? and please send me feedback :)
<__monty__> Why would I use docbook over say, reST?
<sir_guy_carleton> agreed; it doesn't really explain what docbook is really good for, only that markdown has some limitations
<joepie91> I can answer that one: rst has a horrendous amount of syntax that looks *nothing* like anything else
<joepie91> it's a very... inaccessible format
<joepie91> I'm not especially happy with docbook either but at least you can infer structure there without knowing all the details of the format
jD91mZM2 has joined #nixos-chat
<samueldr> being XML is both convenient an inconvenient: good XML tooling, especially since docbook leans on doctypes and such; but writing XML by hand will always be... inconvenient; imho having XML there is good, even if UX-wise it's a chore
<gchristensen> _why_ docbook is out of scope at the moment.
<gchristensen> the scope for now is "ok, I'm going to use docbook, now what"
<gchristensen> or rather, "I need to add a bit of docs to a project which uses docbook, now what"
<maurer> gchristensen: Now what -> go write a markdown file, a wiki article, or a blog post, and wait for one of the docbook nerds to translate it </s>
<gchristensen> if you want, sure!
__Sander__ has quit [Quit: Konversation terminated!]
<gchristensen> but nobody should be afraid of docbook
<maurer> I think it's less that they are afraid, and more that there are a bajillion tags, and that typing tags makes you want to kys
<maurer> because they are so verbose
<maurer> It's like writing a LaTeX document, except that every project has its own dialect
<gchristensen> yes! there are a billion tags! here are the 10 you'll need
<maurer> so even if you learn to write foo-project docbook, you'll find that another project uses a different set of tags, so some are missing, and there are some new ones you need to use
<gchristensen> there is no "dialect"
<gchristensen> you can know these 10 tags and make a meaningful contribution to any docbook based document.
<gchristensen> are there more? obviously, do you strictly need to know them? no
<jD91mZM2> XML for markup? What is this madness?
<gchristensen> can you achieve more semantic precision by using more tags? yes, it is why they're there. do some projecs choose to use them? yes, but whatever -- these 10 tags will get you all the way to a PR where a reviewer can help take it the rest of the way.
<gchristensen> jD91mZM2: if only there were some form of markup language which could be used to richly describe plain text, and be extended for different use cases ~(˘▾˘~)
<maurer> gchristensen: It's not that XML is the wrong way to represent this data - it is the right way. However, people _already_ don't want to write documentation, and they _also_ don't want to write XML
<gchristensen> sure!
<jD91mZM2> gchristensen: Talking about markdown? >:)
<gchristensen> each project can handle people who want to contribute docs but don't want to write XML differently. We have a generous offer on the table for them, for someone else to convert it.
<samueldr> markdown isn't much better than <b></b> and friends, especially with regards to how there is no "one markdown" :(
<gchristensen> that is fine. but also, for people who are open to learning new things, here we go -- a nice easy to use resource, getting you started quickly on useful structure and syntax!
<samueldr> well, there *is* one, the original one
<gchristensen> samueldr: the one for writing prose targeting an HTML document? :)
<samueldr> the one replacing <b></b> and friends :)
<jD91mZM2> Maybe, but *personally* I think it's more natural, **although** that might just be me :\^)
<gchristensen> sure! it is!
<samueldr> two different goals I think, one is to make the document *look* a way, the other is to make the document *mean* something
<jD91mZM2> ¯\\\_(ツ)\_/¯
<gchristensen> but also, DocBook isn't so bad for people to say they'll just never do it.
<maurer> Isn't it? That's usually what I see people say in #nixos whenever docbook is mentioned
<maurer> but I might have a biased memory here
<gchristensen> DocBook isn't so bad for people to _justifiably_ say they'll just never do it.
<gchristensen> if you hate docbook already, sure, docbook.rocks isn't for you. docbook.rocks is for people who are open minded and willing to learn something new
<jD91mZM2> I mean it's a little annoying having to escape all the XML syntax &amp; stuff IMO
<gchristensen> sure!
<samueldr> CDATA is usable too there AFAIK
<jD91mZM2> (Are you sarcastic btw? I'm having trouble telling)
<gchristensen> nope, it is a bit annoying
<jD91mZM2> Oh, ok. Didn't get the context of the conversation as I just logged on, so I didn't initially see if you're super positive or just a little positive towards XML
<gchristensen> out of the >30,000 lines of XML &amp &gt and &lt appear about 100 times
<gchristensen> ^ out of the 30,000 lines of nixos / nixpkgs docs that is
<gchristensen> so it is a bit annoying, but it isn't real common
<jD91mZM2> Hmmm perhaps. I feel like it's nicer with `\&` though, which is why markdown appeals to me (not that it has &)
<gchristensen> sure it is a bit nicer
<jD91mZM2> Not saying docbook is bad though, I don't even know what it is :P
<gchristensen> docbook can do nice things too, which are very hard for markdown
<jD91mZM2> oooooo like?
<gchristensen> I'm so glad you asked!
<gchristensen> give me 15 min :)
<jD91mZM2> inb4 gchristensen proves docbook is turing complete
<gchristensen> alas, "The notion of Turing-completeness does not apply to languages such as XML, HTML, JSON, YAML and S-expressions, because they are typically used to represent structured data, not describe computation."
<jD91mZM2> Yes but PowerPoint...
<jD91mZM2> To be fair, I'm sure you could make some kind of XML thing that uses custom tags to describe a program
<jD91mZM2> <set key="hi">hello</set>
<jD91mZM2> <if><equals key="hi" value="hello" /></if>
<gchristensen> oh well there is XSLT which is a purely functional programming language
<jD91mZM2> Beautiful
<joepie91> gchristensen: emphasis: "typically" :D
<joepie91> anyway, I'd be more interested in docbook if it were used as a semantic storage format for documentation, rather than as a format to manually author
<samueldr> joepie91: you could nerdsnipe yourself into that :)
<joepie91> sure, I'll put it in slot #5821 of my todo list :)
<{^_^}> https://github.com/NixOS/nixpkgs/pull/5821 (by eduarrrd, 3 years ago, merged): pshs: 0.2.5 -> 0.2.6
<samueldr> :D
<joepie91> should be done somewhere around...
<samueldr> 5820 to go
* joepie91 calculates
<joepie91> ... 2301?
<joepie91> march, probably
<samueldr> noted!
<joepie91> you'll get a full refund if I don't hit the deadline
<joepie91> :P
<samueldr> (and I was really joking around when saying you could do it)
<gchristensen> joepie91: you can get very nice XML editors where you don't write XML directly
<__monty__> I'm gonna stick to reST. But it's interesting.
<gchristensen> jD91mZM2: https://docbook.rocks/#prompt
<LnL> oh what, this package came from Japan, that's why the shipping was a bit weird
<gchristensen> LnL: what'd'ya get? :)
<samueldr> some weird thing if it was shipped weird :)
<LnL> weird as in I thought it it would come from germany but it was long slow and didn't have any tracking
<LnL> gchristensen: just a thermos
<jD91mZM2> gchristensen: Why not just write a prompt?
<gchristensen> hrm?
<jD91mZM2> Like why write `<prompt>$ </prompt>hello` over `$ hello`?
<jD91mZM2> Why does the prompt need to be tagged
<gchristensen> in this scenario your goal is to let people double click the text to copy what they need to run, without copying the prompt
<LnL> yeah, that's neat
<jD91mZM2> gchristensen: Ah, right
<gchristensen> if you want to get real detailed, you can produce something like this: https://screenshotscdn.firefoxusercontent.com/images/fbc18558-9ec9-4e2a-87a6-9579b5e6b52f.png
* etu won't make it to NixCon :(
<gchristensen> etu: !! :(
<rain1> hi :)
<LnL> work: so, pip install with -i https://pypi.example.org still isn't reproducible?
jD91mZM2 has quit [Quit: WeeChat 2.0]
<gchristensen> did you inform them? :)
<LnL> after food...
<LnL> simple answer is no, build time dependencies ignore that so this only works if your dependencies are all locked and in the magically correct order
<LnL> the magic ordering is the fun part
kisik21 has joined #nixos-chat
<clever> disasm: and poof goes slack!
kisik21 has quit [Ping timeout: 272 seconds]
sir_guy_carleton has quit [Quit: WeeChat 2.0]
tertl3 has joined #nixos-chat
lopsided98 has quit [Quit: Disconnected]
lopsided98 has joined #nixos-chat
lopsided98 has quit [Remote host closed the connection]
lopsided98 has joined #nixos-chat
<etu> gchristensen: I really wish I could. But I've should have planned it earlier. The cheapest way I could get there now would be around 800€. And sadly I can't motivate that enough.
jasongrossman has joined #nixos-chat
jasongrossman has quit [Remote host closed the connection]
__monty__ has quit [Quit: leaving]