NixOS Is A Fascinating Linux Distribution
Вставка
- Опубліковано 28 жов 2020
- NixOS is a GNU/Linux distribution that employs a powerful package management system that allows you to build the system from a single configuration file. NixOS supports atomic upgrades and rolling back to previous generations. In theory, it should be an unbreakable system.
REFERENCED:
► nixos.org/
WANT TO SUPPORT THE CHANNEL?
💰 Patreon: / distrotube
💳 Paypal: www.paypal.com/cgi-bin/webscr...
🛍️ Amazon: amzn.to/2RotFFi
👕 Teespring: teespring.com/stores/distrotube
SOCIAL PLATFORMS:
🗨️ Mastodon: mastodon.technology/@distrotube
💬 IRC: irc://freenode #distrotube
👫 Reddit: / distrotube
📽️ LBRY: lbry.tv/$/invite/@DistroTube:2
DT ON THE WEB:
🕸️ Website: distrotube.com/
🐿️ Gopherhole: gopher://distro.tube
📁 GitLab: gitlab.com/dwt1
🔊 Audio Podcasts: www.buzzsprout.com/1263722
FREE AND OPEN SOURCE SOFTWARE THAT I USE:
🌐 Brave Browser - brave.com/dis872
📽️ Open Broadcaster Software: obsproject.com/
🎬 Kdenlive: kdenlive.org
🎨 GIMP: www.gimp.org/
🎵 Audacity: www.audacityteam.org/
💻 VirtualBox: www.virtualbox.org/
🗒️ Doom Emacs: github.com/hlissner/doom-emacs
Your support is very much appreciated. Thanks, guys! - Наука та технологія
The reason why you can use sudo without a password is explained in the manual: "The nixos user account has an empty password so you can use sudo without a password."
I've been using it for a long time and really love NixOS, I think it brings the idea of configuration management to the OS level.
I love the idea of configuration you can access directly from the filesystem. It makes it way easier to see what everything on your system is doing and what could be causing problems.
Yay uwu
Hey DT, just wanted to say thanks for reviewing NixOS. I never seen and used it. I will definitely get to know by this .
Yay
You should do a video on nixos packaging!
Man, thank you for getting into the woods of nixos. I saw this distro a few years back and even downloaded the iso and opened into a VM but I didn't go any further. I found its engineering very promising way back when. Well, I settled with arch for my machines for now, but seeing the awesomeness of nix package manager, it has triggered once again the interest on nixos.
A part two would be great this was really interesting!
Been using nixos for about a month now. So far pretty happy with it :).
I use Manjaro (which is kind of boring to me right now) and I'm wondering if NixOs sounds good to switch to from it? What were your experiences? I was also pretty interested in the package manager of it before hearing of the OS, so I'm glad it's being used in it by default
I just recently found your channel and the content is great. Its not easy to find good Linux content UA-cam channels with distribution infos.
Been waiting on you to give NixOS a second look. Glad you took the time! :)
how have you not hit 100k yet? your content is so much better than many of the much larger channels
Your video is very good! Thanks for the review, Derek!
Thank you for this video. I'd been wanting to try nixos and have been intimidated by the config file. To that point, I'd tried in a VM before and was unable to boot, and your explanation of this got me past that.
If you don't wanna have to install everything systemwide you can use home-manager which allows you to configure your users environment individually. Reduces the total system bloat on a reinstall as the core system is made as small as possible. It also means you don't need to use sudo every time for adding new programs.
in some senses, this is one of the most user friendly Linux distros out there..
I am much of a noob when it comes to low level Linux stuff. Often, with other distros, I have been breaking my system by screwing up installations or I have been playing hours of wack-a-mole to get something working on my systems..
NixOs helps me validate and sanity check my configuration, and I am quite happy every time it catches some error I have made in my configuration.. Furthermore do I use my config file as documentation to help me understand and remember the purpose of various crypticly named Linux packages.
have you been able to find most packages on Nix?
@@behnamplays Yeah, Nixpkgs is huge - Bigger than Fedora, or Arch without the AUR
@@keeganm9184 It's actually bigger than the AUR now, isn't it?
@@MRDaved Yeah it is
If you got 'Command not found' just run 'command-not-found '. very useful to find a package provides this command
I'm actually installing NixOS right now! Good timing :)
How was it
Hey DT, you made a comment about not being able to recompile your suckless utilities and as a NixOS & suckless user i would like to clarify that you can pretty easily do that, you just need to specify the patches you want to use using an override of the (for example) st package. Here is a code snippet for using basic regular patches:
"nixpkgs.config.st.patches = [ /path/to/diff.patch ];"
here is an example from my personal config, the lazy persons build of st.
"""
nixpkgs.config.packageOverrides = pkgs: {
st = (pkgs.st.overrideAttrs (attrs: {
pname = "luke-st";
version = "unstable-2020-08-07";
src = pkgs.fetchFromGitHub {
owner = "LukeSmithxyz";
repo = "st";
rev = "de6fd85eeb544548ed5ad23a639eedd6af510036";
sha256 = "1xyrbi857435dln7i6qb9ys2jizv43a2zq6fx4dr8z52ramxzyky";
};
buildInputs = attrs.buildInputs ++ [ pkgs.harfbuzz ];
}));
};
"""
Hope this helped!
I was wondering about that. Pretty cool 🙂
I have the following:
"""
environment.systemPackages = with pkgs; [
...
(st.override {
conf = builtins.readFile /home/aptrug/Programme/st/config.h;
extraLibs = [ pkgs.harfbuzz ];
patches = [
(fetchurl {
url = "st.suckless.org/patches/ligatures/0.8.3/st-ligatures-20200430-0.8.3.diff";
sha256 = "02cg54k8g3kyb1r6zz8xbqkp7wcwrrb2c7h38bzwmgvpfv3nidk7";
})
];
})
...
];
""""
in configuration.nix and it works pretty good
@@fritjoflarsson9817 Looks good! Although I'd suggest you take a look at "home-manager" for managing your user packages.
How does it resolve merge conflicts ?
Looks like a bit lengthy process if i edit my suckless programs often
7:04 you could use `sudo !!` there, it runs the previous command as superuser
Ohh. Never thought of that! The simplest things! 😅
or just do sudo su and became root and do the install as root because while installing you need to do basically everything as root
@@tedbybolf4616 that won’t work with ~/ directory operations, as the super user’s HOME directory is /root, while the regular user’s HOME is /home/username
@@jiyometrik you don't usually need these while installing
Good video. I wanted to point out though that the "stateVersion" isn't "what point it is building from". It's actually more about the data that isn't part of nix. The kinds of things that are not recoverable and a rollback can't fix. It's pretty much a warning to back up anything with state like databases. There are many services that support many database versions, but you want to make sure to back up your data before they update.
Another cool thing about Nix is the "nix-shell" command.
It's trivial to test packages with it, you just need:
$ nix-shell -p
For example:
$ nix-shell -p firefox --run firefox
and you will have Firefox in a temporary environment (it can be garbage-collected later).
Also, this isn't something exclusive to NixOS, it works on any GNU/Linux distro or macOS that has the Nix package manager installed.
For those who are interested in knowing more about Nix, there's an excellent website maintained by a great contributor to the Nix ecosystem: nix.dev/
Yo
This is a gamechanger
You can also use nix-shell to get a reproducible development environment, we use this at my workplace and I also use this a lot for personal projects. It removes the notion of "dependency hell" almost entirely!
Btw, I always wondered what about dotfiles and other configs in this case. Won't they clash between different versions or even be left by these temporary installs?
@@mskiptr Yes, they would. We have home-manager and nixos-container for dealing with that.
Actually, NixOS has a system to emulate the standard filesystem structure through symlinks. It should be able to use most standard executables.
How do you enable this?
@@mgord9518 steam-run seems to work for games, but I'm not sure if there is a configuration option. Honestly it's better to make a derivation for the script you are running so it can be tracked in git
Wow! I do not think that this distribution is for me, but I am glad to have learned about it. I might give it a try in a VM even at some point, too.
you can learn, if you want. but it will take some time
DAAAAMN I can even "setxkbmap -option caps:swapescape" from that config, should give NixOS a try
You can do _everything_ through the config. All my desktops and laptops are fully configured from this repository: github.com/balsoft/nixos-config with one command (sudo nixos-rebuild switch --flake .) . I generate and set GTK theme, Qt theme, terminal emulator colorscheme, emacs configuration and packages, firefox theme and plugins, patch all the software I want patched (e.g. I change default colorscheme of Spectral, my matrix client, by patching the source), etc.
@@balsoft01 That's impressive. I'm downloading a minimal live iso to play with in a VM
NixOS is the best. Not only functional is the future of operating systems, but the distro is already mature enough mostly for practical use on the desktop. I have been using it for a while and it became my least problematic Linux desktop distro so far, which is good enough from a mature distro, let alone from a revolutionarily new one.
Great informative vid!
Great video! you can enter an elevated rights env (just like su) with sudo -s
This was great Thank I look forward to checking this out. Question how do you feel about the Virtual program "Boxs"
Hey DT, would greatly appreciate more NixOS content, since there is not much on UA-cam about it so far. I think NixOS is the closest thing that comes to a true revolution in operating systems in the last decades.
@@bigpod While machine state under Silverblue is managed atomically and it is reversible, it's not generated declaratively, but managed through more or less traditional imperative package management. This is very deliberately *less* revolutionary (read: disruptive, demanding) an approach than NixOS', which requires hacking and configuring every program to do things like, e.g., live on a read-only partition and build against a unique prefix.
This is actually the strength of Silverblue, because it means less work is required to get custom or proprietary software onto the system, while retaining a subset of the benefits of a system like NixOS. But more revolutionary it is not.
8:20 , you are in the terminal of your laptop (no virtual machine yet is ready) so how do you have the command nixos-...... available?
If you type : which nixos-generate-config
what do you get?
Please do more videos on nixos. I find it fascinating.
Maybe check out the talks from NixCon to go more into detail.
Usually you can get a root shell with sudo -s, right? I do that on these live environments where su won't work but sudo does.
The doom emacs creator uses Nix!
I've been trying to install his dotfiles but it always ends up not working because it says there are no configuration. nix. But that is what the setup script is supposed to do. If anyone of you gets it installed let me know.
@@halikular I might give it a go in a VM but keep in mind his config is bleeding edge, using Flakes which is an unreleased feature and moved from nixpkgs unstable to nixpkgs master the other day (1 day before your comment)
Yes
❤️ your setup in the bg
Nice vid and interesting OS.... Something to tinker with, as Jon Ringer says...
Funny how opinions change. He didn't like it the last time he tried it.
Yeah, people shit on him for not doing his research, he noticed it and fixed it.
@@halbgefressen9768 yep, at least he make an effort to re-review if he sees it was unfair.
Nothing wrong with changing ones mind. Everyone get stuff wrong sometimes.
Not so funny considering that when one gains experience, his opinions and tastes can easly change
Also, circumstances can change. In this case, the distro might have matured and evolved since he last looked at it.
Such an interesting and unique distro. I like the thinking.
Man this OS is cool. This could be a game changer in Linux in installing and managing systems. They seem to have almost every package available I ever considered running in their repos, so they are not lacking anything like some new distros. However, I am a little disappointed that a single company seems to be behind it all though.
I watched your vid on True OS last time so you think BsD and these Unixes are not Desktop ready as Linux has become? I tried freebsd back in 2013 or so and well at the time Ubuntu was already mature.
Is that your standard way of partitioning?..Personally i use a separate boot partition as well.
Thank you DT. I was having trouble finding working documentation on setting up xmonad inside of NIX (even though 1K dev's have it in NYC). Let me know if you want to collaborate on Haskell Nix, postgres, servant, reflex-frp full stack app series.
have you tried to get help on IRC or the forum and checked out the configs. of others? nixos.wiki/wiki/Configuration_Collection
Can't install it because I can't change keyboard layout from EN to FR during install in terminal. Can someone help me ?
Amazing... I will try NixOS when I have a bit more time. Easily explained..
It takes literally few minutes to configure NixOS, whereas my Arch installation I have been configuring for almost 3 years:) Now, I have a dilemma.. should I ditch Arch for NixOS?
Good video.
The recently released NixOS 22.05 features a graphical installer.
Is it enough for you to switch from Arch?
My school actually uses nixos, it's a really good option if you want to make a lot of identical installations
what and where is that school
Finally you were able to install it
So you have finally revisited it, heh. Amazing.
You can type "sudo su" to become su instead of adding sudo to every command
. I wasn't familiar but I've had this idea for years as I believe that system recoveries are a necessary space hog, especially in unstable Windows world. This could at least in theory reduce that recovery space by a lot. At least enough of a system to get you to an upgrade manager. It's pretty neat. Seems to be lighting fast. What would be handy to have is a way to save that script for later builds and you could at least in theory easily port builds from machine to machine. Almost.. but not quite a universal installer. It's certainly a lot more work then say Ubuntu.. but that could be remedied with a little work.
BTrFS?
You can just put your config in git and reuse it on multiple systems.
Here is my config. for example codeberg.org/davidak/nixos-config/
When your system is destroyed, you just install NixOS on a new one, apply your config and restore user files from backup. And you have the exact same system as before.
Hello DT, maybe OpenBSD review is about the time? ;) Sorry my English please...
the config file looks like one big magic string made from random distributed knowledge.
Is there any sort of autocomplete, suggestions or linting available to assist in configuration and/or catch obvious errors?
Hey DT (assuming you ever see this comment), what is your experience with config management generally? I think the benefits of Nix/NixOS become more obvious after you've worked with the likes of Puppet or Ansible for a while. We were using NixOS to run a bunch of services at my last job and it was SOOOO much better than doing it with Ansiblows.
NixOS is a nice enough desktop OS (I used Arch for 12 years before switching and now I'm never looking back), but it's best strengths are in the realm of DevOps IMHO. And if you're a developer, Nix itself is also a very good build tool generally.
Anyway, great video. Cheers.
I guess he is just a desktop user.
Hi Derek, would you be willing to do a video on the top 5 distros with the best UI UX and LAF ? Not DEs but distros. I'm interested in you using them as the developers intended.
@@bigpod look and feel
Ty, but how many ressources use Nixos compare to over ??
Little update with Htop welcome.
Ty
Nice concept. But how well is it supported? What are chances that some needed programs are not in the repo?
It has the second most packages (1. is AUR) and the most up-to-date packages from all distros. repology.org/repositories/graphs
You can check search.nixos.org/packages if it has the packages you need.
You can request new packages on GitHub: github.com/NixOS/nixpkgs/issues
You can also learn to create packages yourself. It's easier than for debian/Ubuntu in my experience. I maintain 20 packages now.
@@davidak_de thank you, I was thinking if I should try it and stop using Arch.
It would be cool if they take their config based installer and make it work as a simple installer for other Linux branches like Arch or Debian.
Well, you can use `nix` from arch or debian, to install packages declaratively like this! You just won't have nixos stuff which manages the OS.
In addition to nix, you can use the home-manager project from arch, debian, macos,.. to manage your dotfiles with Nix :)
Would that not be NixOS again, with the packages from debian or Arch? Maybe a different Wallpaper and Theme.
I don't see any value in that and might not understand what you mean.
7:10 sudo and su are two different programs. sudo can be configured to have a passwordless user with an entry like: nixos ALL=(ALL:ALL) ALL. While su tries to access root.
For any Windows Admins, think as sudo is "run as admin" where SU is "Run as other user" and that user just happens to be admin.
Xfe > pcmanfm
OpenRC && Runit > SystemD
Gentoo && OpenBSD > All
Portage > Pkg > Ports > Pacman > Nix > xbps > Slackware User > Git > ... > Apt
Great video mate, complements from Brazil.
Thanks for the opinion. Really made my day
@@masterchief1520 You are very welcome, Sir.
The reason su needed a password but sudo didn't is because they likely put a line like "%wheel ALL=(ALL) NOPASSWD : ALL" (without quotes) in /etc/sudoers. su is kinda "dumb" and since it is basically like logging in as root, it needs root's password. sudo on the othet hand is much "smarter" and it needs the users password as long as the user (or one of the groups he's in) is specified as not needing a password, it won't ask for one. If you want to run a root shell, you can
1) Run sudo su. This will run the su command with sudo.
2) Run sudo -s. This will run the current shell as root in the current directory.
3) Run sudo -i. Thus will spawn an interactive shell. This will give you root's environment (variables) as well.
Question. I'm used to sudo or su requiring the root password, but as far as I've found NixOs asks for the user password instead of the root one. Is there a reason for this? Or can it be changed to require the root password instead? I thought one of the points of doing it that way is that even if you somehow know the user password, you _don't_ have the ability to do anything because root access requires another password.
@@TheKrister2 Su needs the root password. Sudo needs the user password. That's the whole point of sudo ;)
But, perhaps sudo not actually running su. Although I find that extremely unlikely, but perhaps it's either a symlink (which I personally like to test with "ls -lAhskF --color=auto /usr/bin/sudo" (or just /bin/sudo)), or it's an alias.
BTW @DistroTube... the magic incantation you were looking for to su and become root, is this: "sudo su -". Most sysadmins in an enterprise environment don't even know the root password, and using sudo is the only way to become root.
Wow. I remember your last NixOS video. You skipped through it, said it was hard to install, seemed to not understand anything about its benefits or why it is set up so differently. I love your videos but that one made me lose a little bit of respect for your review process I guess (though I am biased; nix user here). It’s interesting to watch this turnaround. Well done! By the way, the process for this is the exact same as last release (with plasma), but you said the last one was overly difficult. I think perhaps your understanding of what it is trying to do has changed over time. I actually NEVER use this process. I either install from another operating system (which you can totally do) if there’s one on there, or I build my own iso with a simple .nix script.
What would be the best to read/watch for learning how to do those custom ISOs with scripts please?
"sudo -i" to drop into root. ctrl+alt+f1 for new tty to login root so no need for desktop root login. pkill is probably installed rather than killall.
Was going to post this if `sudo -i` hadn't been mentioned.
i was going to say there no way something like discord would be in there but nope it's right there in the repos, even google chrome o.O and steam
quite fascinating indeed
that they managed to package proprietary software makes this very very fascinating as those packages install things where they want them to be installed
You have to enable nonfree stuff manually to install those. Pretty much the same as other distros like Void or Debian in that regard.
@@SoundToxin sure but considering the install location for the nix package manager it means it installing proprietary software in a custom location, which is very interesting.
"sudo -i" will change the user to root if you're looking to enter a large number of commands as root.
Also while this is very cool, most linux distros have a way to install to a specific configuration, such as kickstart for redhat.
I use to run `sudo su` :)
Hey @DistroTube . For when a minimal installation of NixOS ??
I tried for real this distro some time ago, and it was a really good experience, but I had some issues that I couldn't resolve. Now I'm happy with arch but if I distro hop again I will try nixos one more time.
I wonder how good is this distro with xmonad, cause if I'm not wrong nixos has something of functional programming.
Yeah nixos is really big with the haskel crowd and there are packages for it in nixos.
I use nixos on 4 computers and use xmonad on all of them (shared config between the computers). Haskellists use nix and nixos a lot and since xmonad is written in haskell.. :)
There often are some traps that I run into on the nixos but if you learn nix syntax a bit it's quite easy to make your own derivations and do stuff your way. It's definitely not a beginner friendly distro and you must kinda become the master of packaging. :))
I've been thinking about trying NixOS for almost a week now but then I saw in their page they don't include Foliate and since you cannot compile and install custom apps it kind of kill my enthusiasm. I didn't know that till i watched this video... eis ç'est la vie. Good video btw
I see Foliate has Flatpak and Snap available. NixOS supports both.
When you look on GitHub, you see that there was an attempt to package it. There is now a package in NUR (similar to AUR, for Nix).
github.com/NixOS/nixpkgs/pull/64536
You can compile and install custom programs, but you have to create a proper Nix package. The good thing is, at that point, you can also contribute it to nixpkgs for others to use. When you know how to compile programs manually, you should be able to learn how to do it on NixOS.
@@davidak_de Thanks man, I really appreciate your feedback.
in terms of voice
david attenborough : Planet Earth :: DT : Linux
Nixos now has added a GUI installer in their 22.05 releases
It's an awsome distribution! Is it possible to install software by command line? configuration.nix would updated automatically?
No that's not possible, I wouldn't trust a program to auto update my config file.
The configuration file is not just a list of thing, it's a whole programming language. It's not necessarily in one file either, you can split the config in many files, modules, grab some from the internet automatically, etc..
I think it would be hard to do modifications to a config file like that.
Haven't done yet but ig you could make a bash script for appending to the configuration.nix and then running nixos-rebuild --switch automatically
and with some alias add the script to your .bashrc /fish config so that you could directly call it.
5:21 With GRUB bootloader installed to MBR (as you did it later) you don't need set a "boot" flag to partition.
Hi can you explain plz, I never understood why
Using "sudo su" would give you a root shell! :)
As well as "sudo -i"
This is really nice.....
For a moment I was very confused when you didn't make a 550MB EFI partition.
if you didn't know how to logout, just restart display manager
28:12 "killall: command not found"
They should make links to the default directories unless you specifically say that you don't want that. That way you could have both structures at the same time.
You mean in nixos-generate-config?
You can also run it after the install to update the hardware-configuration.nix. So it's nice to not have to specify it there.
But maybe it's more often used in install and we should change that.
@@davidak_de Something like that. A setting that can be changed so that people can compile things, or use any software that expects dependencies to be in the normal directories. Though thinking about it better, it definitely shouldn't be the default behavior for every program, because that could create conflicts if people have multiple versions of the same program installed, which is one advantage of Nix from what I understand.
DT you have a do video , about to how to install Gentoo linux with Live CD with calamares installer:)
Make sure to make a FAT32 boot partition if you're doing UEFI and mount it at /mnt/boot
I liked nixos at first but swapped back to Arch after some days because I ran into so many issues with nixos not finding config files or package descriptions being outdated etc. The community is so small sadly and I think that's also it's biggest issue.
have you created an issue for that, so it can be fixed? and asked for help in IRC or the forum? issues will be fixed, over time and you can learn to fix them yourself.
nixos (unstable) has actually the most up-to-date packages of all distributions. repology.org/repositories/graphs and updating a package is in most cases just updating the version number and the hash. we even have a bot that does it
interesting distro for sure
Wow, i was sleeping on this.
Why do you use MBR? Is there any advantage/disadvantage with using either MBR or UEFI?
I think in a VM it makes no difference. MBR is just the default.
UEFI is more modern and might be faster on haldware?
You are in the sudoers file was an authorized user.
If you have sudo privileges on a system with no root password, you can use 'sudo -i' to get a root prompt rather than typing sudo before every command.
It 5 am here and That huge white terminal pop up 😭😭😭
In that su/sudo situation you could just "sudo su" :)
Why not use sudo -i?
~ @ 7:40
Most fresh Linux installs
If secondary user was created during install
Then in a terminal
The first command you should run on a fresh install is
$ sudo passwd ##sets the password for the root account
The power to install more than 1 version of the same package alone makes NIX better than 90% of all Linux distros
7:25 you can just sudo su -
Can u check out Anatrix Linux?
7:35 He could have typed 'sudo su'
7:20 You can just `sudo su`
i felt pain every time you done indentation manually instead of just enable auto indent
if you do
sudo su
it should work for those times where you don't know the password but can still run sudo without the password.
"reproducible distribution" kind of reminds me of Docker images/containers
What happens when something goes wrong, nixos breaks, you try to recover your videos and photos, other information off that drive. It's gone... no getting it back. Because of the way it stores everything. Happened to me. Loved it. Until a update went bad, it would not let me roll back to earlier. It just crashed everything. Never ever this os or Garuda ever again.
FYI: Guix and NixOS doesn't share the same philosophy or design, instead Guix uses Nix inside and put Scheme API on top of it , so Guix is a derive implementation of NixOS but with Schema and Linux-libre
Edit: A few corrections:
1) There is utilities like buildFHSUserEnv to allow normal linux user directory mapping via linux user namespace , (though normally you would just do a bare nix derivation for make/make install based tools)
2) For prebuild binaries, there is also utilities like autoPatchelfHook, which uses patchelf(created by the nix team themself), that would allow auto wiring(no requirement of manually rediting the elf binary) of nix deps to the binary itself, that is the common appraoch for prebuild binary
2.1) There is also utilities like appimageTools which allow usage of appImage(which is also a type of prebuild binary)
AFAIK there's basically no code in common between Guix and Nix at this time. It's unfair to call it a derivative. There are also efforts unique to Guix like what they've been doing with their bootstrap seed.
@@SoundToxin you might want to take a read AUTHORS and nix/AUTHORS in the guix repo then
also I specifically said as in Guix is nix system(deployment model, daemon code, etc) with schema instead, since the video described Guix as inspired by Nix, which no, inspired mean similar ideology or approach, not so much when it does reuse portion of code and even interact with nix daemon in some manner (nix/nix-daemon/nix-daemon.cc)