Good. Wonderful. Okay. So, this is even with a Y. Yeah? Snacker? Yeah, it's actually
pronounced like that. Okay, great. Even Snacker. And he's going to, like, I find, I find the
title of this talk really amazing. The title of this talk is tips and tricks to fix your
nicks, and it's like, so poetic. So, yeah, I was planning to say it one last time to it
for the chemical effect, but yeah. Sorry. No, I'm going to, I'm not going to say anything anymore.
I'm going to leave you the stage. A round of applause, please for Yvonne. And our last talk
for today, go ahead. Yeah. So, hello everyone. And welcome in tips and tricks to fix your nicks.
I say it. So, the truth is, I already gave that talk a couple of months ago in French,
in capital Dileb, in Toulouse, and it was totally semi-improvised. And this is a revised version
of it that was a bit shrink to fit the, the, the Devron schedule, because that's the last
talk of the day. And the motivation behind this talk is, I guess, as true for every technology,
there is stuff that are super obvious for people to use to, to the scene. We're talking
about nicks, that are super cryptic to the newcomers. And in nicks, if you copypaste some
snippet from the official wiki into your configuration, most of the time it works, it
is magic, it's super nice. But sometimes it breaks, and when it breaks, it's terrible. And
I feel that's one of the things where it's true with nicks, that's, there's things that
are obvious for some people that are not for those. So, maybe some of you will not learn
anything new, and maybe some of you will, and that's my hope. And in the end, there are a few links
because it's a bit too short to make a lot of demo. And it's not exhaustive. If you have more
idea, we can discuss, is it always track, or I would try at some point to make that into,
I know a wiki update, a blog post, something like that. Anyway, I'm involved. I urge first
about nicks, I guess, a decade ago, but I really start to use it, like daily driving it,
why it was the pandemic, the last one. Yeah, we were in first them, so that's the best
spot to catch the last cool versus. And anyway, no, nicks is paying my rent every month,
just nicks, so it's a super cool technology. And yeah, what we'll talk about today is
fitting to two different parts that are really the two parts that explain all nicks work,
which is first, you're evaluating a bunch of nicks code to producing the relation file,
and then you're done, you're actually realizing buildings of the derivation
fighting to actual binaries, crypto, whatever it puts. And there's two separated steps,
actually, really present in nicks, in frogs, like licks, in even gicks, all are the same with that.
And depending if your error is happening in the first or second stage of this process,
it's really different experience. So first, the obvious things, the beginning expression,
first part. Yeah, nicks is a really cool language, personally, I like the syntax,
I think it's pretty decent language, there's really weird color case, but it's not the point of
this talk. There is issue with nicks, first, a really dynamic core and language where you can
do a lot of things that will not be possible in more static language, indeed,
and it's functional. And functional language, I have a feature, which I personally find really
cool and that is by default for every function, that is there is partial application,
which means that if you forgot an argument to your function, it would work, it will just
raise a neural way later in your program, in your expression, which is actually bad,
because the stack trace will not show you the place where you made zero, actually, but somewhere
totally different. And six sets, a bit tricky is you to work with, I have, yeah, and so
that what they just say, the stack trace is often bad. My immediate advice for that, advice for that
is if you have the choice to not use several argument for a function, if you're crafting
your nicks piece of code, and you can, rather, make a function that can naturally be set,
rather than several named argument, a positional argument, sorry, to choose that should be set,
at least if you forgot a knitem, you would have a proper error in the right place, use only
a function that takes several argument, which is a function that takes a function, a functional
program, only when you really need it, not just often. And yeah, and I made runtime types,
libraries that catch this problem, and no, that's not, yeah, this is a flying copy of my website.
Yeah, I presented two years ago at first, them, so, not really interesting, but yeah,
self-advertising. A lot of scheme are similar, mechanism built in, so, yeah.
Next thing is, often when you start with nicks, you're like, it's just a configuration language,
so I do not have to really tune my editor, like, it's real programming language,
like that way you should really do that, use a language several protocol, use stuff like
pre-commit, or pre-push, oops, all this kind of things, there's a lot of static analyzer
for nicks, like dead nicks, etc. There really makes your experience way better, because it's
really easy to, I don't know, for good, parenthesis is nicks, and you really have no clue,
and I think a cool editor really helps you, that's abuse, but more saying, and next there is a
really cool REPL in nicks, that's when I start using it to debug my program interactive,
it's really changed my life, and I think everyone should do that, and that will be the point
of the first demo, and the next thing is, when you ask someone of two, or to debug an
nicks script for a while, I mean for more than 20 years, the answer was just traced, which is
a bit bad, and no, it's not that new, but no, we have a debugger, and so I will just demo it,
because I think that's really cool features, that's a lot of people are not where it exists,
and yes, so that's demo time, yeah, so I have two terminal window,
on the top, it's some nicks expression, really simple, or my variable start with a z,
because it will be shown in the end of all variables in my REPL, it's convenient, and I have
the REPL, and there is, I think I can load a nicks expression, it's called nicks REPL,
demo, yeah, I load it, I load only one variable, which is the final variable, the z, zc,
and I can evaluate this value, it's 42, it's super interesting, but no, I can trace
and trace, it's super obvious if you ever used functional programming, and if not, I'm really sorry for you,
within trace takes two argument, of course, the first one is what will be traced, and the second one
will be what built-in trace is written as a value, and so two things could be two different number,
but most of the time, what I do is I do in built-in trace x, and I define x as the
thing, I want both to return and both to evaluate, this is also the only way to do logs,
when you want to do logs, logs up to return value, and you have to ask for this value for the
logs to be printed, I will demonstrate that just in a moment, so I reload my file,
and if I do zc, no, I have a trace, and I was result, but you know, maybe if you're coming from
asker, it's like is there a tank or is there a value that I've been compute, if I re-ask for zc,
I don't have to trace any more, I just have to trace at the time one, I ask for zc, only one tank,
so when you're going to just lazy, it's maybe obvious, it's maybe not, and so early PL is a really
good way to have a good understanding of that, then I want to show off the new things that is called
oops, sorry, the new things that is called, and I have a LSP, it's super convenient,
within Brexit, so I have a breakpoint and I have, yeah, I don't need built in actually,
thank you LSP, so yeah, and if I reload and I do zc, it's just doing new things, maybe I can,
I don't know clothes and relinquish your RAPL, and we try, it's not working, why, because it's
obvious, I have to use the debugger, optional flag, because if you don't use it, the debugger is not
enabled by default, which is great, which is sometimes a bit annoying when your nix command is
called, deep into some strapting or CI, anyway, no, I have a debugger, and if I do, I load my
file, I compute zc, no, I have breakpoint, and if I check, no, I have access to za and b, okay, I've
lost a value, and I have the same thing, first time I have a trace, so if I do continue, I don't know
my command, c, yes, it's continue, I have the result, and no, you see, I add the result, without the
trace, because zd was already compute, so yeah, you get set on this thing, it's really, really,
ended to use RAPL, to use this kind of buildings, to use the debugger, to understand actually,
all an xx% is evaluated, and to not be blind, I really recommend it, and yeah, that was a short
demo about it, and second part is debugging builds, so when your success would be evaluated,
wall nix expression, you produce derivation file, I know your building, there's derivation
file inside the sandbox, those demo are a bit artren without a reliable internet connection,
and I was a bit afraid by it for the internet connection, so it's everything is pre-recorded,
so what is the problem, the problem is this slide is wrong, no, because nix actually is incremental,
there is an atomic measure in nix, which is derivation, if you already build a derivation,
we're not durable exact derivation, so you can make your nix build more incremental by making
more derivation, more derivation, more we're not reviewing everything each time, but inside the
derivation, if you have an issue, you will always rebuild the wall, script inside the derivation,
inside the sandbox from scratch, and that's not interactive at all, if you use to do occur,
you're like, oh, I will spawn a shell in my do occur and just mess everything, you can do that
easily with nix for obvious reason, maybe not so obvious, but yeah, that's something that often
you can also already frustrated with, because your feedback loop is super slow, and also,
then another problem I didn't wrong hit on the slide, but nix is actually when you're running,
building a lot of derivation in parallel, in arbitrary order, so sometimes you have an issue,
you run your command, you don't have the same error message, because it's just fail at another place,
and it will not never, I mean, it's this rigid system, but it don't fail or
really agree when there is more than one thing to fix, and sometimes you really are to see what's
the past between what you're actually trying to do and what's these derivations that are failing,
some of his first advice is to do something else, since default nix would put, which is quite
arbitrary, you have the dash l option, l caps, but anyway nix with monitor is really great,
and there is a modified version of it, that's even used to do things more in parallel, but
it's not the point of his talk, and give you two, I guess, I have some same
next trick, but I will show that later, as Kinima play pre-record nix input monitor,
yeah, so the nix input monitor, it looks like that, you have this kind of
things where you have no more nix l caps, it would put, but you see, at some point it will appear,
some dependency graph where you see what you are actually building, maybe that's not the best example,
it shows some kind of tree when you can see, okay, I'm building this derivation,
because it's in this derivation and starts to, it's really great to, and it's really easy to use,
you just replace nix binomial command 9, please use it, it's not new, but yeah, use that too,
yeah, what's next, it's super easy to inspect the derivation to actually see what's inside,
and it's super nice to understand what's the relationship between two derivations, you have y-dependes,
and you have nix tree for that, sorry, so y-dependent gives you this kind of outputs,
and nix tree too much window, nix tree gives you something like that, yeah, I here, I'm inspecting
the developer shell of my willy-twork, of the environment I used to build this light,
yeah, it's super fast, we are almost there, yeah, and I'm out of time, so just show it
very quickly and then the torque is finished, so yeah, my derivation is to plus more, it's just six
gigabyte to build slides, a pretty reasonable, yeah, I can see, use text live, what's text,
space in text live, and you can see there's maybe stuff you can remove from your derivations,
kind of since, so yeah, blah, blah, blah, blah, and yeah, and yeah, and there's two other things,
I didn't have the time to show, the first one is the nickel, rip on out, and you can basically
go interactively inside your derivation, environment, and test everything, and you can also write
any test for your nix code, yeah, there's two links in the slides, I will be online, this is
this course, I suppose that takes pain off to use, there's also sources of two is big point,
okay, and there's really old, three-block posts, quite old, that takes pain off to write,
you need test for your nix expression, which is something, I don't see a lot of people doing,
but I think it's nice to do, and that's all, thank you, all right, so we are out of time,
so we don't really have time for Q&A anymore, but this was great, great talk, I think it's really
important for people to get to know these tools because it's really hard to get started with nix,
and knowing that stuff really does help, so thank you very much for the talk, thank you very
much for everyone who took part in this in some way, it was a lot of fun, maybe we'll see you
at the Booth tomorrow or something, hopefully people will have good conversations following this,
and have a nice evening, and enjoy the rest of the first, and thank you, bye.