NixOS Setup Guide - Configuration / Home-Manager / Flakes

Sdílet
Vložit
  • čas přidán 31. 05. 2024
  • !!!Resources, Timestamps, and Extra Notes Below!!!
    --------------------
    In this mini-course I try to demystify the whole process of setting up NixOS on your personal system.
    This course covers:
    - NixOS (configuration.nix and hardware-configuration.nix)
    - Home Manager (home.nix)
    - Flakes (flake.nix)
    This video is for entertainment purposes only.
    Some aspects/topics might change in future updates.
    Not everything is 100% correctly explained or information is left out. This is done to get the point across and keep everything accessible for newcomers.
    --------------------
    Notes ( that I forgot to mention and will probably be updated with more information):
    - Flakes are currently only supported on the unstable version of NixOS
    - Home-Manager can be updated again by just running:
    $ nix-channel --update
    - Changing by-uuid in hardware-configuration.nix to *by-label*, does not mean you can always use this for other systems as mentioned at 0:55:00. Depending on your system, other kernel modules are needed for the system. In this case, it's highly recommended to still run:
    nixos-generate-config --root /mnt
    But this is useful if you want to reinstall the profile on the same formatted system.
    - nix.settings.auto-optimise-store is currently only available on unstable
    - I know it's curly. But I like squirly :)
    --------------------
    Resources:
    NixOS:
    1. NixOS Website: nixos.org/
    2. NixOS Manual: nixos.org/manual/nixos/stable/
    3. NixOS Packages & Options: search.nixos.org/packages
    4. NixOS Wiki: nixos.wiki/wiki/Main_Page
    Home-Manager:
    5. Home-Manager: github.com/nix-community/home...
    6. Home-Manager Manual: nix-community.github.io/home-...
    7. Home-Manager Appendix A: nix-community.github.io/home-...
    8. Home-Manager Appendix B: nix-community.github.io/home-...
    Examples:
    9. Personal Flake: github.com/MatthiasBenaets/ni...
    10. List of reference configurations: nixos.wiki/wiki/Configuration...
    Extras:
    11. NixOS Learn: nixos.org/learn.html/
    12. Nix Pills: nixos.org/guides/nix-pills/
    --------------------
    Timestamps:
    0:00:00 Introduction
    0:02:25 NixOS
    0:08:35 Live CD
    0:13:00 Partitioning
    0:22:00 Configuration.nix
    0:53:55 Hardware-configuration.nix
    0:56:00 System Installation
    1:00:35 Installing Packages
    1:21:25 NixOS Extras
    1:29:35 Home-Manager
    1:33:00 Home-Manager Setup
    1:45:28 Home-Manager Configuration
    1:57:50 Flakes
    2:02:10 Flakes Setup
    2:07:47 Flakes NixOS
    2:20:23 Flakes Home-Manager
    2:34:25 Flakes Extra
    2:40:18 Personal Configuration
    --------------------
    Enjoyed the course and want to tip? www.paypal.com/donate/?hosted...
  • Sport

Komentáře • 177

  • @atemoc
    @atemoc Před rokem +108

    Seven months later, this is still one of the best source of help and documentation on NixOS and the environment around it
    Many thanks !

  • @bobbnz
    @bobbnz Před 2 měsíci +5

    Totally demystified some of the simple details that the documentation overlooked and left me scratching my head. Luckily I knew enough to value the power of this system and persevered until I found this video. Love your work Matthias

  • @maurogarcia2012
    @maurogarcia2012 Před rokem +63

    Exactly what I needed to kickstart my journey with NixOS. Thanks a lot, Matthias 🙌

  • @davedwad852
    @davedwad852 Před 11 měsíci +10

    The epic 3hr time tag put me off the feature for too long. This is best configuration focused overview I have seen - time well spent. All of the action with none of the drama - perfectly pitched level of detail. 5 stars. Thank you Matthias!

  • @zerquex4520
    @zerquex4520 Před 2 lety +8

    This is the best NixOS tutorial I have found, thank you for this this.

  • @AmirHosseinHonardust
    @AmirHosseinHonardust Před rokem +2

    Thank your very much. I tried nixos a year ago. Flakes caused me a loooot of confusion and frustration. Your video is a fresh breeze!

  • @facepalmguy6183
    @facepalmguy6183 Před rokem +3

    I second what everyone is saying. Great video, I'm usually very wary of video guides. Really nice that you included a short list of useful resources outside of this video as well.

  • @zinoubensalah8939
    @zinoubensalah8939 Před rokem +2

    you have no idea how much i needed this, i don't know why i could barely find any useful video about nixos even though it's such an interesting distro, i was looking for a video to get me up to speed with things so i don't have to read every word of the manual. Thank you sir!

  • @adjbutler
    @adjbutler Před 11 měsíci +1

    this is my go-to walkthrough guide to NixOS setup plus extra stuff...

  • @pbear06
    @pbear06 Před 5 měsíci +2

    It is a very interesting and complete guide for beginners. One of the most complete I could find on yt. Thank you, fellow compatriot.

  • @TheStuzenz
    @TheStuzenz Před rokem +10

    Thanks Matthias, this was really good. I think I have had NixOS running for about a year on a couple of machines. It is amazing how much I still learn from watching this start to end for what I think was a second time today. Many thanks!

  • @Psoewish
    @Psoewish Před rokem +4

    I've been slowly chipping away at this video over the past few days because it certainly is a lot of information all at once, but I can say that this is going to give me a massive advantage once I sit down and start building my system. Thank you for the incredible resource!

    • @zinoubensalah8939
      @zinoubensalah8939 Před rokem

      i still come back to it every one and then, flakes get me confused.

  • @Karlzzzy
    @Karlzzzy Před 11 měsíci +3

    Thanks, Matt!I can use nixos very well now.I can find no perfect tutorial like this on anywhere else that exits on this universe:

  • @teuluPaul
    @teuluPaul Před rokem +9

    Matthias: Kudos to you for a very well explained video. I was a little cautious to watch it when I saw how long it is, but it is definitely worth it! I am now in the process of configuring my Thinkpad with NixOS following the principles shown in this video. I have subscribed - I look forward to seeing what you produce in the future! Many thanks (donation on its way!).

    • @matthiasbenaets
      @matthiasbenaets  Před rokem +2

      Great to hear you found it educational Paul. Have fun configuring your system. Thank you very much for your generosity!

  • @milohoffman274
    @milohoffman274 Před 11 měsíci +2

    This was awesome. I watched the whole thing. As an experienced Linux user dipping a toe into nixos this clearly answered almost every question I had about getting started and how to do the sort of things I normally do in other distros.

  • @ViniciusProvenzano
    @ViniciusProvenzano Před rokem +3

    Great content! Specially the flake and multiple hosts configurations was highly appreciated!

  • @maxreuv
    @maxreuv Před rokem +1

    Likely the best OS guide ever

  • @chrismarshall4904
    @chrismarshall4904 Před 11 měsíci

    I wish i could like this video multiple times. This video was immensely helpful for a confused new Nix user.

  • @manuelfragner2724
    @manuelfragner2724 Před 2 měsíci +2

    Thanks a lot! Great resource to start on NixOS :D

  • @n3xistence
    @n3xistence Před 6 měsíci

    Absolutely incredible video! There have been a few changes since this video was uploaded but they are sufficiently documented so this video remains an invaluable resource to anyone starting with NixOS. Thank you so much for your diligent work!

  • @VoidOfTheMachine
    @VoidOfTheMachine Před rokem +1

    this is the best video on NixOS I've found, you've done such an amazing job. Thanks m8

  • @davidwayne9982
    @davidwayne9982 Před rokem +2

    I work with Debian a lot- and do lots of thigns with it- but never anything like NIX--- I'm keeping this and going to study it part time and practice til I CAN do nix. I like the immutable and containerized part--- and I think that's the way things are going to go.

  • @TheStarrs7679
    @TheStarrs7679 Před rokem +2

    Really fantastic video! This helped me get going on my NixOS journey. So far I really like it!

  • @c1dk1n
    @c1dk1n Před rokem +1

    This video is an incredible gift. Thanks for sharing your time with us

  • @simon_wolf_
    @simon_wolf_ Před 2 lety +15

    That is an amazingly good video, thank you Matthias. I’ll be re-watching it in chunks whilst I modify my system but it is the clearest explanation of Home Manager and Flakes I’ve seen. A follow-up about nix-shell would be wonderful (I’m going to try to define shells for each development project I work on).

  • @ChrisMcDonough
    @ChrisMcDonough Před 2 lety +1

    This is exactly what I needed to cozy up to NixOS, thanks!

  • @keeganm9184
    @keeganm9184 Před rokem +2

    Great tutorial, thanks! I love this paradigm for package management.

  • @merlingt1
    @merlingt1 Před 11 měsíci

    Excellent intro guide. I wish I had seen this 2 months ago when I started looking into NixOS.

  • @whereistheline8964
    @whereistheline8964 Před 2 lety +3

    Thank you for this Tutorial and the link to your repo. It helps me a lot to move my homelab to nixos

  • @donaldwilliams6821
    @donaldwilliams6821 Před 2 měsíci

    Great video!! When I build a base system especially a VM template I enable flakes in the configuration.nix :) Glad that flakes will finally no longer be experimental next release

  • @taffitov
    @taffitov Před rokem +1

    Thanks a lot for this wonderful video. It really helped to understand all the relations between nix, nixOS, flake and home-manager. I want to use it on an Ubuntu to mainly manage my dotfiles. Thanks for the video and all the useful tipps and hints.

  • @theostalproject
    @theostalproject Před měsícem +1

    i would be so lost without this video

  • @CraigOlson
    @CraigOlson Před rokem +1

    thank you for your contribution to the community. while flakes are completely mystified to me, i at least understand the majority of the premise NixOS. Cheers!

  • @anonymouscommentator
    @anonymouscommentator Před rokem

    this is exactly the type of video i needed to get started with nixos! thank you so much!

  • @le_chronicc
    @le_chronicc Před rokem +1

    Awesome video. This video definetly helped me with the decission to give nix a try for my workstation.

  • @chatterman3148
    @chatterman3148 Před 2 lety +2

    Best NixOS tutorial , well explained , thanks.

  • @norgeball3971
    @norgeball3971 Před 2 lety +7

    Thanks for your amazing tutorial, it is a great intro for users new to the nix ecosystem. I just switched to NixOS, it is a great project with a powerful concept.
    I am going to use your tutorial to ditch systemd-boot for GRUB. I just need that configuration limit, otherwise my bootloader will soon look very atrocious 😅
    And I will most definitely come back to your video for future configuration reference!

  • @eduardojorge4762
    @eduardojorge4762 Před 2 lety +5

    This was a brilliant tutorial. Thank you!

  • @JonathanLucas-cr5nu
    @JonathanLucas-cr5nu Před rokem +1

    ohoh, I will sit down and watch it over! NixOS configuration has confused me for a long time.

  • @alpha001
    @alpha001 Před rokem

    The best! thank you for made this! Really well explained and understandable :)

  • @unclefester9113
    @unclefester9113 Před 11 měsíci

    Three Hours... My brain's already hurting. WoW

  • @SMOKE3104
    @SMOKE3104 Před 7 měsíci

    This was extremely helpful!!! I have been trying to configure nixox for a few days now and have constantly restarted because the error messages really don't help. The big help was with imports. I am trying to modularization my config and has several import issues. I am still trying to get it all working.

  • @cppandjavaandkotlindev

    thanks i just switched to nixos yesterday and this is the perfect tutorial

  • @StrelokRadist
    @StrelokRadist Před 2 lety +3

    Great tutorial! Thank you very much!

  • @TheNutrivore
    @TheNutrivore Před rokem

    Thanks for this! This was extremely educational!

  • @user-zt3vr3hs7u
    @user-zt3vr3hs7u Před měsícem

    52 zeros man! Great introduction into NixOS. Cheers!

  • @YuLi-ot6go
    @YuLi-ot6go Před rokem +1

    Great stuff, learned a lot. Thank you for this video!

  • @felt505
    @felt505 Před 2 lety +2

    Very helpful. Thank you for sharing.

  • @cookiedestroyer402
    @cookiedestroyer402 Před 2 lety +7

    wow this is amazing thank you

  • @raunakchhatwal5350
    @raunakchhatwal5350 Před rokem +1

    This helped massively, thanks!

  • @bluk
    @bluk Před rokem

    Thank you for providing a useful guide!

  • @hallo8D
    @hallo8D Před 11 měsíci

    Das video war richtig horizont erweiternt und ich werde mal versuchen meinen PC auf reines nixos + home-manager + flakes um zu bauen ^^

  • @mdlsvensson
    @mdlsvensson Před 10 měsíci +1

    Thank you so much for this!

  • @tandaramandaraba
    @tandaramandaraba Před rokem +1

    one and only normaly explain on yt, what the fuck is nix and nixos :D thanks man!

  • @GekoPoiss
    @GekoPoiss Před 2 lety +5

    Great tutorial! In vim, . repeats the last command - so you could type one '0' and then issue 51 . in normal mode instead of typing 52 zeros

    • @matthiasbenaets
      @matthiasbenaets  Před 2 lety

      Thanks. very neat indeed but I guess didn't lose too much time considering the length of the video 😅, but definitely one to remember

    • @lesmpt
      @lesmpt Před 2 lety +3

      or just press 52a0

    • @bibanez135
      @bibanez135 Před rokem

      @@matthiasbenaets Vim grindset be like

  • @deadbeef2482
    @deadbeef2482 Před rokem +1

    thank you Matthias! very helpful

  • @masterchief1520
    @masterchief1520 Před 2 lety +1

    Nice. Keep pushing more nix content please 🥺

  • @johannhuman532
    @johannhuman532 Před rokem

    Thank you so much. I finally was able to install a package.

  • @mrgeebee1622
    @mrgeebee1622 Před měsícem +1

    Great video! 👌

  • @sbbu3742
    @sbbu3742 Před rokem

    this was extremely helpful, thank you

  • @user-qf4yi8zx9x
    @user-qf4yi8zx9x Před 9 měsíci +1

    This is a really detailed presentation Matthias. Of course some of the stuff is not really relevant any more. Do you envisage a flake-centric redux? but yes, far away one of the best introductions.

  • @OpenSingularity
    @OpenSingularity Před rokem +1

    thank you for the concise and informative explanation! I have a question regarding the Nix package manager: If an application is installed using the Nix package manager, does it have any impact on its runtime performance after it initializes?

  • @toger42
    @toger42 Před rokem +1

    Really helpful! Thanks a lot 😁

  • @user-vw2qt8vp8e
    @user-vw2qt8vp8e Před 23 dny

    thanks alot for this awesome video man

  • @cabezachumbosampedro8038

    Thank you so much, very good guide.

  • @nssSmooge
    @nssSmooge Před rokem +1

    This is so god damn great nix os introduction to its config, like best I have seen so far, at least from my point of view. Thank you.
    On side note, did you ever get 'Cycling flue'? Ever since covid, when I go cycling, i feel like I have mini flue for few days after - a lot tired, hot eyes.

  • @Redyf
    @Redyf Před rokem

    YES, i finally figured out how to make my bspwm work thanks to your video. I had to create a syslink like this 1:55:19

  • @ryans.585
    @ryans.585 Před 11 měsíci

    Nice video, thanks a lot!

  • @ronichoudhury
    @ronichoudhury Před rokem +1

    Great video. Danke schön!

  • @sherifabdalla
    @sherifabdalla Před rokem +1

    Brilliant. Thanks

  • @PhatDildokhunty
    @PhatDildokhunty Před 10 měsíci +1

    "Unbreakable" you say? Nods... challenge accepted!

  • @chloe-sunshine7
    @chloe-sunshine7 Před 10 měsíci

    1:13:30
    There's more in the flakes section. Sorry I missed the timestamp. Hopefully we'll find it easily. Good luck, buddy!

  • @diegonayalazo
    @diegonayalazo Před 2 lety +1

    Amazing thanks!!

  • @alt-chan-
    @alt-chan- Před 2 lety +4

    Nice video dude, when I started tinkering with nixos I struggle a lot to understand some of the concepts you teached, so this video really helps a lot of people to understand on how to configure the system.
    I have a question tho, normally I only have 1 user per computer, similar to you, however, what if I want to use more than one user?, how could would you organize the nixos-config folders?

    • @matthiasbenaets
      @matthiasbenaets  Před 2 lety +4

      Good question.
      So by default, the option 'users.users' gets generated in configuration.nix .
      Here you state your user, user-type and the groups. The users.users option allows you to create multiple users.
      An example:
      users.users = { user1 = { isNormalUser = true; extraGroups = [ ''wheel'' ]; }; user2 = { isNormalUser = true; extraGroups = [ ''wheel'' ]; }; };
      For home-manager you can pretty much do the same with home-manager.nixosModules.home-manager.home-manager.users = { user1 = {...}; user2 = {...};}; For standalone it should just work as normal but for each login if I'm not mistaken. The latter I've never tried.

  • @zerquex4520
    @zerquex4520 Před 2 lety +2

    Respect 👍

  • @counterdutch
    @counterdutch Před 2 lety +1

    tyvm explaining nixos

  • @johanb.7869
    @johanb.7869 Před rokem +2

    It's now much easier to install NixOS because the latest iso has the Calamares installer.

  • @cosmusmutua1083
    @cosmusmutua1083 Před 2 lety +1

    Top shelf stuff

  • @jeromegay9865
    @jeromegay9865 Před rokem +4

    Hi Matthias, many many thanks for this great tutorial, it really helped me getting started with NixOS (in a VM for now), I've just added an encrypted ZFS partition with reset of the root at each boot (the infamous 'Erase Your Darlings' by Graham Christensen).
    I still have a question though, when I upgrade my system (based on your approach, using flakes), do I have to use sudo, i.e., 'nix flake update' or 'sudo nix flake update'?

    • @matthiasbenaets
      @matthiasbenaets  Před rokem +1

      Thanks, you do not need root privileges to update the flake's lock file.

    • @jeromegay9865
      @jeromegay9865 Před rokem

      @@matthiasbenaets thanks I was a bit confused, I indeed ended up have a lock file owned by root as you did in the video. Thanks again for the help and support.

  • @EdwardCrosby
    @EdwardCrosby Před 9 měsíci

    All of the basic information in this video for setting up NixOS was hugely instrumental in my switch to NixOS. Thanks!
    Also, what is that software you used for creating the Table of Contents and content guide for the video?

  • @alesvojacek7303
    @alesvojacek7303 Před rokem +1

    Thank you a lot. I find you because of Proxmox :) But it seems, that second VM in Proxmox will be NixOS :-D Thank you again grat video

  • @logauit
    @logauit Před rokem

    thank you for this great tutorial!
    a bit off topic, for inserting 50 “0”, we can do
    esc 50 i 0 esc esc

  • @muffinmuncher
    @muffinmuncher Před 11 měsíci

    what markdown extension are you using in vim?

  • @acesintra610
    @acesintra610 Před 9 měsíci

    god bless this video

  • @donjude9585
    @donjude9585 Před 24 dny

    Whada a trip... Choose video thinking... new ways to catch a NOS buzz & ended up installing Nix Linux.
    Many comments refer to this video filling gaps in documentation.
    Please remember that this is FOSS (Free Open Source Software), community developed. Community is you & I too. If there's gaps in the docs, Please - write-up what belongs there & submit it so those gaps in docs are correct for the next person who refers to them.
    Remember... Only you can prevent forest fires 🐻 and correct NixOS documentation.

  • @popolyann
    @popolyann Před 8 měsíci

    excellent thanks ! on home-manager standalone installation, i've get redo of the error:file 'home-manager' was not found in the Nix search path by launching nix-channel --update with elevated privilege anyway thank !

  • @plamensecond2579
    @plamensecond2579 Před rokem

    Thanks for the comprehensive tutorial! Also, can you please share the color scheme used in you vim config at 2:41:02?

    • @matthiasbenaets
      @matthiasbenaets  Před rokem

      srcery-vim for the syntax. wombat256 for the lightline

  • @Microphunktv-jb3kj
    @Microphunktv-jb3kj Před rokem

    2:56:55 - how are you making those tree structure things in ur files?
    does nix have linter or formatter?

    • @matthiasbenaets
      @matthiasbenaets  Před rokem +1

      I'll try to answer a couple of questions from your other comments as well. So the tree is done manually since I only do it for the initial routing (not for all modules). It's not really a big hassle. You can use an lsp like the package "nil". You can then just navigate through a flake using the imports. To my knowledge there is no language server that take into account the different options. "nil" for example will complete builtins, attrsets and some keywords. Maybe rnix-lsp does it, but I've never tried it. I can't find your initial comment anymore about package rebuild but you will indeed need to rebuild and switch to the new config when you edit the files. First declare it, then install the config. If you don't want to do this and want to just quickly use a package use a shell or use nix-env.

  • @CodeMonkeX
    @CodeMonkeX Před 11 měsíci

    Still finding this useful in 2023. BTW I am not sure if this is new, but when I did the sha256 step when moving to a Flake, I did not have to enter 52 zeros. I just left it blank and nix assumed it was zeroed out.

  • @yehoslavrudenco4549
    @yehoslavrudenco4549 Před rokem

    A really wonderful video! I just have one problem, why not using vim to its potential :(( inserting 52 0 would be as easy as typing `52i0`

  • @wisnoskij
    @wisnoskij Před 11 měsíci

    This overlay thing is still really weird. Is Nix not a package manager but a build system?
    It sounds like overlays are just overwriting variables, but all you are doing to get new discord is setting a variable with a URL to the source code. Which implies that Nix inherently knows how to build from source like the AUR. So is Nix, like Gentoo, a source based distro? Am I building form source when I add a package? Or do they just add in building instructions for no reason other than overlays? Also, are we just assuming that the building instructions/requirements will be identical for different versions and patches?

  • @views8962
    @views8962 Před 8 měsíci

    @1:52, Did you say that things could potentially break when programs change their configuration paradigm. That makes sense since home-manager would have to reinterpret this new way into home-manager (in nix expression language).

  • @coldiskit3581
    @coldiskit3581 Před rokem

    Hello and thank you for your great tutorial. Sorry but i just wanted to know, what is your tool at left of the screen please?

  • @matcraftou
    @matcraftou Před 11 měsíci

    Hello, this tutorial is.. just too good..
    Also: can you please share the document that is at the left of your screen?

  • @braaitongs
    @braaitongs Před 4 měsíci

    If you have a laptop and have a built in gpu. is there anything to specify in Nixos in the configuration.nix?

    • @matthiasbenaets
      @matthiasbenaets  Před 4 měsíci

      depends on the gpu. if it's amd, add the amdgpu kernelModule and videoDrivers. for nvidia, I recommend having a look at the unofficial nixos wiki and it nvidia article. you will need to enable nvidia prime. intel is pretty much built into the kernel.
      if its a popular laptop model, also have a look at the nixos/nixos-hardware github repo. it's possible someone else did the hard work for you, and you can just import the existing config from there.
      also don't forget to enable opengl.

    • @braaitongs
      @braaitongs Před 4 měsíci

      @@matthiasbenaets , cool, ja it is an intel gpu that is built into the cpu. it is intel HD 620.

  • @TheStuzenz
    @TheStuzenz Před rokem

    Matthias, how stable is unstable? Any issues? I have normally gone for the latest release - but not unstable. I switched over today though - on the basis that it should be okay - and that if the system has a problem I can most likely go back to a previous generation.

    • @matthiasbenaets
      @matthiasbenaets  Před rokem

      Hi Stuart, I never had any system breaking issues with unstable. Honestly the only issue I can recall are from non system essential packages that were updated by a bot where the dependencies needed to be updated and some random bug with bluetooth (which there was a fix for quite quickly). As long as you don't collect garbage, just pin packages or just save a lock file, you should be fine.

  • @colinchichester1809
    @colinchichester1809 Před 10 měsíci

    Was planning on toying with this in a VM several months late to the party but this still looks informative. Was I the only one at 2:17:01 shouting you forgot your end quote (on the sha)?

  • @alesvojacek7303
    @alesvojacek7303 Před rokem

    I'm trying Plasma instalation on Proxmox guest (Spice display driver) and the screen does not resize for Spice console :-( is there anyting to do or I have to use anothere instalation or different iso?

    • @matthiasbenaets
      @matthiasbenaets  Před rokem

      Unfortunately I'm not really of much help here since it has been a while since I used spice. My first guess would be that you are missing the drivers or the spice agent is not running. Maybe try setting up the option 'services.spice-vdagentd.enable'.

  • @cryofwill1416
    @cryofwill1416 Před rokem

    I want that rice 😭 it looks so good

  • @juanerasmog
    @juanerasmog Před rokem

    What package do you use to have syntax highlighting for nix in orgmode?

    • @matthiasbenaets
      @matthiasbenaets  Před rokem

      I use doom emacs. Just uncomment nix under :lang in your init.el, sync and add a nix source block inside your org file