 Today, I'm going to be taking a look at a very different kind of GNU slash Linux distribution and that distribution is called Nix OS. Now Nix OS does have some similarities to GNU Geeks, which is a distribution that I took a look at a couple of months back on the channel. There are some differences between Nix OS and GNU Geeks and I'll talk about those differences when we get to them, but in many ways they both follow the same kind of design philosophy and that they both are reproducible distributions. What does that mean? Reproducible. Well, kind of like with GNU Geeks where you had a configuration dot scheme file that you wrote in scheme, which is a dialect of list. You wrote this config file and that config file told Geeks how to build your system, you know, what to install and how to set everything up. You're going to do the same thing with Nix OS itself. Instead of a configuration dot scheme, you'll have a file called a configuration dot Nix. Now why is this important? Well, because you build your system from this one config file, imagine you wanted to install the exact same Nix OS installations on a hundred different machines. You're right, one config file and there you go. You have that reproducibility. Also, you could version control that config file, you know, put it on your GitHub or your GitLab, kind of like you do your dot files. Basically your entire operating system could be controlled by this dot file. And I find that fascinating. In theory, Nix OS, kind of like GNU Geeks, they both claim that they're unbreakable systems. Why are they unbreakable? Because every time you build your system, it creates a new generation. So if you do something in your config file and go to rebuild Nix OS, and for some reason it doesn't build correctly or something breaks, you can fall back to a previous generation, you know, one of the working generations, the older generations. So you should never be able to break Nix OS. So I've actually been playing with the latest release of Nix OS, which is version 2009, it came out just a couple of days ago. And as soon as I saw it released on distro watch, I downloaded the ISO and I installed it first in a VM and then on the laptop behind me. And it's actually pretty easy to set up compared to GNU Geeks. Nix OS is quite a bit easier to get into. And the main reason for that is because Nix OS is not one of the 100% free as in freedom Linux distributions. GNU Geeks uses the Linux Libre kernel. And, you know, it doesn't have any of the proprietary firmware and proprietary blobs in the kernel and everything. And it's hard to get GNU Geeks to work on some equipment. And matter of fact, it's impossible to get GNU Geeks to even install on a lot of the equipment that I test distros on. But Nix OS, just being a standard Linux distribution, meaning it just uses the standard kernel, should work on any device that I want to throw it on. So what I want to do today is run through another installation of Nix OS, this time inside of VM and on camera. So you guys can see the installation process because it is kind of different. But really, it's quite simple if you know what you're doing, because really all you need to do are three things. You need to partition your drives. Then you need to write a configuration file. And then once you have the configuration file written, you just built the system with a simple command. And that's it. But the tricky part is you have to write that configuration file. So let's start here on Plasma. So this is KDE Plasma, the live environment that we boot into. And there's really only three things on the desktop. You got three icons. You have G-parted to partition your drives. Console, which is, of course, the terminal, because we will have to install this using a terminal command. And then we have a link to the Nix OS manual. And we may need to pull that up. But what I'm going to do first, though, is partition our drives. Now, in this VM, I have 25 gigabytes available. I created a 25 gigabyte virtual disk here. And what I'm going to do is I'm going to create probably a 23 gig main partition. And I'll do like a two gig swap. I'll go ahead and create a swap for this. So here in G-parted, I'm going to right click here and I'm going to click on new. No partition table found. So let's create a partition table. So you create partition table. Easy enough. Now I'm going to do MS-DOS because I typically do MBR, Master Boot Record, BIOS stuff. You guys that are doing UEFI, what you would do is you would probably want to choose GPT. But I am going to do an MS-DOS partition table. Now that I've done that, I'm going to right click, I'm going to click new and let's create a new partition. And the first partition, I'm going to make the swap partition. So let's go ahead and profile system instead of extend for, I'm going to find Linux swap and then we're going to give this, I was going to give this about two gigs of space. So that would be 2048 megabytes and then add that. And then you would see we have 23 gigabytes remaining and then I'm going to right click, click new, primary partition is fine. Extend for, yes, let's add that. And then the last thing is one of these drives needs to be bootable. And of course it needs to be the extend for file system. So let's see if we can make this bootable. And I don't think I can make it bootable until I actually apply the operations that we've already done. So let's apply that. All right. Now that it's done that, let me go back to the extend for partition. Right click and now I can manage flags and we need to make sure the boot flag is turned on and that's it. We're done with G parted. Now one thing having gone through the installation twice before that it trips me up every time is according to the installation instructions for NixOS, you should go ahead and label the partitions. So I'm going to go ahead and create a label. So I'm going to label the Linux swap file system. I'm just going to call it swap. And then I'm going to label the extend for file system and I'll just call it MS DOS because that was the type of partition table I had created. Then I need to apply all operations again. Let that run, close that and let's get into the terminal. And let me make the terminal full screen and I'm going to zoom in so you guys can see everything that's going on. Now the first thing we need to do is we need to mount these file systems that we just created. So I want to mount slash dev slash disk slash by dash label. Then I need to specify the label of the extend for partition. Remember I named it MS DOS space. And where are we mounting that to? Well, of course you want to mount it to slash MNT. And of course this needs to be done as root. I don't think I can just SU and get a root prompt because it's going to ask me for a password and I don't know what the password is. But for some reason, if I just run this as SUdu, it doesn't ask me for a password or anything. But if I type SU, it asks me for a password, which I don't know the password. So but I just have to remember every single command that I'm going through. I need to remember to add SUdu in front of it. The next command is SUdu space and then next dash generate dash config. So this should generate our config file for us. You know, a default one. Then do space dash dash root space and then slash MNT. It says Nix generate config not found because I did not type that correctly. It should be SUdu Nix OS dash generate dash config space dash dash root space slash MNT. And I'm going to make this mistake a lot with Nix and Nix OS because there are commands that are just the word Nix. And there are other commands that are the word Nix OS. There are really two Nix's. There's Nix the package manager and Nix OS, which is the distribution. So all right. So that should have generated our config. So now this is where the excitement happens. We need to take that default config that it just generated and actually edit it and get it to install and set up everything for us the way we want it on our system. So I'm going to do a sudu vim. If you prefer nano nano is installed on the system slash MNT because we're still mounted to slash MNT. And then once we're over on slash MNT, the path to the config file is actually slash Etsy slash Nix OS slash configuration dot Nix hit enter. And this is the config file. I'll just page down a couple of times so you guys can see it's not a very lengthy config file and the little bit that is here, 80 percent of it is actually commented out. So these are lines that are commented out, but you can uncomment them. If you need to, you can edit these. And of course, ultimately what you need to do is you probably are going to need to drastically alter this document to get a working system, especially for desktop Linux use. Now on servers, you know, you don't have as much stuff going on. Typically you're not worried about graphical environments and the X server and all of that, but for running Nix OS on the desktop, you probably are going to have to spend some time reading the documentation and taking this config file very seriously. So let's start at the top of this file and I'm going to go down and I'm just going to start on commenting stuff that I obviously need commenting out stuff. Maybe I don't need the first thing you come to is the boot loader. It assumes that we're going to be using grub. We are going to be using grub. It assumes that we're doing a master boot record. So a lot of this stuff that's commented out is EFI boot. Obviously, I just need to leave that stuff commented out, except this very last line. I need to uncomment this line because it's asking boot.loader.grub.device. Where is grub installed to? What device? And it by default, it has slash div slash SDA. But inside virt manager, the first drive is not called SDA. It's actually called VDA. So I need to change SDA over to VDA and let me escape and get back into normal mode. And I'm just going to keep going down. Now, networking, if you want to, you can go ahead and define a host name. So I'm going to uncomment this line. And by default, it's going to assign the host name of the computer to be NixOS that's fine with me. But if you want to change that, feel free to change the host name. The next line, if you're doing this on a laptop or a machine that requires Wi-Fi, you probably want to uncomment this next line. It installs WPA supplicant for you and takes care of that Wi-Fi networking for you. On this machine, I'm doing ethernet, so I don't have to uncomment that line. The next line is time zone. I definitely need to change this because by default, it was set to Europe, Amsterdam. And I am going to set my time zone to be America. And then I'm going to do slash Chicago, because Chicago is in the central time zone, which is where I met. And let's keep going down the list here of things. Networking, there's some stuff about DHCP. I don't think we need to mess with any of this. So I'm just going to leave it alone. Proxy, this is all commented out. If you were using a proxy, you would uncomment this and set these to whatever settings you're using. I'm not using a proxy. Internationalization, now I do want to make sure this is correct. So what I'm going to do is let me get into visual mode here. And I'm going to uncomment these next few lines here. Let's go ahead and delete those. And I want to make sure internationalization is set to English US UTF-8, which it is by default. But just in case it isn't, I want to make sure that this is good to go. Keymap is also set to US here. The next thing we want to do is the desktop environment. By default, this ISO has Plasma 5 as the desktop environment. Now you are not stuck with Plasma 5. If you wanted to change this, you can change this. And I've actually rebuilt NixOS dozens of times playing with it in the last couple of days. And I can just tell you some of the stuff that works, if instead of SDDM being your login manager and Plasma 5 being your desktop environment, you wanted to change the GNOME, for example. What you would do is instead of the display manager being SDDM, you could do display manager as GDM. And then you could go down to Plasma 5 and change that to GNOME. Or if you wanted to, you could do XFCE. And with XFCE, I'm going to do this particular login manager, LightDM, that all works. If you wanted to, there are, I think, like a dozen different desktop environments you could choose from. 30-something window managers are currently available in NixOS. And some of the ones I've personally installed and I know they work. I know Qtile works and I know Xmone works because both of those are working on that laptop behind me. And I was checking out my laptop, actually checking out the config. And what I think I'll do, because it's confusing how to get some of the window managers up and working, I'm going to show you guys exactly how I got Qtile and Xmone to work on my system. So the first thing I'm going to do, I'm going to comment out the line about XFCE, because we're no longer going to use XFCE. And instead, I'm going to write a new line. I'm going to do services.xserver.displaymanager.defaultSession equals. And then in quotes, I'm going to do none plus Qtile. And then end it with a semicolon. So the default session is none plus Qtile. It's going to just log us into Qtile. I don't think it's going to give us a login manager, actually, because I have LightDM set. I think we will get a login manager, LightDM. I could comment out LightDM if we really didn't want a login manager. But I want multiple sessions on this machine, so I'm going to leave LightDM. The next thing I'm going to do is I'm going to do, let me make sure the spacing's right. Services.xserver.windowManager, if I can type, equals space. And then let's do the squirrely brackets, the little squiggly brackets. Let me go ahead and make sure I add the closing one before I forget it. And then inside these brackets, we're going to add several lines. And what this is is there's several settings that are going to involve services.xserver.windowManager and having to do lines of them. I just want to put them all, you know, in between these brackets. And I could do that in other areas of this config, for example, since everything was services.xserver. I mean, I really could just do services.xserver equals. And then in brackets, you know, have all of these settings. That way I'm not doing a lot of repetitive typing. And then I'm going to go ahead and space over a couple of times. And I'm going to do qtile.enable equals true, the word true. And then the semicolon behind it. And then I'm just going to copy that and paste it because I just need to change this word here to xmonad. We're also going to do a xmonad.enable equals true. So I want both those window managers installed. And I will say that just what we've got here will make qtile work, but xmonad will not work with just what we've got here because to really run xmonad, you also need the xmonad contrived libraries also installed on the system. They're a separate package. You also need xmobar on the system. It's a separate package where qtile, everything that's qtile is just built into qtile. But xmonad, you got to put some extra stuff in here. So this next line I'm adding is xmonad.enable contrived and extras equals true because there's two extra packages of xmonad libraries that people typically will install xmonad contrived and xmonad extras. And this tells NixOS I want you to enable the xmonad contrived packages and the extra packages. And then the next line I want to do is xmonad.extra. I think it's called extra packages. Let me double check that. And that's correct. Let me do equal sign after that and then do HPKGS. I guess for Haskell packages colon and then this time in square brackets. And let me go down here and make sure I have the ending square brackets. We need to specify exactly what Haskell packages we want installed and enabled on the system. And I think the way you do that is HPKGS, hpackages.xmonad. And then I'm going to YY here and be able to copy this line. I'm going to paste it twice because the next two packages are also going to be hpackages.xmonad-contrived for the contrived libraries and xmonad-extras for the extras library. Now, I realized I made two mistakes and punctuation. I'm glad I called this because the system would not have built correctly had I not realized you need a semicolon at the end of that statement and at the end of that statement. All right, now let's keep going down the config file. And most of the rest is just stuff I need to uncomment or comment out. The X server layout is already set to US. I mean, I could go ahead and uncomment that that won't hurt anything. If I needed to change the keyboard layout, I could change that as well. If I needed to enable the cups printer service, I could uncomment that line. But I'm not going to be using a printer with this VM. So I'll leave it commented out. We do need to enable pulse audio, though I may use sound in this VM. So let's go ahead and make sure to enable pulse audio. I don't need to enable touchpad support. So I'll skip that. We do need to have a user on the system. So what I'm going to do is let me get back into visual mode here in them and uncomment this section here that created a user named Jane. And Jane is a member of the wheel group. Now, I don't want to be called Jane. So let me change that to Derek. Actually, just let's shorten it to DT. My user is going to be called DT. We'll just leave him as a member of the wheel group. I don't really care to add him to anything else. If you are going to do something like enable network manager or something like that for Wi-Fi, you may want to make sure DT or your username is a member of the network manager group as well. For right now, though, the wheel group solves most of our problems because as long as we're a member of the wheel group, we have pseudo privileges, meaning we can pretty much do whatever we want. And finally, we come to near the end here. A list of packages. And this is where you specify exactly what programs you want installed on the system. Now, you don't have to necessarily specify everything installed on the system. For example, you told it you want to do enable networking with WPA, WPA supplicant. If you were doing Wi-Fi, it's going to install that for you. You don't have to specify it. But this is for the stuff that's not taken care of by some of these other settings and you need to specify, you know, in this case, for example, they did WGIT. They did VIM, they did Firefox, which is very important. You need a text editor and you need a web browser. Some other things you might want. You probably want a proper terminal emulator. So let's actually make this like a proper config. So I'm going to leave a comment because we may have a bunch of packages to install. Let's do command line and terminal. And let's start these with, well, they've already got it started here a little bit with WGIT, which is fine. And then what else would we need other than WGIT? Well, we need GIT, G-I-T, because I'm definitely going to be pulling my dot files from my GitLab and I can't do that if Git is not installed on the system. Some other things I want. I need a terminal. Let's do a Lackrity. I know it's in the repos. I've already checked. We need a shell. A bash is there. Anyway, you don't have to specify if you're going to use bash. But, you know what? I want to use fish. So other than that, any other terminal or command line programs I want to use, I mean, C matrix had that on my config for that laptop, but I won't bother with that here in the VM. The next thing I want to do is let's install some text editors. I love the fact that they had them as part of the default config. But you know what? I also will need Emacs. If I wanted a GUI text editor, I could do notepad qq. I checked. It is in the repositories as well. And then I could do some GUI programs and Firefox is a good web browser. So I just leave it. Q browser is in the repository. It's what I installed on the laptop there. If I wanted a graphical file manager, PC man FM is nice. We also needed some window managers and window manager type stuff. So let me go ahead and do window managers and related stuff. Yeah, that sounds good. So Qtile has everything kind of built into it. It has its own panel and everything. If I want to log into Xmonad, Xmonad needs a third party panel or doc or whatever you want to install. I usually use XMO bar. So let's make sure that gets installed. Let's go ahead and make sure nitrogen gets installed. So we have something to set a wallpaper with. Let's go ahead and make sure pi com gets installed because we need a compositor and one other thing. I'm going to make sure we install D menu as well. So we have a run launcher in case it's not there by default because Xmonad especially expects D menu to be installed on the system. And the next thing is enabling SSH. I don't need to enable SSH in this VM. I don't plan on remoting into this VM. But if I was doing this on physical hardware, I do SSH into most of my machines. So I would uncomment that. I'm going to skip all the networking stuff because I don't need to play with that. The last line is system state version equals 20.09. So I guess NixOS has this thing that you need to specify what state version. I guess it's building the system from. What point is it building from? And of course, it needs to be a release, an official release of NixOS. The latest one was 20.09. That was just released a couple of days ago. That's what this is set to by default. That's what I'm going to leave it to. Now, let me just quickly look over this config and make sure I didn't make any just glaring mistakes with it. I know that took a little bit of time and we really didn't write that much to the config. I mean, to make a really detailed config that specifies everything about the system would take some time. But I'm just going to do a colon WQ for write and quit here in VM. And let's see if this builds correctly. So what you need to do is as route, you need to run the command NixOS-install. And it says it's building the configuration. And if it builds correctly, you'll start seeing output on the screen. A lot of output as it builds and installs packages. If it runs into some errors, then you'll get some error messages pretty quickly. But it looks like it's going to build correctly because it has an error out by now. And of course, now I'm getting a lot of output as it's copying things. And you see the path to where it's installing all of these programs. It's not installing them and slash user bin or slash bin. It's not going to install the libraries and slash lib or slash user lib. That's kind of like GNU Geeks. The system structure, the directory structure is wildly different than every other GNU slash Linux distribution. You know, it puts all of these things in what they call the Nix store is slash Nix slash store and then whatever the hash symbol of the packages are and everything. Now, the cool thing about this is these packages are very safe. As a matter of fact, you can install programs using the Nix package manager without being root because those programs really can't hurt you. They're kind of sandboxed in the way Nix does things. But the downside is because Nix has this wildly different directory structure. You know, you can't just compile something from source. Like you can't go grab just any program from GitHub and do a configure, make and make install and then actually installs correctly on Nix OS. You know, you couldn't do that on GNU Geeks either. You can't do that on Nix OS because it expects the directory structure to be the normal Unix C directory structure. And it's not. So you're not going to be able to compile your packages, probably recompiling all of your suckless utilities. And you couldn't do that in Geeks. You probably can't do that in Nix OS. A lot of prebuilt executables are not going to work correctly on a distribution like Nix OS again, because it expects the directory structure to be something different. So you do run into those problems. The good thing is, though, I think the packaging system for Nix OS is pretty simple. Like you find something that's not already packaged for Nix OS. I don't think it would be that difficult for you to create a package build of it and submit it to Nix OS or if for some reason that's beyond your capability, maybe request somebody else do it for you. Now, one thing that we haven't done yet, and I need to remember this because this is the end of the installation. But we haven't set a root password yet. So we haven't set a user password either for the DT user I created. Oh, and just as I said that, I get prompted. Hey, set a root password. So let me give it a strong and complicated password. OK, I'm glad it asked that because if you had forgot to set a root password and then rebooted, you'd have been in a lot of trouble because you couldn't do anything without knowing the root password. So now that we've done that, now let's sudo reboot. Up, it's still going to run through the installer because I didn't detach the ISO. This is my fault, guys. Let me kill that VM. Let me pull up the settings for the VM and let's disable the SATA CD ROM as trying to boot off the ISO. I wanted to boot off, of course, the virtual machines hard disk that we created and installed Nix OS properly, too. So now let's restart and assuming everything worked correctly. And it does. We get grub. So once you get grub, you know, it works. All right. And it boots up lightning fast. Wow. And what is available for us on login cutal and Xmonad? And let's actually see if Xmonad works because that's the one if one of them is not going to work, it will be that one because Xmonad is tricky. And I can't log in because we haven't created a password for the DT user yet. So what I need to do is I'm going to choose other and then I'm going to do root. You normally don't want to log into a desktop environment or window manager as root in a VM. I'm not too worried about it. And we're only doing this just to open a terminal and set a password for my DT user. So let me go ahead and log in. They logged me into cutal here. Let me do a super enter to get a prompt here. And then let's go ahead and do our password. So pass WD and then space DT because that's the user we're setting the password for is the DT user. Let me give him a password, password updated successfully. And now let me get out of cutal. I'm not sure what the default for quitting out of cutal is. That's the only thing with these. Is it super shift Q? No, super shift C. How about just super Q? Alt shift Q? You know what? When you're in doubt and you don't know what it is, if all you need to do is get killed out of the window manager, you could always just do kill all, cutal. Kill all is not installed on the system. Dang. You know what? It only took like five seconds for the system to reboot a second ago. Let's just reboot. There's no reason not to when it boots up this fast. All right. And now let's log into Xmonad as DT with DT's password. And we logged into Xmonad instantly. You probably think it's hung up or something like the screen is frozen. No, when I hit enter, we instantly were launched into Xmonad. You just couldn't tell because there's no panel. There's nothing to set the wallpaper. You know, there's nothing to it. But if I do a alt shift enter, which I just happened to know is the default keybinding and Xmonad to bring up a X term. And thankfully X term is installed on the system. If it wasn't, that would have been a bad day. I'm gonna alt shift Q to quit out of Xmonad because it's so blinding white with that X term. Let's go ahead and get into Qtile. Because Qtile, at least by default, looks good. And, you know, I'll still have my eyes functioning correctly, not having to look at that hideous X term because I do super enter. It actually gives me a proper terminal. I'm assuming that this is alacrity, which I specified in the config. It is, that's the alacrity terminal. Now in Qtile, you could do super R for a run prompt and then type whatever command you wanna run. Let's launch Emacs just to make sure Emacs works. It does. Don't know how to close windows. Here, I'm still confused about how to close stuff. You're in the default version of Qtile, but I could go to file and quit, all right? Thankfully, Emacs is a GUI program. Now let me just quickly show you guys how to rebuild the system, you know, create another generation of something so you wanna change something. So let's go ahead and edit our config file. So do a sudo, vim, in my case, nano, whatever it is you wanna use. And the config file, again, is found in slash etsy, slash nixos slash configuration dot nix. Gonna ask you for your root password. What I'm gonna do is I'm gonna page down and let me get to the section of the packages. Let's go ahead and add some more packages than what we had on the system, because I ran into some problems there, didn't I? Because I wanted htop, I wanted xql, and I hope these are the actual names of the packages inside the nix repository. If they're not, we may get an error when we try to rebuild the system. Let's see though. I'm gonna colon wq to write and quit out of vim, and this is the command to rebuild your system. You don't need to do the nixos dash install again, because that was just for the very first installation. From now on, you need to do sudo nixos dash rebuild space, and then the word switch. And then it's building the system configuration, and apparently htop was okay, but xql was not okay. That was not the name of that particular program. Let me see if I could do a quick search. If I go to the nixos website and search for packages, and 20.09, I'm gonna search for xql, because they must have it named differently, name xql, but the attribute name is xorg.xql. Maybe that's what I needed to put in the config file. I'm not sure. One way to find out though is let's change it to xorg dash xql, write and quit. Let's rerun the nixos rebuild switch command. If it errors out this time, I'll just, yeah, I'll just delete xorg dash xql. You know what, it's not dash, it was a dot. So let me replace that dash with a period, write and quit. Let's try it one more time, because I need xql. That's a program I use all the time. No error this time, so that was how you do it. So you guys, if you run into that same kind of problem with a package, you're not sure about the name. You can check the website here, and I guess under attribute name xorg.xql, that's the actual thing you need to put in that packages section of the config file. Not just xql, but xorg.xql. And now that it finished rebuilding that, I'm gonna do a sudo reboot. And what we're gonna do is instead of letting it go to the default nixos, which is always the latest generation, now I can go to nixos all configurations here in the grub menu. And we could go to the latest generation we just created or I could go back to the very first generation. The first generation's not gonna have htop or xql on it, right, that's the previous one. But if I wanted the one that we just rebuilt with htop and xql, I would need to log in to configuration number two. So that's all I'm gonna do on nixos for today's video. I know this was kind of a very brief look at nixos, even though it's gonna be a lengthy video because we spent so much time on that config file. But nixos is a fascinating Linux distribution. So fascinating, I wouldn't mind running it on my main production machine if everything would work correctly. At least for right now though, I am going to run it on my laptop. That Lenovo ThinkPad behind me. It's an older ThinkPad, a E535. And I've been enjoying it because when I installed nixos on the laptop, I did plasma first just because it's the default. Everything worked, wifi worked. I did XFCE, same thing. Wifi worked, out of the box, everything just worked with the XFCE desktop environment. So those of you that are looking for a different kind of Linux distribution, give nixos a try. Now, before I go, I need to think a few special people. I need to think Michael Gabe Corbinian, Mitchell Devin Fran, Arch 5530, Akami Chuck Claudio, Donnie Dillon, George Gregory, Caleb Devils, Lewis Paul, Scott and Willie, these guys, they are the producers of the show. They're my highest tiered patrons over on Patreon. Without these guys, this look at nixos wouldn't have been possible. The show was also brought to you by each and every one of these ladies and gentlemen. All these names you're seeing on the screen right now, these are all my supporters over on Patreon because this channel is sponsored by you guys, the community. Without you guys, I couldn't do this. And if you'd like to support my work, consider doing so you'll find DistroTube over on Patreon. Peace.