this post was submitted on 10 Nov 2025
8 points (83.3% liked)

Nix / NixOS

2513 readers
20 users here now

Main links

Videos

founded 2 years ago
MODERATORS
 

Almost every NixOS tutorial I encounter, be that blog or video, says to use Flakes and Home Manager. While that definitely speaks to the value of these tools, I find myself, instinctually, wanting to avoid them. I’ve attempted to get them working multiple time, and encountered more issues than they solved, for me. I interpret this to mean my knowledge and/or use case of NixOS is not ready for me to use these tools effectively. On top of that, something about a set of files that could all be put into a single unified config appeals to me (which flakes/hm can probably do too, but hopefully to get my vibe).

My reasoning aside, this has made me curious if there is some way for me to “backport” all these configs I encounter into my set of more default style configs. The primary goal I have that lead me to this is rootless Podman and declaring my containers in the config. If anyone has any guidance or resources you could point me to it would be much appreciated.

you are viewing a single comment's thread
view the rest of the comments
[–] Paulemeister@feddit.org 2 points 17 hours ago* (last edited 17 hours ago) (1 children)

I would do them one after another as the two both solve different problems. If you want to use both, first start with using flakes.

Flakes are basically sets defining inputs and outputs. Then with a flake lock and exact version of the inputs can be pinned as to make it reproducible. Just add a basic flake.nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; }; outputs = { self, nixpkgs }: { # replace 'joes-desktop' with your hostname here. nixosConfigurations.joes-desktop = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ./configuration.nix ]; }; }; }

Also you should add nix.settings.experimental-features = ["nix-command" "flakes"]; to you configuration.nix

Make sure you track everything by git if your config lives in a git repo and you should be done. Of course you can have more inputs, propagate them to your modules and so on, but this should be fine for the start.

Now you have to add the' --flake' option to 'nixos-rebuild switch --flake' (please double check, as I use nh as a wrapper) and it will probably complain that you haven't enabled flakes and that they are experimental, but you can run the command again with an environment variable set and get around that. You could also have added the flakes feature in your configuration nix first, do a normal, non flake rebuild switch and then one with flakes, as then you are running on a system generation with enabled flake features.

Home manager, as the name implies tries to manage your home directory, so instead of adding packages and configs in your configuration.nix systemwide, you can add them only to your user directory. Basically you can add home manager and just not use it a t first and slowly migrate everything to it. You'll have to look up a tutorial for it. But basically everything you put in environment.systemPackages configuration.nix can go into home packages in your home manager config file. The module options are often similar, but some are just not possible to configure on a per user basis (like adding desktopManagers, though configuration them in the user directory is better done through Homemanager)

But that's what any tutorial would show you. I'm assuming as you already use NixOS you're somewhat technically inclined, so I'm not sure how to help you here. If you have any problems just comment here, I'll help you debug / convert your config with you

[–] Arkhive@piefed.blahaj.zone 1 points 8 hours ago

Lots of good suggestions from people, and replying individually was going to be a mess. Please see the comment I added.