NixOS - How the store and packages work

Поділитися
Вставка
  • Опубліковано 30 вер 2020
  • As promised here's the third part which touches on where and how the packages are stored, as well as a quick look at Pantheon (which I also promised in my previous video).
    Part 1: • NixOS: How it works an...
    Part 2: • NixOS dual booting and...
    Get NixOS here: www.nixos.org
    Support my channel on Patreon! : / doriandotslash
  • Наука та технологія

КОМЕНТАРІ • 61

  • @reisen1553
    @reisen1553 3 роки тому +27

    I use NixOS for about a year, but I never knew for sure how it works. Fortunately your video made it very clear to me.
    Thanks as always.

    • @Doriandotslash
      @Doriandotslash  3 роки тому +1

      Phoenix Great to hear! Also check out my other 2 NixOS videos if you haven’t already seen them 😉

  • @Sinnersmight
    @Sinnersmight 3 роки тому +13

    I want to swap to NixOS asap now. Clean, contained, sane dev environments for building and projects is a godsend.
    This alleviates a lot of my ocd concerns.
    Thank you for enlightening us, I cannot wait to dive deep into nix!

  • @gilbertogarma2820
    @gilbertogarma2820 3 роки тому +4

    I am impress for the quality and how clear are your videos, another good point is that you don't have music in the videos, is something like sitting in the classroom listen and learning, you are a peaceful place in the noise world of youtube, fine voice to listen, thanks

    • @Doriandotslash
      @Doriandotslash  3 роки тому +1

      Thanks very much! I try hard to make the audio clear and also use noise cancellation as well. I do have music in the background but it's very subtle. If you turn up the volume you'll hear it. I use it to cover up any remaining background sounds and clicks and buzzes etc. Cheers!

  • @nixeverything
    @nixeverything 4 місяці тому

    Please do more on NixOs. You teach so very well. Maybe cover flakes, home manager, etc

  • @pinpox
    @pinpox 3 роки тому +9

    Watched your last video on nix and you got me into nix. Please continue this series!

    • @Doriandotslash
      @Doriandotslash  3 роки тому +3

      Thanks! Not sure how many more I'll make if any. The first one was very popular, but the 2nd and 3rd not so much...

    • @pinpox
      @pinpox 3 роки тому

      @@Doriandotslash how about one about home-manager for user setup? I'm in the process of reorganizing my dotfiles with home manager and there sure is a lot to discover.

    • @vincentm99
      @vincentm99 3 роки тому

      ​@DorianDotSlash This could be of interest to you as well (nix flake + home-manager):
      ​@@pinpox yeah this is quite nice.
      Combined with nix flakes, you can update your environment directly from a configuration on github which is just insane.
      Install the nix flake experimental feature: nixos.wiki/wiki/Flakes
      then just do: sudo nixos-rebuild switch --flake github:Narice/nixos-system/master
      and you'll have my config (with users etc, so maybe clone it and change a few things before using it x))!
      Just INSANE.
      And it will always work due to a flake.lock file that makes sure that the build is 100% reproducible
      (minus very rare events such as the deletion of a dependency, but this is very limited)
      I have home-manager directly in my flake so my configuration comes from there.
      I still have to migrate all my dotfiles to there but it's a good work in progress
      Also as an added bonus, you can put the flake wherever you want on your system, meaning that you do not need to use sudo to edit your files ;)
      Here is an example of a fully organized configuration based on nix flake: github.com/cideM/dotfiles
      The guy has his entire config in there which is super useful.

    • @fuseteam
      @fuseteam 3 роки тому

      @@Doriandotslash a video on setting up flatpak and snaps would be interesting

  • @mementomori1868
    @mementomori1868 2 роки тому

    You create best tutorials for this great os. GJ

  • @b0ba_884
    @b0ba_884 3 роки тому +6

    Great Video. A video on Home Manager Would Be great :)

    • @lucperkins9843
      @lucperkins9843 3 роки тому

      Burke Libbey has a good video on Home Manager on his channel

  • @alexanders1859
    @alexanders1859 Рік тому

    This series really helped my wrap my head around Nix OS! Hopefully one day you come back to doing videos :D

  • @Mikesco3
    @Mikesco3 10 місяців тому +1

    Can you do something covering NixOS flakes?

  • @actuallyganta6044
    @actuallyganta6044 3 роки тому +3

    I'm currently trying to decide on a Distro that works for me and NixOS really seems like the most intriguing to me so far, however while researching it I also stumbled upon GoboLinux, which seems to have some similarities. Have you had any experience with that distro and if so, how did you feel about it?
    Also, these videos are top notch, thank you so much for the work you put into these, they've been extremely helpful in helping me understand NixOS!

    • @Doriandotslash
      @Doriandotslash  3 роки тому +2

      Thank you! I did try Gobolinux, but not for long. The lack of packages available as well as how old they were immediately turned me off of it.

    • @actuallyganta6044
      @actuallyganta6044 3 роки тому

      @@Doriandotslash yeah makes sense and that's a big selling point for me with NixOS, so I'll stick to that. Thanks again!

  • @BenMitro
    @BenMitro 3 роки тому +3

    NixOS looks like something I want to try. Your vid is excellent and clear to me - gives a great run down on how NixOS is put together, but I'm not clear how you create a "version" - say running firefox 81 on pantheon, whereas another "version" my be running firefox 80 on gnome that these two versions will appear in grub? Also what happens to user files, does the version with firefox 80 share the same user files as for firefox 81 (as an example)?

    • @Doriandotslash
      @Doriandotslash  3 роки тому +2

      Benny this is more of saving your system than creating specific versions. After system changes, updates, and adding/removing packages, a new version is automatically saved so that you can revert back to an old version is you should have any problems. It’s more of a backup and not really intended to be used to run parallel configurations. Check my first 2 videos on NixOS as well in order to see more of how it works. Cheers!

    • @BenMitro
      @BenMitro 3 роки тому

      @@Doriandotslash That sounds like excellent advice Dorian. I will watch the other two!

  • @cyberdyne981
    @cyberdyne981 3 роки тому +1

    Dorian: I discovered your videos based on your Arch to Debian journey. I spent 2 years using Arch and switched away for similar reasons. I've just finished your 3 excellent videos on NixOS and built a VM to play with it. Wow! I think I may switch my main desktop and server machines to NixOS. THANK-YOU so much for the clear content!
    I do have a request/nudge. You mention in Part-3 that you might cover Virtual Machines and containers on NixOS. I would love to see you cover libvirt (virtmanager) using QEMU/KVM User session mode (qemu:///session) on NixOS. I found this to be a far superiour alternative vs VirtualBox which I had used for almost 8 years. I also use Docker on my servers, so Docker or podman on NixOS would also be interesting, but User Session libvirt VM hosting on NixOS would be probably enough for 1 video.
    Again - Thanks for the time you've put into these videos. I've now watched some others, but yours has been the best I've seen on NixOS.

    • @Doriandotslash
      @Doriandotslash  3 роки тому +1

      Thank you and I'm glad you enjoyed the videos! I've considered doing a video on VM's, but after playing with them for abit, I found them to be a little difficult to setup initially. I managed to get one running, but after some updates and a reboot, it woudn't start anymore for unknown reasons so I kind of gave up on it. For my, QEMU/KVM is a MUCH better system for running VM's and I'm going to stick with that.

  • @Storm_.
    @Storm_. 3 роки тому

    Nice explanation, also I've never heard anyone pronounce executable like that before, blew my mind :D

  • @nelsono4315
    @nelsono4315 11 місяців тому

    another excellent video. I just started using NixOS and so far I am loving it. I am fairly new to Linux, maybe 2 years. Decided to learn it during the pandemic. Your videos are so good for someone like me. I appreciate the work you do. Thanks!

  • @agostinom3539
    @agostinom3539 3 роки тому +1

    Nice videos! How do you remove preinstalled gnome software (e.g. cheese)?

    • @Doriandotslash
      @Doriandotslash  3 роки тому

      There's cerain software that can't be excluded, and cheese is one of them. For some dumb reason core components are dependent on it.

  • @fuseteam
    @fuseteam 3 роки тому

    ahhhh each of those folder are their own roots

  • @xperience-evolution
    @xperience-evolution Рік тому

    Isn't this system wearing out ssd's pretty fast if it always keeps all the Programs with every single version saved? Compared to Debian/Fedora.
    These days an update only brings in the new stuff and does not delete the old version and installs the new one (at least on most platforms), so it has to write less on the ssd than back in the day. But this seems to do exactly the opposite? I understand the benefit of it but is it possible to prevent that? Or did I understand everything wrong?
    Sorry this might be a noob question but I am just learning.

    • @pidusredlah
      @pidusredlah Рік тому

      Delta updates are not available for Ubuntu, Debian, Tumbleweed or Arch. So Nix doesn't wear down an SSD any more.

    • @xperience-evolution
      @xperience-evolution Рік тому

      @@pidusredlah But usually when there is an update it might only be a few MB but the whole program is maybe a couple hundred. So it only adds what is new or what is changed? Nix(OS) on the other hand downloads the whole app again and again with every update.

  • @jonringer117
    @jonringer117 3 роки тому +5

    A ".drv" is called a derivation. It's essentially "a recipe" which specifies how to build something specific to your system's architecture (e.g. x86_64) and platform (e.g. linux). I have an explanation of how they are created here discourse.nixos.org/t/site-intro-to-nixs-repeatable-builds-point-has-some-clarity-issues/9154/5 . Another way of thinking about .drv's is that they can be used to create nix store paths.
    This is how nix's binary cache works, your machine ask's "hey, do you have this unique package, with these exact dependencies?" and for most users, it will be "yes, I do, here you go". (unfree packages can't be distributed so certain applications like steam will have to be "built".)
    If you're doing something exotic like building all the packages against musl (e.g. `nix-shell -p pkgsMusl.curl`), then the .drv's provide enough information for your system to build the package and all of the dependencies from source. This is why I've also heard it been called "debian for adults".

    • @Doriandotslash
      @Doriandotslash  3 роки тому +1

      Yeah, that's what I said in the video : "do stuff with this stuff" lol I looked into a little bit but didn't get right into it. Thanks for the info!

  • @Verzach3
    @Verzach3 3 роки тому

    Do you recomend NixOS for daily usage ?

    • @Doriandotslash
      @Doriandotslash  3 роки тому +1

      Yes it works quite well! Just make sure you run the updates now and then because it doesn't do it automatically.

    • @jonringer117
      @jonringer117 3 роки тому

      NixOS doesn't adhere to en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard . Meaning that if your daily usage includes downloading and using pre-built binaries, the NixOS experience is going to be a very rough one.
      The main benefit of nixos is being able to declare the configuration of your entire system in a single file. You can "sample" the nix ecosystem by just installing nixpkgs in an existing linux or mac machine nixos.org/download.html

    • @Verzach3
      @Verzach3 3 роки тому

      Thanks I will try it out for a few days to see if it sticks to what I need

    • @06kellyjac
      @06kellyjac 3 роки тому +1

      @@Verzach3 if you do want to run arbitrary binaries you download from GitHub/Gitlab/etc another option is to use nix + home-manager on any other distribution
      What I do for single binaries is if I have 3-5 mins I might package it for nix, if I dont or it requires a more complex packaging process I just whip out an alpine or Debian container

  • @woss_io
    @woss_io 2 роки тому

    You said `hash is different because the code is different. does the hash get calculated from the actual CODE or the name+semver? if it's the latter, then your statement is not correct. people can publish the versions and not change the code ( why ? because they can )

  • @nickegranis
    @nickegranis 3 роки тому

    Cool, your installation is pre epoch =)

    • @kvngn
      @kvngn 3 роки тому

      Epoch was midnight UTC, and he's in North America, which explains "Dec 31." Still looks pretty funny, though!

  • @vedantma
    @vedantma 3 роки тому

    Unix time starts from 1st Jan 1970, maybe that's why.

    • @Doriandotslash
      @Doriandotslash  3 роки тому

      Well, someone pointed out it's because of this : nixos.org/manual/nix/stable/#ch-relnotes-0.7

  • @FixingGunsInAir
    @FixingGunsInAir 3 роки тому

    I like NixOS idea and it's tempting to try out. Nix is awesome but unfortunately it's so a niche distribution that it doesn't have enough maintainers and QA. It could be better, but not enough people, I suppose. You know, GNOME 3.36 on unstable in 2020 is like not keeping up. And a week or two ago they had only 3.34. And the same thing with plasma, it's still 5.18... And pull request with 5.19 didn't made it in time, I suppose.
    Maybe it's happening because most of the contributors of NixOS is tiling WM fans or something? But I'm not the one.
    You can do the thing yourself, but you'll need to learn Nix *and* it's guts. There's no API, standard namings or a man for every package. Only the source code can tell you configurable options. And Nix is the only way to configure a system, because configuration is a derivation.
    And for me personally, it can't compete with Fedora Silverblue at all. Because Fedora manages to be both bleeding edge and tested (QA). And even production ready industry standard (Red Hat), really.
    Sad, but I can only make use of NixOS in VM or testing machine. I hope things will get better.

    • @FixingGunsInAir
      @FixingGunsInAir 3 роки тому

      Good thing that if I configure it in a VM the way I like, I can replicate it on real hardware using only one text file. So, maybe it's not so bad.

  • @ryantmulligan
    @ryantmulligan 3 роки тому +11

    $ date -d @0
    Wed 31 Dec 1969 04:00:00 PM PST
    Everything in the nix store has a timestamp of 0 for reproducibility.

    • @Doriandotslash
      @Doriandotslash  3 роки тому +3

      Ryan Mulligan interesting. Thanks for that. Is that info somewhere in the wiki or manual?

    • @jonringer117
      @jonringer117 3 роки тому +2

      @@Doriandotslash Motivation can be found reproducible-builds.org/docs/source-date-epoch/
      Can't find anything specific to nixpkgs. However, interesting fact, zip file format isn't compatible with dates prior to 1980.

    • @ryantmulligan
      @ryantmulligan 3 роки тому

      @@Doriandotslash nixos.org/manual/nix/stable/#ssec-derivation at the bottom. I was wrong, the timestamp is set to 1 not 0.

    • @mskiptr
      @mskiptr 3 роки тому

      So it's 1970-01-01 00:00:01 UTC and just the timezone on top of that?

    • @jonringer117
      @jonringer117 3 роки тому

      @@mskiptr unix timestamp doesnt have a concept of timezones. Just an offset from the epoch en.wikipedia.org/wiki/Unix_time

  • @monsterpower3348
    @monsterpower3348 3 роки тому +2

    first one here hahahahahah

    • @kabochaVA
      @kabochaVA 3 роки тому +2

      One hour later, still the only one... :-/

  • @s.sliackus459
    @s.sliackus459 Рік тому

    Gobolinux very nice linux, unfortunately, no longer in development. They share some ideas with Nixos.