Nix explained from the ground up

Поделиться
HTML-код
  • Опубликовано: 22 дек 2024

Комментарии • 184

  • @zyansheep
    @zyansheep 3 месяца назад +502

    I sure do love it when a random yt channel with under 1k subs and a celeste speedrun posts an in-depth technical video explaining a complicated subject intuitively!

    • @vikingthedude
      @vikingthedude 3 месяца назад +10

      I think this is surma from google! Hes one of the hosts of the http 404 podcast. Jake archibald is another. Looking forward to his videos

    • @CoDEmanX47
      @CoDEmanX47 3 месяца назад +10

      ​@@vikingthedude It's HTTP 203 but yeah

    • @shamsartem
      @shamsartem 2 месяца назад

      @@vikingthedude also they both work at Shopify nowadays

    • @abiiranathan
      @abiiranathan 2 месяца назад +6

      He's not a random RUclipsr! Trust me

    • @MadhavaVishnubhatla
      @MadhavaVishnubhatla 2 месяца назад

      ​@@vikingthedudeqq

  • @LateefAlabiOki
    @LateefAlabiOki День назад

    This video should be the official introduction and overview of Nix. Please make more Nix tutorials.

  • @badluckprophet9103
    @badluckprophet9103 3 месяца назад +51

    Always love a "I made the video I wish I'd had." Thanks for putting this together, it's very well done.

  • @Cammymoop
    @Cammymoop 2 месяца назад +36

    This is very helpful, Nix needs more material that helps us understand the "Why", more stuff like this basically

  • @shvmoz
    @shvmoz 3 месяца назад +35

    Have been digging into nix/h-m over the last few weeks, awesome to have the algorithm send you to me pal!

    • @dassurma
      @dassurma  3 месяца назад +5

      Flattered that you spent your time on my vid :D
      h-m has been a game changer for me. It’s like NixOS with having to give up your normal OS. The weirdest corners for me so far have been to not be able to quickly edit my config files and having to do a special dance for nvm, rustup and similar tools.

    • @TheSast
      @TheSast 3 месяца назад +2

      ​@@dassurma if you don't use configure those directly with nix, but simply use home-manager to place them in the appropriate location, you can use home-manager to symlink them instead, allowing for rapid iteration. You can then turn that on or off with a custom option.

    • @opheon
      @opheon 3 месяца назад +1

      ​@@TheSastif the files in the appropriate location are manager by h-m, wouldn't you need to rebuild with every change?

  • @TotallyURGrandpa
    @TotallyURGrandpa 3 месяца назад +31

    Antichamber, Celeste, and now Nix. This guy knows ball.

  • @rok4028
    @rok4028 2 месяца назад +4

    22:56 Now that we have the Nix Trinity, can we expect a full systematic theology?

  • @alexpage8085
    @alexpage8085 3 месяца назад +40

    Learned a ton from this video Surma. Thanks for summarising all of this!

  • @kugurerdem
    @kugurerdem Месяц назад +1

    One of the best videos explaining how Nix works under the hood. Wish there was such a video when I first started using it.

  • @tejing2001
    @tejing2001 3 месяца назад +55

    I like how you presented this. Building up from the basics without getting too bogged down in the details. I do have a few notes, though:
    8:49 This is actually (unfortunately) not the case. Antiquotes of path types do expand to a nix store path, but builtins.toString actually returns the non-store path as a string. I consider this broken behavior, and have argued that it should be changed, but it is the current behavior. As a rule, just never use toString on a path-type. If you think you need to, then you're probably mixing eval time and run time in a way that will come back to bite you at some point. Also, it isn't exactly when a path-type is evaluated that it gets copied to the nix store (in particular, if you import a path type, it needn't be copied, and isn't), but I'm pretty much fine with glossing over that.
    13:07 Yes, you did a bad thing, but perhaps more importantly, on linux, this build would have completely failed because there, builds are run inside a container without access to the host filesystem at all. Might have been good to mention.
    21:12 You did a subtle bad thing here, by overriding phases without calling the pre and post hooks. This keeps the hooks from firing, and can lead to hard-to-debug behaviors as a result. This is one of the biggest causes of frustrating confusion I see for people writing their own derivations. Some construct that depends on hooks is supposed to work, but doesn't, and they can't figure out why. It's cause they overrode a phase and didn't use runHook to run the pre and post phase hooks.

    • @dassurma
      @dassurma  3 месяца назад +19

      Oh cheers! Really appreciate the thorough review. I’ll add those to the video description. The remark about the hooks is interesting. That was something I definitely misunderstood and I suspect did cause a lot of headaches lol.
      Wrt containerization: I actually had that on my TODO list to check if you can have your build run in a container, and I never got around to it. Can derivations opt out of the containerization? Or how does bootstrapping work on Linux?

    • @tejing2001
      @tejing2001 3 месяца назад +15

      @@dassurma Containerization is a nix option, controlled in nix.conf or on the command line with --sandbox or --no-sandbox. It's off by default on darwin, I think because the sandboxing tech available on darwin causes too many problems, but on linux it's on by default. The sandbox only has the closures of the store paths mentioned in the .drv available in it. Nothing else. As far as I know, there's no way for a derivation to skip containerization; if your build can't work in a container, then it really isn't a proper nix build in the first place, so it isn't really viewed as sensible to give that option, especially considering the security implications of building other people's (not necessarily trusted) derivations.
      Bootstrapping stdenv in nixpkgs (in linux or darwain, afaik) is done without reference to the host system, because it instead starts with a precompiled set of tools, downloaded much like source code is. Those precompiled tools are very rarely updated, and extra care is taken to ensure provenance when they are. I believe several separate groups build them independently and check that they get bit-for-bit identical results, among other things. They don't really need to be updated until you reach a point where the latest version of the compiler can no longer be built with them, anyway.

  • @Loige
    @Loige Месяц назад +1

    Honestly, the best nix video I have seen so far! Thanks, Surma!

  • @sandhilt
    @sandhilt Месяц назад +1

    Please, make more videos about Nix! Amazing and astonishing content!

  • @DenisFalqueto
    @DenisFalqueto Месяц назад +1

    This is the documentation I was looking for! Thank you so much!

  • @pederpbsds
    @pederpbsds 3 месяца назад +6

    A good balance between handwaving nitpick details and drilling down into how it all comes together!

  • @an_imminence
    @an_imminence 3 месяца назад +4

    Most videos start where you ended. I felt like there had to be something simpler underlying all of this, and there is! Thank you so much for this. You actually explained Nix. By going through the whole math, only to then, afterwards!, show the shortcut.

    • @dassurma
      @dassurma  3 месяца назад +1

      Thank you for the kind words. Means a lot.

  • @arnaudbarre6006
    @arnaudbarre6006 3 месяца назад +39

    I loved the content, the tempo and the story: the end result is a consequence of logic steps, not something you take for granted. I just found that the music was a bit too loud.

    • @dassurma
      @dassurma  3 месяца назад +6

      Thanks for the kind words. You are not the first person to point that out. I’ll keep that in mind for next time :D

    • @plebiannn
      @plebiannn 2 месяца назад +3

      If you could upload without the music I would use it as a default for explaining nix

    • @kriffos
      @kriffos 28 дней назад

      Yeah, the music is REALLY annoying, too loud and too repetitive. I would have aborted the video if the content was not that great. I really loved the way you explained it and the pictures you painted. Keep up the good work (and just leave out the music) ;)

  • @bjeanes
    @bjeanes 3 месяца назад +11

    Excellent video. I'll be sharing this one when people ask me to explain Nix.

  • @amanueltigistu8268
    @amanueltigistu8268 2 месяца назад +1

    this is just a great explanation of nix that i ever heard. please make more videos about nix. Thanks.

  • @Danielo515
    @Danielo515 16 дней назад

    I can't believe how approachable and interesting you made what has been up until now a very complex and hard to understand tool. Many thanks

  • @iChrisBirch
    @iChrisBirch 3 месяца назад +1

    Great video. Just enough content that I wanted to watch it all and enough teasers to make me go research some more.

  • @Rypervenche
    @Rypervenche 3 месяца назад +3

    Extremely well done! You probably don't use this, but if you ever do a video on NixOS, I'm here for it!

  • @oOBromOo
    @oOBromOo 2 месяца назад +1

    Great video, was very helpful! Interested in nix for a long time and this helps a lot to understand nix and all of its meanings better.

  • @matthiasbendewald1803
    @matthiasbendewald1803 2 месяца назад +1

    Best video i saw this year, just awesome, THANK you!

  • @YaroKasear
    @YaroKasear 3 месяца назад +3

    Make more. With content of this quality you deserve more subs!

  • @xorlop
    @xorlop 3 месяца назад +1

    I just gave my first talk that explained similar concepts… but dang! Your explanation is amazing! This is just great!

  • @sirpiplin9948
    @sirpiplin9948 3 месяца назад +1

    The video we needed, not the video we deserved! Amazing Job!

  • @tyler...
    @tyler... 3 месяца назад +3

    This is such a great video! I've never really understood the reasoning behind Nix until now, let alone how it works. Saving this one to my "most important videos" playlist

  • @wildwestrom
    @wildwestrom 3 месяца назад +2

    This is superb! I think this is the best tutorial I've seen yet.

  • @sarahclark9256
    @sarahclark9256 2 месяца назад +1

    Excellent as always! Good to hear your voice again.
    I’ve been running nixos for a couple of years and contribute to nixpkgs.

  • @theutz
    @theutz 3 месяца назад +1

    I needed this a year ago! But I’m happy that it’s here now. :)

  • @TheMarkman1995
    @TheMarkman1995 2 месяца назад

    This is really well done and useful, been trying to wrap my head around nix for a few months or a year at this point. Still very far down the rabbit hole to explore but this was crazy useful!!!

  • @_____vieve
    @_____vieve Месяц назад

    BANGER. thank you sm for this cool video. i’ll rewatch this once i try nix

  • @WeshalbDennNicht
    @WeshalbDennNicht 3 месяца назад +1

    What a great and helpful video for anyone trying to get a first, or a second deeper grasp on what Nix is and how it works. Thank you!

  • @nomadtrails
    @nomadtrails 3 месяца назад

    Kudos on an incredibly well made video. This is absolutely the foundational knowledge I needed that fits between "Why to use" and "How to use" which are well represented elsewhere.

  • @kaungminkhant9790
    @kaungminkhant9790 2 месяца назад

    Honestly, I love the explanation on the topic, and I would like to request more on the topic. Mind blown by how well it is presented. I myself trying out Nix and want to get started. The problem was finding where to start. Thanks a lot for the video!

  • @databasemadness
    @databasemadness 3 месяца назад

    The editing and explaining of this video is insane

  • @hhhnnn9195
    @hhhnnn9195 3 месяца назад

    Thank you soo much! This was the Tutorial new users need, and I felt was kind of missing by the official documentation.

  • @At-Dawn-We-Ride
    @At-Dawn-We-Ride 3 месяца назад

    Thank you for this very informative, nicely balanced video. The documentation situation for Nix is indeed not ideal, so I appreciate your work of collecting various distributed pieces of pertinent information and combining them into a "digestible" format. 👍

  • @ejiek
    @ejiek 3 месяца назад

    Thanks! That is an amazing learning experience! Pleasant motioncanvas graphics, well pased explanation, relaxing music and colors. I'm happy that RUclips got me here. Subscribed and patiently waiting for more =]

  • @blacklistnr1
    @blacklistnr1 Месяц назад

    Cool video! exactly what I needed :))
    Can you please also do a follow-up on replacing docker?
    The way I currently see it it's more of a one-time temporary thing (e.g. nix build, nix develop). I'd be very interested to see how a production deployment would look like

  • @yanisfourel
    @yanisfourel 3 месяца назад

    That is such an incredible video. Thatns for your hard work

  • @Mendez_84
    @Mendez_84 3 месяца назад

    I've been hearing a lot about nix recently but haven't bothered to check it out. Maybe I will take a look now. Thanks for the video

  • @JordanShurmer
    @JordanShurmer 3 месяца назад +3

    Thank you Surma. excellent video

  • @DipsankarMaity
    @DipsankarMaity 3 месяца назад

    Loved It. Keep the videos coming Surma.

  • @yoyonel1808
    @yoyonel1808 3 месяца назад +3

    at 5:49 the error message in not related to the code:
    /* f = */
    {a, b, c}: a + b + c
    f {a = 1; b = 2;}
    # error: function called
    # without requirement argument 'b'
    It's not 'b' but 'c' (i hope :p)

  • @povilasn8239
    @povilasn8239 3 месяца назад

    Awesome video !!! Wish i had it when i just started learning, but you still managed to fill in some knowledge holes for me.

  • @SinhNguyen-tz6us
    @SinhNguyen-tz6us 3 месяца назад

    Great video. I loved your OTMT podcast.

  • @meyou118
    @meyou118 3 месяца назад

    best description about nix - great video

  • @hidayattaufiqur
    @hidayattaufiqur 3 месяца назад

    thank you so much for this video! such a great explanation, you're awesome!

  • @BGroothedde
    @BGroothedde 3 месяца назад

    This is a really good video with a lot of care, thanks!

  • @Majiy00
    @Majiy00 3 месяца назад

    Great video! look forward to the next one.

  • @ivanicguildmember2844
    @ivanicguildmember2844 3 месяца назад

    Elegant explanation. Much tanks for making this video. Could you also make a video explaining the machinations of NixOS too?

  • @bryanhonof
    @bryanhonof 3 месяца назад

    Cool, loved the visualizations!

  • @adexiofan1232
    @adexiofan1232 2 месяца назад

    This was very well done good sir.

  • @PanagiotisKar
    @PanagiotisKar 24 дня назад

    great explanation, thank you.

  • @kylemoran455
    @kylemoran455 3 месяца назад +1

    This is great! Do flakes or home-manager next!!!

  • @oskarboer1511
    @oskarboer1511 3 месяца назад

    Thank you for making this super clear explanation!

  • @peacefulexistence_
    @peacefulexistence_ 2 месяца назад +1

    1:15 software is usually distributed as binaries since a binary has a smaller file size, less dependencies, and you can directly run it rather than compiling it (which in the case of something like Chromium would take several weeks of 100% CPU usage if you were to do it on an old office PC from 2010s, if it would even finish and not run out of RAM, which it probably would)
    1:20 Firefox is Open Source, under the Mozilla Public License which is a weak copyleft license.
    2:15 no, it doesn't, the source code gets compiled on a compiler farm of each Linux distro, uploaded to its repositories, and the user downloads the resulting binaries. Unless you run Gentoo.

  • @shmuel-k
    @shmuel-k 2 месяца назад

    Great video, thank you!

  • @roycrippen9617
    @roycrippen9617 3 месяца назад

    Dude sick video!

  • @networkException
    @networkException 2 месяца назад

    One can start wars over whether "with;" is encouraged or not. In my opinion, sometimes it's just the most elegant way to express yourself without repetition.

  • @takumicrary4396
    @takumicrary4396 2 месяца назад

    God what a great explanation

  • @miquelvazquez4544
    @miquelvazquez4544 3 месяца назад +1

    Great video! Can you elaborate on how it compares (pros and cons) with docker?

  • @xsharawi
    @xsharawi 3 месяца назад +1

    This video is so well made, I'm glad I watched it!

  • @luv2code
    @luv2code 3 месяца назад +10

    I'm curious about how it replaces docker on your servers? I understand that you would run some bit of nix software that is sort of pinned to a specific version - like a docker image. But docker is more than that. Does nix also provide filesystem isolation and a networking layer?

    • @luv2code
      @luv2code 3 месяца назад +1

      Thanks for the video, BTW. I appreciate you.

    • @gungun974
      @gungun974 3 месяца назад +4

      Personally I liked both Nix and containers. The isolation of files systems and network of docker is a pure joy and the reproducibility and sandbox of building of Nix is perfect.
      That’s why I used nix to build docker Image that I can just run with Docker.
      Nix is not a Docker killer. Nix is a Dockerfile killer

    • @tejing2001
      @tejing2001 3 месяца назад +3

      Nix doesn't provide the security benefits of docker, no. But honestly, that's not the main reason people use docker most of the time. Also, nixos and similar systems can certainly set up containers with those security benefits, if you want, and the nature of the nix store tends to make it rather easy to create such containers.

    • @leoschafer5172
      @leoschafer5172 3 месяца назад

      It's possible to use a nix derivation to build a docker container (so there are no problem is someone used :latest and the docker file fails). I don't remember where the docs for this are

    • @pythonBlender7
      @pythonBlender7 3 месяца назад +1

      I'm assuming your a sysadmin who uses docker like I do. There's a thing called nix she'll or something that makes a temp env for a package. That package could be your software. When you exit, the shell and envelope are gone I think and it's basically ephemeral like a container. Also if you think about it, that docker networking layer is only there because it has to be. Even if you are good at it like I am it's still an extra thing to remember and EVERYONE gets but by it the first time they try to send something to local host right? We'll if it's just on your system then you suddenly get to use local host again. That's nice right?

  • @MrAzulay
    @MrAzulay 3 месяца назад

    Great content as always, Surma! I’m also genuinely curious to how you find it work as a replacement of docker on your servers.

  • @gueyenono
    @gueyenono 2 месяца назад

    Do you plan on making more Nix content? Thank you very much for such a polished and informative video.

  • @carneloot
    @carneloot 3 месяца назад +1

    I would love to have more videos on this series (this is now a series, right?). Personally I’d love to know more about home manager, but I’m sure there is a lot more to talk about on the nix ecosystem

  • @badr_mo
    @badr_mo Месяц назад

    Thanks for this video. You have touched on the very essential things that is confusing me so far.
    One more thing, I think I am missing something here, when building clang-s2, you've used in the derivation of glibc the clang-s1 derivation, which depends on system libraries. Doesnt that mean that eventuall clang-s2 also depend on system libraries?

  • @erwin757
    @erwin757 2 месяца назад

    You talked about replacing docker. How did you do that and how do you manage your containers? I did not fully understand that jump to connecting nix with docker replacement

  • @luckydye
    @luckydye 3 месяца назад

    great pacing 👍

  • @ramonrames
    @ramonrames 3 месяца назад

    More videos please. ❤

  • @SpidFightFR
    @SpidFightFR 3 месяца назад

    Hey! Awesome video !

  • @leandronicolas1
    @leandronicolas1 3 месяца назад

    Someone please ask for this to be added to the wiki and awesome-nix repo. Awesome video!

  • @__vyre
    @__vyre 3 месяца назад

    beautiful video 🙏 keep it up bro🫶

  • @someonesalt5084
    @someonesalt5084 3 месяца назад

    Top tier vid

  • @joshaushessen2270
    @joshaushessen2270 2 месяца назад

    It's a great video and an angle, I haven't seen before. Thanks for that.
    The only thing I didn't understand is the following: If clang has a dependency onto libc, then the hash of clang is dependent on the hash of libc. And if libc is build with clang then its hash is dependent onto clangs hash. Isn't that bad? Or why is it not?

  • @ArchLars
    @ArchLars Месяц назад +1

    I am an Arch user and I am not really looking to distro hop anymore, however I am very tempted by NixOS. It has a very mature community and I think the way it works is interesting. I would have to set off some time to get used to the userland of it, but man I am tempted just to do it. Should I? Before you say this, yes I have looked into all my usage cases and NixOS can handle all of them just fine. I would just have to get used to all the various things NixOS is good at to optimize my system and you know... as Linux users of this area, that is the _fun_ of a distro, isn't it? Agh, I am very tempted! 😄

    • @ArchLars
      @ArchLars Месяц назад

      Also I am not looking to ever dual boot any distro or any operating system, so I wouldn't want to keep my Arch install around if I decided to do this. All in or not.

    • @dassurma
      @dassurma  Месяц назад +1

      Honestly, my recommendation is to go for arch with nix rather than go full NixOS. NixOS is attractive from a purist perspective, but I have found it impractical for a workstation (I do like it conceptually for servers tho, but haven't taken that leap yet)

    • @seanhdka
      @seanhdka Месяц назад

      @@dassurmawhat makes it impractical for you? wanted to switch back to a different distro since i can't use nix at work, but to be honest i can't ever go back to something else. just being able to for example have a stable zfs release but have the newest kde release is just to good. also love the fact that my system is inherently documented, though i haven't used home manager yet

  • @janedoe5877
    @janedoe5877 3 месяца назад

    Love this

  • @jesusa7042
    @jesusa7042 2 месяца назад

    THANK YOU!!

  • @korigamik
    @korigamik 3 месяца назад

    Great video, how do you create the animations and the voice overs? Will you share the source code for this video?

  • @acriliqueofc
    @acriliqueofc 3 месяца назад

    Great video!

  • @BboyKeny
    @BboyKeny 3 месяца назад +3

    That's a bold claim indeed. Can it install Crisis on my Tamagochi?

  • @TheAndreArtus
    @TheAndreArtus 2 месяца назад

    Mathematically a function takes 1 input and produces 1 output. Multiple arguments can be passed (and returned) as a tuple or by currying.

  • @abhishek.01
    @abhishek.01 3 месяца назад

    Thank you!

  • @NostraDavid2
    @NostraDavid2 2 месяца назад

    Yooo, that Dutch pronunciation of the research paper's title was _tight_! That was so clean! I see you live in the UK, but did you live over here for a bit or what?

  • @andreujuanc
    @andreujuanc 3 месяца назад

    Amazing, quick question regarding "placed docker on my servers". Do you do cgroups by hand? how do you handle sandboxing?

  • @Shujaathullakhan
    @Shujaathullakhan 3 месяца назад

    its a great video. Had a doubt on how you create these videos? what is the software used?

  • @EmmanuelMess
    @EmmanuelMess 3 месяца назад +1

    If this is actually able to compile the Qt frontend, it would be incredible, as Qt is very difficult to compile replicably, even with Docker.

  • @FuzailShaikh
    @FuzailShaikh 2 месяца назад

    What i still don’t understand is why do we need all this when we already have Docker?

  • @R24-q6b
    @R24-q6b 3 месяца назад

    I really liked the video but can you tell me what did you used to create such a good quality video.

    • @dassurma
      @dassurma  3 месяца назад

      That’s the wonderful Motion Canvas :)

  • @Kotz_en
    @Kotz_en 3 месяца назад

    I love how you animated the code throughout the video. Is there a tool that performs these transitions automatically, or did you create them manually when editing the video?

    • @cinderwolf32
      @cinderwolf32 3 месяца назад

      Motion Canvas

    • @Kotz_en
      @Kotz_en 3 месяца назад

      @@cinderwolf32 Thanks!

    • @cinderwolf32
      @cinderwolf32 3 месяца назад

      I think we were sorely lacking effective presentation and communication techniques for highly technical information and concepts, and I'm continually impressed by how everyone utilises Motion Canvas.

  • @ZackMitkin
    @ZackMitkin 3 месяца назад

    Very good video, the music is very disturbing though. Any change you can re-upload without such loud music?

  • @rakeshvenkat9971
    @rakeshvenkat9971 3 месяца назад

    Brilliant!!!!

  • @RonaldoHabibiDev
    @RonaldoHabibiDev 3 месяца назад

    great ! Thanks !

  • @xSkyeHD
    @xSkyeHD 3 месяца назад

    Did you try this with a devcotainer or nixpack deployment?

  • @SirSomnolent
    @SirSomnolent 3 месяца назад +4

    Is it mandatory that I dye my hair blue before installing nixos?

    • @emmaflies199
      @emmaflies199 2 месяца назад

      No, you can also go the programmer socks and skater skirt route.

  • @CristianHeredia0
    @CristianHeredia0 3 месяца назад

    Are you building nix containers instead of docker , or using nix to build slimmed down docker containers, or something else?

  • @franklin7026
    @franklin7026 2 месяца назад

    I tried nixOS some days ago, but I dropped it off because I could not make my Neovim config work on it, I loved the way nix manages its packages, but this is also the reason I dropped it, my LSP config wasn't working, the main reason was "Could not start dynamically linked executable: [...] …cannot run dynamically linked executables intended for generic
    linux environments out of the box" even when I tried to install LSPs packages directly from nix and point to them in my LSP config it didn't work., so a get back to Arch Linux.

  • @delanym
    @delanym 2 месяца назад

    what if you don't have the source?