this post was submitted on 19 Jul 2023
6 points (87.5% liked)

NixOS

232 readers
1 users here now

NixOS is a Linux distribution built on top of the Nix package manager. Its declarative configuration allows reliable system upgrades via several official channels of stability and size.

This community discusses NixOS, Nix, and everything related.

founded 1 year ago
MODERATORS
 

My understanding is like this. For multi-user computers, you'd manage packages with home manager. If you're developing a project or need some kind of specific built tool or dependency, define in it in a flake.nix or shell.nix or build.nix in the project folder. And for single user computers, or maybe admin accounts install at NixOS configuration.

Whats the intent for each location? The current question Im asking myself is "why install home manager when Im on a single user instance and can just update configuration.nix?"

top 4 comments
sorted by: hot top controversial new old
[–] Spott 3 points 1 year ago (1 children)

Home manager manages dot files, which aren’t managed at the Nixos config level. Sine this means managing the version of the corespondent package related to a dotfile config, home manager has to manage packages.

So, in my world: the only thing in home manager are programs which have dot files that need to be managed… everything else is in the Nixos config level. Except for local dev environments, which have flakes associated with them.

[–] [email protected] 1 points 1 year ago (1 children)

Have you ever found yourself installing something at the OS level, then realizing you'd want to customize it and moved it to your home manager installation?

I hadn't considered configuration. When I browse through the home manager options it's obvious just how many more settings can be set and tweaked. Thanks

[–] Spott 2 points 1 year ago

I wish you could config defaults for zsh/nvim in the Nixos config. I have some servers that are generated from a config file and then meant to not be managed after that (so I build a sd card for them and insert card and they are booted into a working system. If a configuration needs to change, the idea is that I rebuild the sd card rather than rebuild on the server.)

[–] [email protected] 2 points 1 year ago

If you're just handling one single-user computer, just use configuration.nix. Also, stuff related to admin, system maintenance, or anything host-specific goes here.

As you say, if you want a portable config you can use on many computers for yourself, home-manager is your friend. I use it for all my systems, NixOS and otherwise.

I only use nix shell if I need something once, or at least rarely. It's for one-offs.

If I'm writing or packaging something I'll use a flake...but if I want it installed on my systems I'll import & use the flake in either my system or home-manager config. Define a package and an overlay, at which point it's just a regular package.