I use GNU stow for my dotfiles because I like it better than the way home manager does it (but I still use home manager for other things). Big piece of advice I’d give is to just remember, as you learn Nix stuff and get all excited about “reproducibility” and “declaring” things, that you don’t have to do everything the Nix way. You could very easily have a single configuration.nix file that mostly just specifies packages and then do nearly everything else the old-fashioned way. It’s your system and your comfort. (But for the record, I used arch-based systems for a long time as well, and though it took me about a week to figure out what I was doing in a NixOS VM, the satisfaction when I finally deployed to bare metal and everything just worked exactly as I intended it to was quite nice). And as others have said here, nixpkgs is massive and likely has all of what you need.
Nix / NixOS
Main links
Videos
+1 for this! There's nothing wrong with just using the nix package manager either. nix-env
and nix-shell
are awesome tools
I've heard there are some issues with regard to the FSH
Most binaries, not patched for NixOS, don't work out of the box, but usually what you need is in Nixpkgs. If it isn't, then you have to wait for someone to package it or package yourself and that unfortunately requires some effort
Or you can always spin up a distrobox container and install it there, too.
It doesn't have to be an all or nothing approach. I wanted to switch to Nix but got lost way in the weeds with declarative partitioning, immutable OS with impermanence and snapshots, fucking coding my own gnome shell with AGS/Astal for Hyprland, and making overrides for bleeding edge software updates from GitHub.
Realising it was going to be a hot minute before I had a daily driver OS, I started using Home Manager on my Ubuntu daily drivers and installing NixOS on some spare hardware to tinker with.
The majority of the apps I use are now managed through Nix the package manager on all my Linux systems.
I do use flakes and what's installed on Ubuntu is managed with the same files as my NixOS builds. So far I'm really happy with it.
Flakes are only important if you want to develop for a nix system. If you are only using it or if you (like me) only writes server code which gets deployed via docker (or your language packaging solution) there is no need to think about flakes.
A counterpoint to this is that Nix without flakes is unusable to some, even if its just because of the better CLI interface.
A counterpoint to that is that nix with flakes in unusable to some. It's experimental and stuck in some limbo state unclear what's going to happen with users demanding features for it to be declared stable and maintainers unwilling/unable to change anything for fear of breaking it.
Anti Commercial AI thingy
CC BY-NC-SA 4.0
I use a single flake with outputs for all my nixos and home manager only (Ubuntu) systems. I just started messing with nix in December. I have no idea what the old way is, but I've been happy with flakes.
That's not what flakes are important for at all.
Though unless you already know what flakes could do for you, I agree, you don't need to even think about flakes. They only concern one specific aspect of Nix and aren't even the only solution to that problem.
If you want to switch slowly, I would install nix and home manager on your Arch system, and slowly migrate your dotfiles, configuration, and packages into home manager. That will give you a comfortable transition opportunity to learn nix. Then, the last 10% of system configuration you can figure out when you install NixOS, and you can just pull in your home manager config for all your userspace dotfiles and programs. Thats how I moved from Ubuntu to NixOS.
And yes, you can have home manager just symlink existing config files to the appropriate location. You don't have to rewrite everything in nix.
Secondly, the dotfiles. I hear there is the Home Manager for that, but it doesn't have support for everything, so some files would need to be managed in other ways.
Here you can check if something is supported by home manager: https://home-manager-options.extranix.com/
If something isn't supported, you can just manage it's dotfiles like you did on Arch. But probably home manager will cover everything you need
I switched from Arch to NixOS around Nov 2023 and manage my systems and my family's off of one flake. Dotfiles are managed within my flake (if easier), an exception would be Emacs, which I use syncthing
between my Nix systems and a work Windows PC with straight
.
Discourse, Discord/Matrix, the wiki and various blogs are places to learn from. Documentation is sometimes difficult to splice together, other times very intuitive, but others can help direct you. Just leave some lead time for people to get back to you.
If you can figure out how to do gaming on Arch, you can figure it out on NixOs. Add to you config or flake slowly and back it up somehow before making changes, along with important files. You can always rollback or if you do manage to nuke it (I have twice due to lack of HD memory), reinstall and be up and running in a short time frame as long as you have your config somewhere.
I've done more on NixOS in a shorter time than I ever had on Arch, but also learned a lot from Arch which helped. Try it out on an old machine or VM to see what you can do with it. I've plateaued at getting a server up and running, and ricing hyprland
, but that is due to lack of time and close to zero knowledge.
Secondly, the dotfiles. I hear there is the Home Manager for that, but it doesn’t have support for everything
In this case, you can use home.file
option of home-manager similar to environment.etc
of NixOS configuration.
For example, let's configure dunst with home-manager [^1]: [^1]: https://nix-community.github.io/home-manager/options.xhtml
In case home-manager doesn't support it:
# installing the package
home.packages = [ pkgs.dunst ];
# configure dunst
## writing new config
home.file.".config/dunst/dunstrc" = {
text = ''
[urgency_critical]
timeout = 15
'';
};
## using existing config
home.file.".config/dunst/dunstrc".source = "/path/to/existing/dunst/config";
If home-manager supports:
services.dunst = {
enable = true;
# using existing config
configFile = "/path/to/existing/dunst/config";
# new config
settings = {
urgency_critical = {
timeout = 15;
};
};
};
Is there a way to manage everything at the same time?
Yes, create a git repo and keep your configuration there. Don't keep secrets unencrypted in there as those will end up in world readable /nix/store. Any user where system or human can access those. You can use any scheme to manage secrets at wiki^2.
Even better if everything is in configuration.nix
You can do everything in single file but I wouldn't recommend it as configuration may grow quickly and be difficult to manage later. Instead you may split the configuration.nix into multiple files and import those in configuration.nix.
Flakes simply helps to manage the inputs easily (e.g. nixpkgs, home-manager), i.e., which version of input your config uses. Traditionally inputs is managed by nix-channel imperatively. It generates flake.lock to store the hash of inputs which won't be updated unless you update it. If you copy the config between different machines (or reinstall), you'll get exact same version of packages. It also helps avoid adding nix-channel, which you have to add manually during reinstall and you may not get the same version of packages. So, it's not important as you can do all things with/without it.
I found this guide ^3 quite helpful to start with flakes. You may use one of Misterio77's starter configs^4. Also, a big surprise with flakes is that if you don't use git, then your all files from config dir will end up in /nix/store (world-readable[^5]) ^6 ^7. So, you should use git with flakes that way only commited files will end up in /nix/store(world-readable).
[^5]: By world-readable, I mean any service or program can access those files
Ohhh, I didn’t know that about home manager. That solves everything, awesome. Thanks!