NixOS: How it works and how to install it!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello YouTube it's durian thanks for tuning in to dot slash now I've been asked several times to review NYX OS and I had a look at it a while ago and because it's so different than the usual distro layout and how distros essentially work I was a little apprehensive on getting into it but I thought I would give it a try and I've been using it for a few weeks now while it looks like a typical distro with a standard desktop there's a lot more going on under the hood in this video I'll cover what it is installation and a review of how it works and how to use it so let's get started [Music] first things first let's have a quick comparison of how packages work a package is basically an archive with files inside like a zip file or a tar file but it contains more information within it as well this for example is what's within the norm control center package it has a whole bunch of files it will be installed in different locations throughout the disk and all these files are the package whether it be a service or an application a traditional package manager will download the package and extract the files where they need to go other tasks may be to restart certain services or make changes to various files or settings the problem with this is if you upgrade a package it will download the new package and then overwrite the old versions of the files if for some reason one or more of the files only gets partially overwritten because of a power outage or a random glitch then those files out of the package will be corrupt depending on what this file is it can make that executive will not run or the configuration file incomplete or invalid this can then cause the other files that depend on it to not function either and possibly make the entire package cease to function if that package is a dependency for other packages then you're gonna get a domino effect and these also won't function and this is a major problem if any of these affected packages are required for the system to boot up properly and this is how the NICS package management is different and what makes it so great the files on your hard drive where package files are normally found are actually symlinks symlinks are like shortcuts or pointers to the location of the actual file which is stored somewhere else so when a package is installed these sim links point to the real location of where these files are stored this location is called the NIC store which I'll demonstrate to you after the installation as far as the operating system is concerned these sim links are the actual files there's no difference this is where the advantages of NICs comes in in NICs if you upgrade a package the new package files will be extracted in a different location which does not overwrite the previous version of that same package then although symlinks are simply pointed to the new version of the files this upgrade process creates what nyx calls a generation this is also what you would call an atomic upgrade pan you can roll back and roll forward through the previous generations if for some reason one of those files are corrupt or one of the sim links isn't created properly due to some failure like again a power outage then you can simply just roll back to the old files because they still exist by reverting back to an old generation and then you can try running the upgrade again this will leave your system fully functioning no matter what because you can always roll back to a previous generation but if the upgrade goes smoothly you just carry on with the new versions and then you can eventually have the old packages either manually or automatically deleted and this can happen over and over again saving as many previous generations as you want the only downside to this is that it of course takes more harddrive space which is why you should sometimes clean out the old generations now this is a very simple breakdown of how it works and I'll actually show you on the system where those files are stored and how they are kept separate from each other but Nix OS is completely different it takes the power of the Nix package manager and it applies it to the entire system just like I explained earlier you have a package or packages that the Nix package manager will take care of the Nix package manager runs inside of Nix OS but it can also be installed in any distro such as debian Arch or anything it can be installed in any distro very easily by running a simple terminal command and I'll cover that another day today we're talking about Nix OS now within Nix OS you have two ways to manage packages the standard package manager acts the same as it will in any other distro you install it in but will install packages for a single user to use so different users can have different packages installed that won't interact with each other and then there's the Nix OS configuration file which is system-wide and is written in a functional language but don't worry it's not hard and I'll go through it with you during the installation part this configuration file will dictate what packages are installed on your system what desktop what applications what bootloader what services are running and so on and these packages are global for all users this configuration file is the same one you will use for initially installing the system as well as making changes afterwards the great thing about this configuration file is you can setup your system just how you want it and then make a copy of it somewhere then you can put this configuration file into a new installation and it will install the same packages in a brand new system essentially cloning the system that you had previously this is also great for restoring your system should you want to wipe it and start fresh but not have to reinstall everything manually using the same configuration file in multiple systems will ensure that all those systems have identical packages and now let's get on to the fun part and that's installing it now this is a little different than installing any other distro and at first I was a little lost I was you know following the instructions and once I realized you have your configuration file done you can just reuse it over and over you can change things up you can experiment without having to worry about wrecking your system it made it that much more interesting to me because I could pretty much try whatever I want and even if I mess it up I can just roll back to my previous configuration and it'll work just fine like I've mentioned you can use your configuration file pass it to other systems and reproduce it as many times as you want so this is the Nix OS website there's a couple of things in here that I'm going to want to show you one being if you click on learn it has a lot of stuff on all the different things once you're set up and once you're in your system you want to scroll down here and click on Nick spills so this is almost like little little tutorials little courses where you can follow along from start to finish so you just sit there and pick a subject and then hit next next to move along all the way through the complete tutorial of what everything does you might not be interested in using everything there's a lot of things where I'm not interested in it but it has everything you need to learn the system and to get started and to expand on your system what we really want here though is the big green download button and like I mentioned earlier you can install the NICS package manager in any distro including the Mac which is interesting just by running this command but we don't want just the Nix package manager we want Nix OS the complete distro there's a couple of options here the graphical live CD which is what I'm going to use and it uses plasma as the desktop environment and then there's minimal installations bringing is the graphic one is just easier for several reasons it has gparted which if you want to use that instead of using terminal commands you can graphically edit your disk and you can also follow along on the manual which if you click right here it has the complete manual on how to install from start to finish including some customization and everything setting up your desktop drivers etc so this is also on the ISO which means as soon as you boot up the live environment you don't need to even be connected to the internet to be able to go through the manual which is great now I'm going to fire up the virtual machine I already have the ISO mounted on the virtual CD I'm going to enter the live environment here we are at the desktop it does take a while for the live ISO to load I'm not sure why so if you're staring at a black screen for a little while don't worry about it just let it finish and you're good to go of note I'm going to just be covering installing on a BIOS system just with an MBR partition you can also install this on a UEFI system but I'm gonna cover that in a different video I have another laptop with Debian and Nix OS installed under EFI dual booting and it works great but for now just to keep it simple we're just gonna carry on with installation getting you up and running this works great in a virtual machine by the way if you want to test it out see how well it runs do all your configurations and then you can actually copy your configuration file to a system that is running it on Hardware to basically duplicate what you have in your virtual machine which is fantastic so you'll notice one thing here is that there's no install program because it is manual so you have gparted the console which is the terminal for plasma and then the next OS manual so I'm going to open up the NYX West manual and we'll get started now this is a virtual machine which means I do have internet access through my host system however if you're running this on Hardware make sure your Ethernet is plugged in and you can also load up your Wi-Fi connection I can't do it here because it's a virtual machine but you can connect your Wi-Fi that way you also have internet access we can skip the first few few parts of obtaining NICs OS because I already showed you how to do that and go right into installing it covers all the basics of booting the system networking in the Installer you can click all these links whenever they pop up so you can get more information and we're gonna get to partitioning and formatting here so this is where you're gonna want to know if your system is UEFI with a GPT partition or legacy boot aka BIOS with an MBR partition one easy way of doing this is using gparted as well if you don't want to use the terminal however the manual will show you all the commands to type in in the terminal so I'm just going to show you quickly what you could do with gparted and we're gonna do the terminal portion now again this is a FiOS machine it's a virtual machine there's already a partition here you can just go to Device create partition table you're gonna select ms-dos for by us or GPT if you have an EFI machine if you're trying to dual boot this is when you would want to resize your partition shrink it down and create a new one one of the things you're gonna want to ensure you do is make sure the label matches what is in the manual it will tell you certain things need to be labeled Nicks OS or boot make sure you name it those if you name it something different just remember that when you're following these instructions if you want to use gparted and you don't want to use the terminal at all if you're wiping the system just create partition ms-dos apply it will wipe everything on the disk you can say new partition ext4 and name it Nix OS without a dot next so s it add hit apply and then you're done but I'm going to go terminal I'm going to follow what the instructions say and we'll do it this way I've got a skinny terminal window here so if you right-click the title bar more actions keep above others now you can follow the manual as well as use the terminal at the same time if you're using you a few efi follow these steps so we're gonna skip that and i'm gonna do MV our first thing you're going to want to do is do a sudo su and now your root so i'm basically gonna follow through step by step all these instructions and I'm gonna kind of skip ahead so you're not watching me do all this because basically just follow this and I will comment when I need to comment so this line here in the terminal if you're not aware of how hearted works you're creating a partition starting from one megabyte on the disk and ending before the last 8 gigabytes this is so that you can add a swap partition it'll leave you 8 gigs for a partition this is optional you can make the partition as large as you want it's completely up to you I'm just going to follow the guide and we can always repartition afterwards so again you're seeing this - eight gigs this is talking about the start is eight gigs before the end of the disc and you're gonna take 100% of the remaining space beware typos control see and try again if you make a mistake like I just did primary done and now we format our partitions and give them names so I've done my route and my swap for UEFI if you were to follow the previous section up there for UEFI this is when you'll be adding your boot partition now for installing we're going to mount the root partition that we've created so disk by label this is when you're going to use the labels that you created earlier so if you named it something different use that name if you're using a UEFI system you're going to also create the boot directory and you're going to mount that boot partition into the boot directory but because we're using a BIOS system a virtual BIOS system we skip step two now we enable the swap partition and then the next step it says you need to create the Nix OS configuration file now this does it for you once it's created then we edit it and we do all our magic to tell it exactly what we want in our system so Nix OS generate config route and mount which is where we mounted our partitions so you can see here it created the hardware configuration nix and the configuration Nix this configuration Nix file is the one we're gonna where we're going to tell it what we want in our system the next step it says is to edit that file we go nan-oh Mount et Cie nixel s configuration Nix don't forget the mount if you forget this part you're gonna be editing the configuration file for the live distribution that you're running it now next it's telling us for Biosystems you must set the boot loader grub device to specify which disk grub will be loaded into for UEFI systems you must set bootloader system deep boot enabled to true depending on which system you have it will generate that option for you now just because you have a UEFI system does not mean you have to use system D in fact on my hardware install I did system D to begin with and I changed it afterwards to grub and it worked fine let's have a look at our configuration file and we'll start going through it it's very well commented telling you what you need to do here we have the grub to boot loader section it has enabled grub version 2 but one thing that you have to tell it is this here if you uncomment this here this is what dictates where grub will be installed make sure that the device is the correct one if we open up gparted again you can see the device is slash dev slash SDA and that's where we want to install it don't put a number so that's set now we can scroll down to networking hostname you can leave it as Nix OS you can name it whatever you want this is gonna be your computer's name you may want to enable wireless if you have Wi-Fi but there's something else I wanted to show you as well and I'm gonna put a link in the description I've put a couple of config files up on github just for storage and this is what I did here these lines here in order to enable Wi-Fi to function in the OS these are things that you can always fix afterwards just by reloading the Installer again re editing your config and run the Nix OS installer again I'm going to leave this disabled because it's a virtual machine the rest of these you could leave for now networking proxy and localization you're going to uncomment these lines to set your localization to make sure you have the localization that you normally use for me it's just English us utf-8 then move on down to timezone and set it to whatever you want if you google it there's a whole list of the continents and cities so you could say America Denver there's lists of what you could set within Linux depending on what time zone you're in so just have a look at that and then set your time zone accordingly this next part is where some of the magic happens uncomment this this and this now anything between these two square brackets here are going to get installed into your system these packages and they don't all have to be in a line if you want to make it a little nicer to read you can make it separate lines like this so I'll go nan-oh Genie and Firefox for now just to get started next we have s UID wrappers which isn't really needed right now services that you want to enable if you want to enable OpenSSH you would uncomment this by enabling something such as OpenSSH not only will Nix OS install it but it will also ensure that it runs so these are quick little one-liners that will get things going firewall for now I can skip print services with cups we can skip this is just to get you started here so I'm not going to enable everything I just want to get us to a working desktop enabling sound is another option you'll probably want if you're loading up a graphical environment but if you load something like plasma or gnome the sound is already enabled but I noticed with xfce I had to enable this in order for the sound to work next thing is enable the X windowing system so uncomment so it's true X server layout us I can leave it like that enabling touchpad support and enabling the KDE desktop environment let me just scroll this up a little bit here so I can uncomment this uncomment this and it will install SD DM as the display manager your login and then plasma five as the desktop but there are other options as well such as gnome so for here you would put gnome 3 or Pantheon if you like the elementary OS desktop but for now we're gonna do xfce and I'm gonna change the display manager to like the M the next step and pretty much the last step you want to do is create your users just uncomment all these lines and then change Jane to whatever you want for your user name Dorian here you can also add other groups that you want that user to be a part of so this and that but for me wheel is good enough that lets you do sudo and that's really all I need you'll notice one thing here that I'm not setting a password that's something that you have to do when you first boot up the system now I think this is good enough to get us started to save your configuration in nano hit ctrl o enter and then ctrl X to exit if we go have a look at our instructions here it talks about doing some configuration with networking file systems etc but I've done everything here in order to get a desktop going installed grub a couple of packages set our user set the desktop environment and the next step is just just to run Nix OS install so let's do it and now this is why you want your computer online as well this part coming up it's gonna build the entire configuration it's going to start copying all the packages that you've requested onto the disk and it's also gonna download new packages from the internet and copy them into the partitions and once it's all done it's going to start building everything together so you can see here this part here is copying files from the ISO this other part here is downloading from the internet and once it has everything it means it's gonna build everything and configure grew up and that's gonna ask us for a root password and then we're done now it's all done grub has been installed on SDA as we want it and now we set the root password installation finished now it's just a matter of shutting down remove your USB or remove the virtual disk from your virtual machine and boot it up we see grub that's always a good sign and here we are at the login screen but now don't forget we didn't set the user password yet so just quickly hop into the terminal here if you're on hardware just do alt ctrl f3 but for using a virtual machine I have to use this and then login using root and the password that you set at the end of the installation then we're gonna do pas swd the user that you set up and then give that user whatever password you want hit exit and then do an ultra low f7 to get back to the login manager now enter in the password you just set and you get to your desktop I'll just change the resolution here and now we can have a quick look at adding and removing other packages if you remember earlier in the video there's two ways of installing packages there's the nix package manager and the configuration file the NICS package manager installed things for the user and the configuration file is system-wide so let's start with the configuration file you need to use sudo to edit this configuration file sudo nano ECC Nick so s configuration nix enter your password and you're in the file this is the exact same file that you've created when we were installing it and here you can make whatever changes that you want and then just rebuild it on the fly you remember down here I had set nano genie and Firefox as packages don't want it installed if I go to my applications list I have genie and I have Firefox because I said that's what I want it so it's super easy to just tell it what you want and it installs it another thing with the users is if you want more than one user scroll down to the user line you can simply copy paste ignore the warning and then change it to a different user so I want a guest account and I don't want it to be any of any extra groups I don't want it to be able to use sudo so I'm just gonna comment that out because I don't want them to have permissions to do anything and at this point you could even change your mind and come up here and change it to plasma 5 + SD DM or G DM + gnome 3 and it'll just swap out your desktop but let's look at changing some packages because there's a couple of ways of doing this and there's a couple of little tricks for example I of course want some theming so I'm gonna say Ark theme and I want some icons so I will say fires icon theme and so we can stick with that for now but how do you know what the packages are well let's look at the other window here in the terminal on the right I'm going to use the NYX package manager instead of the configuration file just to show you a few things so the next package manager is NYX env some of the options which you can find in the man page or on the website are - Q which will list all the packages that you have installed as a user I don't have any because I've installed everything system-wide now if we do that again but we add an A so we're gonna query available packages now I can just see if that package is there and it's gonna search now the QA switch when you're searching is a little slow that is one of the downsides but it works and we'll see if this is available so as you can see indeed the Ark theme package is available and it'll be followed by a version in this case they used a date now if you don't know the whole package name like I like to use a whisker menu because I'm I'm not a fan of this menu I prefer using whisker menu if you want to search you need to use wildcards and they are a regex search so I'll just show you so you're gonna do a single quote dot star whisker dot star single quote so whatever you put in here is what its gonna search for so let's do that so you can see here xfce for whisker menu plug-in just like any other distro is available so let's paste that in here and then we're gonna do ctrl o enter to save and ctrl X so the configuration file has been changed and now we're gonna rebuild it so we're gonna go sudo nix OS rebuilt and switch to switch into the new generation when I hit enter it's gonna fail and I'll tell you why after so you can see here it couldn't find this package even though it does exist if you go over here again and we're gonna add a key so I want to see what the whole path is for this package it's going to show you something a little different because the XFC for whisker menu plug-in falls under xfce as you can see here next OS xfce XFC for whisk remain you plug it it's the same with any no map Lakai shion's or plasma applications you'll see it falls under like a parent so let's edit that again and I'll show you how it not quite so straightforward now over here it's telling us it's Nick so xfce however it is not it is actually packages dot xfce dot so whenever you see the beginning being Nick so s dot just replace it with packages dot not exactly sure why that's just the way it works when you're editing the configuration file and once you remember it's super easy to you know just do this search again and paste it in and you're good to go and again the great thing about the configuration file is once you have it set you can save it and duplicate it so you don't have to do this stuff over and over you can just fine-tune your system and then have it exactly how you want and you don't have to change anything ever again so we're gonna again save it and we're gonna rebuild and let it do its thing so now with the new packages that I've asked it to install it's going to download them install them and then update grub with a new generation that we can boot into it's finished it's updated the to menu everything is good to go but before even rebooting I can show you here if I go to panel preferences I'm going to do a bit of customization go to my items and I'm gonna add whisker menu it's already there I don't have to reboot probably should because you could see there's like there's the icon missing but it is there it does work as it should and also I added the arc theme which means I can go into my settings appearance art darker icons papyrus window manager art darker so there you go my themes are already there everything is set and I could start changing it right away so let's do a little demo here I'm going to restart I would of course customize this a little more but I want to show you grub so now having a good look at it here if you go down to all configurations and hit enter you'll see there is configuration 1 which is our initial installation and configuration 2 which is the rebuild that I did that added those themes and whisker menu so let's boot into configuration 2 now if you just pick default it will just pick the latest configuration automatically log back in and it's set just how I had it now at this point we have a system up and running you know how to add packages remove packages there is a lot more for me to cover and I can't cram it all into one video so there's gonna be a part two maybe more will see more things that I need to cover are the user installations the NYX store how all the packages are kept isolated from each other where they are stored how all that works as well as exploring the different desktops I've shown you xfce here and how to customize a little bit we saw plasma during the installation on the live USB but there's also gnome which is my favorite as well as the Pantheon desktop so if you're an elementary OS fan or you just like anthe on desktop you might want to check that out as well I'm also going to cover other things such as system D using UEFI and dual booting as I mentioned earlier I have another laptop it is UEFI and I have Debian and Nix OS on it dual booting using grub so I'll cover that a lot more on my next video so stay tuned to my channel I'm really enjoying NYX OS I have a couple of installs here I will be putting it on hardware eventually but for now I'm just playing with it in virtual machines and then I can copy my configuration file onto hardware and set it up exactly how I have it which is fantastic that's one of the things that talking about that makes this so great and this is very similar to Fedora silver blue the atomic system how you can always roll back and nothing ever gets lost or unbootable but this is a very different way of doing things which I'm really enjoying another thing I wanted to point out here is in the next video I'm also going to cover installing different pieces of software that are non free as well as flat packs which you can do for sure in Nix OS I know I haven't posted in a little while guys I've I took the contract overseas to do some work and I kind of got stuck here due to kovat not done yet I had a lot of issues timewise with a busy schedule as well as the hardware that I don't have to work with here so I got myself a headset I've got myself enough to do some recording and upload the stuff to youtube but I'll be very happy to get back home and get back to my regular equipment and my regular setup so I can continue doing videos but until then I will make do with what I have now don't forget to hit subscribe don't forget to hit the bell so you get notifications when I come out with new content and if you like the video go ahead and click on like and share it on your social media thank you so much for watching if you'd like to contribute to my channel to help me contribute to the Linux community head on over to patreon comm you can send me a dollar a month I'm more than happy to just receive new subscribers and likes on my videos with that a big thank you to my past present and future patreon patrons that's all for now youtube til next time bash on [Music] you
Info
Channel: DorianDotSlash
Views: 143,021
Rating: undefined out of 5
Keywords: nixos, nix, nix-env, nixos-rebuild, nix packages, package management, atomic, distro, review, install nixos, install nix, install, installation, nixos install, immutable, gnome, nix os, nixos review, nixos configuration, nixos minimal install, nixos package manager
Id: oPymb2-IXbg
Channel Id: undefined
Length: 33min 44sec (2024 seconds)
Published: Wed Jun 10 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.