nixos-manager
nixos-manager copied to clipboard
[Feature request] README snippet for usage outside NixOS
As many people get started using Nix on other distros, because they're not ready to take the plunge and install NixOS or are intimidated by the install process, it'd be cool if this tool could be used with nix-env or home-manager.
Since packages.nix
is supposed to be a flat list of packages I think it could easily be used as the paths
for a buildEnv, something like this overlay maybe:
self: super: {
nixos-manager-packages = pkgs.buildEnv {
name = "nixos-manage-packagesr";
paths = import ./packages.nix; # Expects a list of packages
};
}
For home-manager I'm sure a similar snippet could be added to the README. Including support for configuring home-manager's services and other configuration would probably require changes to the implementation?
Thanks for the issue @toonn. I thought about it, and I think you're right. Currently, I'm not sure how to approach it, but I'll experiment with implementing a home-manager-only version of NixOS manager and see what the challenges are (I suppose supporting both home-manager and NixOS would be a little overkill at this moment). If we were to support home-manager's declarative service configuration, we'd need a JSON file, similar to the one that's downloaded currently, containing the service descriptions and, most importantly, the option types. I don't know if this exists or if it could be created.
That's neat for the long term. How about snippets for just using the packages.nix
from a config.nix
with nix-env or home-manager configuration though?
Okay, you have to help me out a bit here, since I haven't used overlays before. According to the Wiki, you can put your overlay config into ~/.config/nixpkgs/overlays
and it’ll be used? And what does packages.nix
have to look like, then?
This section of the manual has an example.
For home-manager it should be similar, using the home.packages
option:
{pkgs ? <nixpkgs>, ...}:
{ # My HM config
# ...
home.packages = (import ./packages.nix)
++ [ pkgs.four pkgs.manually pkgs.added pkgs.packages ];
# ...
}