Ultimate NixOS Guide | Flakes | Home-manager
HTML-код
- Опубликовано: 9 дек 2023
- Discord server: / discord
Donations: ko-fi.com/vimjoyer
Code from the video: github.com/vimjoyer/flake-sta...
Also check out Iogamaster's video: • HOW to REALLY learn NixOS Наука
So, the flake.nix file in the video uses extraSpecialArgs, instead of specialArgs that Nix uses, so I got "error: function 'anonymous lambda' called with unexpected argument 'extraSpecialArgs'". For everyone getting the same issue, please replace "extraSpecialArgs = {inherit inputs;};" from the flake.nix file with "specialArgs = {inherit inputs;};". (Although, I am pretty sure that @Vimjoyer already fixed the template flake)
had me stumped for a while, so thanks for this pinned comment... great video series... watched this many times over :)
I should've read this comment earlier...
Correct, extraSpecialArgs is a home-manager specific option.
What do you guys think about the thumbnail?
It's really cool, though the rainbow text seems a little out of place in the gruvbox theme
@@lennyescott Hmm, I agree. It looks kind of weird
It's great, just like the video hehehe
It is great, very clean and pleasing to the eye. However I would say though it's not very baity outside yours or the nix community. I know they are not the target audience but they are free views.
Maybe remove the word nixos but keep the logo, To peek non nixos user clicking while keeping nixos user.
Mental outlaw and fieship are what got me in to Linux because their thumbnail.
I like the rainbow bow text.
@@MehMeh-mj5hnThat's a great advice. I should have written something like "Best Distro Ultimate Guide"
saw your channel from NoBoilerplates good vid
This shout-out brought 15 times the usual amount of new subscribers in one day. Huge thanks to Tris
Convinced me to switch from Arch to NixOS as well - but takes some getting used to!
@@LobbeltI would approach NB's enthusiasm with a healthy dose of skepticism. There is a propensity among young men to push "productivity" ideas without the necessary experience. The majority won't publicize their having backtracked on any such decisions. I haven't tried NixOS, but my sense it that its users run risk of the sunk cost fallacy.
@@HiAdrian This is true. As long as you're actually doing work, rather than fixating merely on the ideal of productivity, then it should be fine to use any OS. I don't really see how Nix is going to make a difference in this case; it's just another fixation to get addicted to and another passionate idealism, which is perfectly in key for No Boilerplate, but probably too wondrous and lofty for the real world. In reality I've never had any trouble with packages whatsoever on my Mint install, and not even on my Gentoo install. The problems that Nix solves apparently don't exist for me at all. More power to you if you benefit from Nix, but I guess it couldn't be me...
@@HiAdrian while there is much of "productive" runners, it is honestly an interesting hobby too, i see many people having harmless fun and i do not mind it. For me nix will be the way to revert my mistakes, i am pretty clumsy in os (like selecting wrong kernel and drivers for my devices and then trying to fix it eventually breaking system) pretty common beginners mistake, for me it would be fixable with nix, without so much of time and energy involvement.
This is by far the best nix flake explanation on the internet
Ugh where was this series when I started using NixOS??? Seriously though, this series is, in my opinion, one of the best resources on NixOS available on RUclips, if not on the internet. Also I really adore your style of presenting and editing, keep up the good work :)
It's just the beginning :D
Me, too. It's the voice that is so calming, so enjoyable to listen to. The style and content of the presentations are exactly the way I learn best. He's straight to the point, doesn't needlessly add opinions or comments about what he is presenting. He just stays on topic and presents the information . . . and in such a clear way. I could listen to him for hours.
Whole heartedly agree
NixOS has been there for 20 Years!! What?? Why did I only start using this gem last year! NixOS is honestly the best distro for me. Sending much well wishes to all the developers who made NixOS come true
This is THE best nix video I've ever watched! I've tried to understand nix multiple times, but I couldn't find any tutorial that covers how these files interact and how they relate to functions I care about systematically like you do. Please make more videos like this!
After using debian as my main distro for years and years - I've finally decided to give NixOS a try. This video was super helpful as a starting point for working on configs and has already given me ideas on how I can use flakes and modules to manage development environments. Thanks!
my brain is melting from the amount of piece of information this video has
Thanks for this, I was sleeping on my nix configuration, good reminder that I should start using it
Oh, this is good! I have already set up everything, but this will be a great watch for anyone new! I'll be sure to recommend
Nice video. I've found Nix to be the next logical step on my Linux journey, and flakes see to be a rough point for most, including myself. Lots of information in 15 minutes. Thanks!
Thank you for the video! By the end of it you're showing a recommended structure as to split into multiple hosts and create modules. I've been struggling with getting that to work and would love a follow up video on that! Tks again for the great content you're doing!
100%
You explain complicated concepts in such a easy way, natural Talent in teaching! Please make more such excellent videos.
I finally decided to try Nixos, as a result of your videos, so helpful!
I wish I could like this video more than once. The transition from the old configuration.nix paradigm and the new flakes paradigm has kept me from looking at NixOS at all. I want to use flakes because it is obvious that is where Nix is headed, but I couldn't figure out how to get there. Thanks so much for this video!
This was awesome, best video for getting started with NixOS
Thank you very much for populating the great system. I use NixOS desktop as an ordinary home user for 3 years. Many times I tried distro hoping, but had always been back to predictable reliable NixOS.
As per usual a great video, I wish this had been around when I was learning nixos hahahah. Keep up the good work!
Hope it will help some beginners, it's certainly better than my first NixOS guide
@@vimjoyer I'm sure it will, please keep the nix content going it's great. I love seeing other ppls workflows and nicking bits I find cool.
Excellent breakdown. I was also recommended from NoBoilerPlates channel. Subscribed and ready to learn more about NixOS.
This video is so dense; but incredibly nice. Definitely migrating to NixOS, this is beautiful.
So concise, great vid.
Awesome content.
Many thanks for sharing it with us!!!
Excellent overview!
Love and thanks for sharing such great knowledge.
Best nixos guide so far! Дякую!
Absolutely based video preview. Keep it up!
This is awesome! Thank you, really.
Very good video! Thanks!
Excellent video thank you for easing my transition into nix os
Gotta trust in that helmet
currently staring at a blank nixos tty trying to setup hyprland. This video came just in time
Isn't that literally one command though? "hyprland.enable = true" or something like that
This pill is gold! 🙌
Your channel is amazing, man! Especially the Nix series. I have used Linux for more than 11 years both on personal computers and servers, but I only recently got started with Nix. Your channel has been a great help so far, as well as a source of inspiration on what Nix can do. It's definitely going to be the next skill I master, and it'll probabely replace half of Ansible, Docker, and Nginx code I write, if not more. Not to mention managing my desktop configuration and automating installs with nixos-anywhere, Disko, flakes, and Home Manager!
I initially didn't like Nix because it's not FHS compliant, and I'd prefer if it was, but it seems like there are solutions to this too, and you can still run software and scripts with hardcoded paths to executables.
Keep up the good work!
P.S.: Дякую! І Слава Україні! 🇺🇦🇬🇪 The accent and the name of the month on the top panel were dead giveaways. 😃
... this makes me want to try out nix.
I'll try it when I eventually get myself a new laptop.
thank you so much for helping us to move configuration to flake.
Nice
for anyone still having issues... in the flake file... its specialArgs and in configuration.nix... its extraSpecialArgs... i was stuck on this for a while... making them both specialArgs.
wonderful series... I finally got past this hurdle ... thank you.
Yeah, I fixed it in the repo, but unfortunately, I cannot edit the video.
@@vimjoyer yeah no worries!!
Im also curious about another thing...
when you move the configuration.nix to the the host folder...
do you remove the inputs.home-manager.nixosModules.default from the modules in the flake config?
in the video... about the 13:40 mark the flake no longer has the inputs.home-manager line in the modules...
is that b/c its in the congifuration.nix imports section?
@@vimjoyerjust add a text pop up with the correction
Estava pensando em começar a usar essa distro, essa é uma boa oportunidade começar
👍
Estou usando há mais de um ano, é a melhor distro que já vi porém devo te avisar que requer uma quantidade de tempo decente para poder realmente entender o sistema e seu paradigma. Tem vários sites que explicam hoje em dia e ótimos youtubers também então é bem mais fácil do que quando eu comecei, recomendo muito caso você queira aprender algo novo ou tenha interesse em devops.
I love the idea of NixOS. The Nix package manager has packages for DaVinci Resolve out of all things and is super simple to install Hyprland with. Unfortunately Nvidia and NixOS don't work so well together and kept getting visual bugs on bare metal. When I get an Intel or AMD card I'm definitely going to continue with NixOS.
Okay! That was a ride. Finally made it to the end of the video (I mean, doing the thing, I've probably watched it 20 times additively)! Now I'm being stumped though: why are you moving /e/nixos to ~/ ?
I did it thinking it was about making is a non-root directory and now I'm hella confused with my super obsolete memory of how to do permissions in linux.
Edit: nevermind, figured out the permissions. Totally forgot x was needed to ls in a directory.
Now I'm still stumped by the fabled sudo-less rebuild, but I guess more friendly manual ahead!
... Diving back into Linux with NixOS was probably a bad idea, but hey. Mama didn't raise no quitter
I rewatched this video like 10 times (5 because I was slow and 5 times the default gnome browser froze the video). Also you talk fast and do things fast but treat it as a compliment because it's better to rewatch video than wait for some guy to think and make sounds of thinking 😂😂😂
Yeah, I hear that quite often. I'm still learning to maintain a good pace
Sub earned
all i got was a ton of errors. nix is a pain in the behind. wish the docs were clearer.
Before watching. No way! How are you gonna do this in 15min???
After watching. Wow, great job!
I couldn't fit everything in, but the most essential parts to get a working system are there.
Thank You!!!
You are welcome!
goated
i did not know father made linux tutorial
Дякую.
I have an extensive /etc/nixos/configuration.nix file declaring the installation of applications for R and python suitable for a data science / data analysis / machine learning workstation. The channel is nixos-23.05. Everything built for my 2023-11-04 installation, but if I try to rebuild anything now, I get errors. The errors are all "dependencies of derivation ' . . . ' failed to build. Some examples are python3.10-jupyter-server-2.0.6, python3.10-notebook-shim-0.2.2, sage-with-env-10.0, r-quarto-1.2, RStudio-2022.07.1+554-wrapper, etc.
Am I receiving these 'failed to build' errors now because the channel is 23.05? Recommendation? Switch to 24.05 (unstable) or to 23.11?
Дякую!
Будь ласка!
can someone tell me how to install ruby 2.4.t as in ubuntu im using rbenv to do so how can here we achive this
I'm trying NixOS as a Virtual Machine on my Macbook M1. In case anyone is trying also, I had to make a minor adjustment to the flake.nix to change the processor architecture. In the `outputs` section, change the system variable to "aarch64-linux", i.e.
system = "aarch64-linux";
could you make a tutorial on how to customize zsh with detail using home-manager?
can you make a tutorial on cron job in nixos please? I find it quite hard to implement
Great video. Two questions (1) When you do the rebuild, do you always use the flake command or non flake version?
(2) For the portion about further splitting your config files, can you elaborate or point to the import/export setup? I assume this means I would instead setup something like the alacrity config in the modules, then import into home.nix?
Use --flake for rebuilds. Non--flake version will use system's nixpkgs channel and won't include any modules you imported in your flake.
this is not worth using i already got nixos setup and now switching it all to homemanager and flakes is not worth it i have to take LSD to be able to figurethis out liek wtf
Instructions unclear, trip is over and now templeos is installed on both my gaming pc and my work laptop...
gruvbox
Rejoice! A video I can send to my ffriends :)))))
i am try to read nix doc, watch some nix conference. but still couldn't achive this whole understanding.
flake 'path:/etc/nixos' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."default".config.system.build.nixos-rebuild', 'legacyPackages.x86_64-linux.nixosConfigurations."default".config.system.build.nixos-rebuild' or 'nixosConfigurations."default".config.system.build.nixos-rebuild'
Did you mean nixosConfigruations?
Everything breaks down at 12:16 for me: The command "nix run home-manager/master --init" doesn't run, whether I include the && sudo ... second command with it or not. Complains about the --init flag. Anybody else have that problem?
There's a space after --
The -- is there because you stop passing arguments to nix and start passing them to the program (home-manager in this case).
Do I still need to add home-manager package in system packages with this approach? I cannot run 'home-manager' commands
No, it will integrate with your regular system generations. nixos-rebuild switch will also update home-manager, and rolling back to an older generation will happen for both too
how did you get syntax highlighting in your man pages? is it because of the zsh or your terminal? Mine is all just white on black.
Probably zsh
You can also use nvim as a pager btw (PAGER="nvim +Man!"), which is much nicer imo, since all familiar controls are available.
Hi Vimjoyer, Thanks for the great video! Also I have a question, there is a folder located at ~/.config/home-manager with a flake.nix and home.nix file. Are they necessary files for home manager or are they safe to delete?
They are safe to delete with this setup. You can regenerate them any time with `home-manager init`.
@@vimjoyer thank you!
Could you please explain what the `default` in `inputs.home-manager.nixosModules.default` refers to? Can/should it be changed if I have multiple hosts?
it refers to a module provided by home-manager that gives you the special `home-manager` option.
`inputs.home-manager` part means that it comes from your flake inputs, and `nixosModules.default` is located in home-manager flake's outputs.
It should stay the same for every host that needs to use home-manager
@@vimjoyer thx!
The 'extraSpecialArgs' at 11:18 gives the following error:
error: function 'anonymous lambda' called with unexpected argument 'extraSpecialArgs'
I need to switch it to 'specialArgs' for it to work.
yes, I made a mistake while editing the video
Are there any recommended guides on installing Nix with disk encryption?
NixOS wiki includes a couple of links at the bottom:
nixos.wiki/wiki/Full_Disk_Encryption
Thank you for the video, system configuration is stored in configuration.nix and you can rollback, but can you rollback also nix flake upgrades? Is it a simple change on pointing to anothe hash commit?
It's best to keep your flake.lock under version control with something like nix. The you can easily roll back updates by going to an older commit
I'm having trouble with the last part of the video where you nest your configuration files. When I import the configuration in the same folder as just ./configuration.nix it's working, but when I move my files and point to ./hosts/default/configuration.nix I'm getting an error:
error: getting status of '/nix/store/n392z7lcgs3dsf1pb4nf95hap00wrzb6-source/hosts': No such file or directory
Earlier in the error chain it is saying:
throw "Module imports can't be nested lists. Perhaps you meant to remove one level of lists? Definitions: ${showDefs defs}
I can't figure out where it's going wrong?
If you are using git, make sure to add all changes before rebuilding. flakes don't see unstaged directories and files.
One thing is that I wish there were tools to streamline some parts of Nix. For instance Homemanager is great in concept but it means anytime you want to configure a program you *_need_* to interact with it's config file directly, figure out how to get the change you want, and make/modify the module for it.
I wish there was some diff integration tool or something that could look at the state of your config file(s) and autogenerate/modify a basic module to basically "pull" those changes into your nix config.
Nix is great in a lot of ways but it's those little usability hurdles that do really annoy me. There are times when you just want to change a setting without needing to directly fiddle with the config files. (Sorta like how nix shell just lets you install and run something without *_actually_* having to install it)
There are a couple of GUI tools to edit your nix files, but they aren't much simpler than just editing a file. You could use some kind of sed script to do it, but yeah ... not ideal. Maybe some day
Hi, thank you for the video, I’m using Nix on macOS, and it changed my life. May I know your hardware for NixOS? I’m considering to get a device for NixOS. I see people using Wayland for window manager, I’m also interested in it.
I'm using a Lenovo Legion 5 laptop with RTX 3060 and and cpu
I keep telling myself that when I get a 2tb SSD I will put on a couple of OSes on it, and Nix might be the first one, followed by Gentoo and Arch
is it safe to use the configuration.nix file to reproduce a nix install if the `system.stateVersion`s are different?
Yes
What software do you use to generate the animated transitions between different versions of text files?
motion canvas
so i made it to the end and it made sense, kind of, but the structuring part threw me off a bit, i think when i do this i wont bother with that for now. i watched someone else do a video on flakes and created "my first flake!" however there was an added layer of complexity to theirs because they copied the configuration.nix from /etc/nixos/ to a new folder in ~/ and then the output for the flake was that new config file, so i ended up with 2 configuration.nix, not knowing what the point or purpose of the 1 in /etc/nixos/ was anymore.. thank you for the video, my head is actually hurting which is a good sign that i may be close to learning something new if i stick to it
do you have any reccomendations for a text edtior that shows the tree or structure (sory i dont know the terminology) of whatever it is you are editing e.g. if i had flake.nix open in it, it would list stuff from that flake.nix in an almost file browser tree kind of way on the side somewhere? (if you want to know what i mean then if you search for 'nix flakes' on youtube his video is the purple 1)
My editor of choice is neovim, and it has a ton of different file manager plugins.
NvimTree and NeoTree plugins display directories in a tree-view, and you can even integrate your favorite TUI file manager (e.g. LF or ranger) into it.
Дякую! Крутий контент! Круто було якби плейлист був також на Українській 😊
Чесно кажучи, звук для мене - найскладніша частина, тому для запису двох треків знадобилося б занадто багато часу
Is there an easy way of referencing the modules folder in the root directory from a nested file, like in a host?
I am using this to import modules, but its quite long if I wanted more modules:
imports = [
../../modules/home-manager/programs/nvim
..
];
I am thinking of just shortening the start and appending "nvim" and so on for each program, but it could be nice with something like
inputs.modules.programs.nvim
you can do that with outputs. do a
let
inherit (self) outputs;
in
in the inputs, and then pass outputs to specialArgs. you'll be able to access all other outputs that your flake provides in every module, so you can then define your modules in the flake.
@@vimjoyerYou can also just use self directly as well no?
Thanks I will do that :)
@@benign4823 of course
8:38 - I'm curious, how'd you get these icons in your ls output? Is there some option to ls that I'm not aware of? A different version of ls, perhaps? Or are you just post-processing it manually for the video? Other? Curious to know more (even in the post-processing case, I'd be interested in what your method for doing so is)!
ls is aliased to eza on this screenshot, but in newer videos I'm using video editing magic for this.
@@vimjoyer cool, I'll check it out. (I also found els, which I guess is similar.)
Can I easily migrate if I'm currently managing my dotfiles with yadm on a regular distro ?
Never heard of yadm, but you can probably use it on NixOS and gradually switch to nix if you want
What theme do you use for your code? It looks awesome!
Everything you see in this video is done with motion canvas.
Can you tell me please, why intalling the nix package manager forces me to install the whole shitty aws sdk as dependency even if I do not use amazon server?
🤷♂️
For some reason after doing the setup for homemanager and trying to rebuild the process just stops with exitcode 9. --It doesn't give any error messages or anything, the terminal tab just closes itself.-- Running the command with --verbose tells me "home-manager.specialArgs" doesn't exist in configuration.nix even though I clearly wrote it in there? What am I doing wrong?
use `home-manager.extraSpecialArgs`
@@vimjoyerThanks, will try!
ur def from the bulkans /eastern eu
Ukraine
Can you try GuixOS? I've been very curious because on paper the features and design seem better, especially since everything is in scheme, but adoption seems much lower.
One if it's features is total absence of proprietary software in it's repos. I'm primarily using nixos on desktop machines with Nvidia, so guix won't do for me without a ton of workarounds.
I also like nix language a lot more than guix lisp. json-like files are easier to read and edit.
I might do a comparison of the two, but I can really see why adoption in lower.
Quick question, if I'm running nixos 24.05 and my flake (your template) specifies in the inputs the nixos-unstable channel, does that mean my whole system will move to the unstable branch when i do the rebuild (with the --flake flag) ?
Yes
@@vimjoyer thanks a lot, I'm new to nixos so i will change the unstable part for my current 24.05 version. Not sure if unstable really works like a rolling release but in arch linux i get so many updates constantly... thanks again!
Can you tell me if its worth it to switch Form arch to nixos.
@@X_Otman I still run Arch as my main distro, but I play with NixOS in a virtual machine. I have to say that I'm impressed. The tthings you can do and how you can replicate them so easily, it's awesome.
I'm planning to switch in the next weeks, just need to backup some files. That said, the first week learning Nix was really difficult, and I still don't fully grasp everything, it's a massive rabbit hole, but i think it's worth the price.
@@eduardabramovich1216 Thanks alot for the info, im gonna start learning it. =)
What is a fresh package? I keep hearing that term but I don't get the difference between a package and a fresh package.
Fresh packages are packages that are up to date with the latest versions of software. For example, if a package contains software with version 0.10, and the latest GitHub release is also 0.10.
Im having problem adding hosts cannot no file or directory. It only works if a rename it to default
If you are using git make sure to add all files, flakes don't see unstaged files
@@vimjoyer yes that was it thanks for the help!
Hey, I don't have the `man home-configuration.nix` command working after following the video. What can I do?
Check if your home-manager module is enabled and home-manager itself is working
You have to rebuild before you can use the manpage.
I have a working NixOS 23.05 last updated / built with Generation 35 on 04 November 2023. I cannot get it updated, and switching to the latest channel did not help. It builds tons of packages and after 2h36min of $ nixos-rebuild build, fails with dependencies of dbus, unit-accounts-daemon, unit-polkit.service, user-units, and X-Restart-Triggers failing to build. It is odd that everything built from the 23.05 Stoat channel to get me to Generation 35 on 04 November 2023, but now I cannot update or upgrade this 23.05 to 23.11 Tapir (also tried) and 24.05 Uakari.
My only thought is to take my configuration.nix file and use it to install a fresh unstable / 24.05 Uakari into another partition to see if a # nixos-install can build this configuration.
Tough problem, I'd suggest incrementally move features to a clean configuration, while separating everything into modules so it's easier to work with it in the future.
@@vimjoyer, I finally got around the blocks to the building process. There was a printer driver that I had to leave out and an R package that had an incorrect SHA256 checksum. I'm running my declared environment with the unstable channel. I didn't need to break things down into modules, but thanks for the idea. I may need to use modules in the future.
What is the relationship between a channel url and the nixos/nixpkgs/nixos-unstable url?
repo owner on GitHub / repo name / branch or commit
Repo owner on GitHub / repo name / branch or commit
I rather manage home-manager apart from the system configuration, I feel cumbersome to `sudo` into a file that could perfectly live next to the rest of my user files.
Yes, but for beginners, I think it's easier to have everything in one command. Additionally, home-manager rebuilds are stored with system rebuilds, making rollbacks easy
early on, when trying to rebuild, I get the error that no matches are found: /etc/nixos#default. what am I doing wrong?
You probably missed something, but there is not enough context to know what.
Make sure that flake.nix file exists in /etc/nixos, that command you are running is correct and that you are using sudo.
Ive added the experimental feature flakes to my /etc/nixos/configuration.nix file. Wrote the starter config to /etc/nix/flake.nix using sudo. when running the command `sudo nixos-rebuild switch --flake /etc/nixos#default` it returns `no matches found: /etc/nixos#default`. perhaps I missed a step from a prior video?
@@vimjoyer
Вітання))
Nix users 5 seconds after installing an OS that only has 1 config file for literally everything: hmm, this is nice, but how can I add more config files?
You can put your entire configuration in the flake.nix btw (cursed)
So at the end of the day we end up with multiple config files. Kind of the opposite of NixOS' premise of having just one no?
Ideally you should aim to reuse like 90% of the config with modules. Your machines will likely have different hardware and serve different purposes, so nixos lets you choose which parts you want to sync between them.
@@vimjoyer Ok but I can still put all the softwares configs in configuration.nix if I want?
@@mactemporal1980 Yes. The primary purpose of him doing this is to have slightly different configurations across different machines to suit them. If you plan on having just one machine, it can be one file. If you want the same software across different hardware configurations, best to have at least two files: one for software, one for hardware.
the terminal theme looks pretty , where can i get that on ubuntu
Colorscheme is called gruvbox, and the prompt is just a custom PS1
Do note that in addition to searching packages, the same website has an option searching function that you can use instead of searching through man.
Which ohmyzsh theme are you using?
I don't use ohmyzsh
@@vimjoyeroooh, okay. I really like that prompt, mind sharing your dotfiles or something?
Why are you using the unstable branch? I think most people would probably want to use a stable one, just so nothing unexpected breaks.
Upstream branch is where everything starts breaking. Unstable is not bleeding edge, so it's a perfect middle ground between having super fresh packages and well tested tested ones
Could anyone please tell me what font he is using
Jetbrains Mono NerdFont
@@vimjoyer Thank you so much! Great video btw!
what theme is that?
Gruvbox