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

support multiple instances of nixpkgs #22

Open
zimbatm opened this issue Jul 2, 2024 · 2 comments
Open

support multiple instances of nixpkgs #22

zimbatm opened this issue Jul 2, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@zimbatm
Copy link
Member

zimbatm commented Jul 2, 2024

At the moment, only the "nixpkgs" input is used to:

  • instantiate nixos instances.
  • configure the pkgs argument.

Some users might want to use different versions of nixpkgs for different machines (eg: stable and unstable)

@zimbatm zimbatm added the enhancement New feature or request label Jul 2, 2024
@kriswill
Copy link

kriswill commented Jul 7, 2024

or, use multiple nixpkgs? For instance, I like my OS nixpkgs to be pinned to the current nixos-release tag, but use certain applications from the unstable, or even trunk...

@zimbatm
Copy link
Member Author

zimbatm commented Jul 7, 2024

The current workaround is to create a modules/common/nixpkgs-unstable.nix module.

{ inputs, pkgs, .... }:
{
  _module.args.pkgsUnstable = import inputs.nixpkgs-unstable {
    inherit (pkgs) system;
    config.allowUnfree = true;
  };
}

Then import it in whatever module needs it:

{ flake, pkgsUnstable, ... }:
{
  # Import to add the pkgsUnstable argument
  imports = [ flake.modules.common.nixpkgs-unstable ];
  # Pull the package from pkgsUnstable
  services.myservice.package = pkgsUnstable.myservice;
}

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

No branches or pull requests

2 participants