this post was submitted on 12 Nov 2024
13 points (100.0% liked)

Nix / NixOS

1762 readers
20 users here now

Main links

Videos

founded 1 year ago
MODERATORS
 

I've been trying nixos recently and after watching a bunch of tutorials from various people, I have managed to enable home-manager and flakes.

My question is: where should I write the packages I want to install? In home.nix? In flakes.nix? In configuration.nix (probably not)? I'm probably only gonna have a single user on this machine.

So far, I think the only difference between writing the packages in home.nix compared to flakes.nix is that in the 1st senario, the apps will only be available for the user, while in the 2nd, it will be available for the whole system. Also, I could use the home.nix for non-nixos systems too. Other than that, I can probably write them the same way either on home.nix or flakes.nix and have the same result on my machine.

PS. On search.nixos.org there is an option to search for flakes. What is this? I am planing to get my packages from the packages tab, but I'm wondering that maybe I should search in the flakes tab instead (though it doesn't seem to have many packages).

PPS. Those are some resources I've found (I've mainly watched the videos and have started reading some of the guides):

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 3 points 2 days ago (1 children)

Personally I just put all my packages in configuration.nix (well, broken up into different files but all in environment.systemPackages). I only use home manager for extra config options for programs like Git, Neovim, or VSCodium. I only have one user so I see no reason for me to separate them.

I never use the flakes search, if I find a flake on github or somewhere then it will say how to add it as a flake input and enable it. That's mostly for extra modules or things like beta versions of software that haven't been added to the official repos yet, almost all of my packages are from the standard packages.

[–] [email protected] 3 points 2 days ago (1 children)

I should suppose that you have flakes enabled and have imported the configuration.nix inside flakes.nix, thus keeping everything versioned with flakes.lock, right?

[–] [email protected] 3 points 1 day ago (1 children)

Yeah, and I have home-manager as the nixos module, not standalone. My config is here if you were interested. Some of it is a little messy but it's pretty good.

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

Oh thank you! Will take a look and see what I can use for mine:)

It's so cool that you can do all these with nixos