Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] README snippet for usage outside NixOS #1

Open
toonn opened this issue Apr 14, 2020 · 4 comments
Open

[Feature request] README snippet for usage outside NixOS #1

toonn opened this issue Apr 14, 2020 · 4 comments

Comments

@toonn
Copy link

toonn commented Apr 14, 2020

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?

@pmiddend
Copy link
Owner

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.

@toonn
Copy link
Author

toonn commented Apr 17, 2020

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?

@pmiddend
Copy link
Owner

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?

@toonn
Copy link
Author

toonn commented Apr 17, 2020

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 ];
  # ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants