NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.03k stars 14.03k forks source link

Incompatibility between nixpkgs.pkgs option and files from nixos-generate-config #49424

Closed LisannaAtHome closed 2 years ago

LisannaAtHome commented 6 years ago

nixos-generate-config can produce hardware-configuration.nix files that depend on <nixpkgs>, which can screw up evaluations that are using pinned versions of nixpkgs via the nixpkgs.pkgs option. If <nixpkgs> points to a version of nixpkgs that's significantly different than the one pinned via nixpkgs.pkgs, the evaluation can fail in spooky and byzantine ways.

Example:

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:

{
  imports =
    [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
    ];

IMO this limits use of the nixpkgs.pkgs option to only extremely expert nix powerusers. There's no way an intermediate Nix or NixOps user would be able to discern what's wrong from the kinds of failures this can produce.

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
Artturin commented 2 years ago

Fixed because modulePath is being used now