Nixpkgs: Delete NIXOS_EXTRA_MODULE_PATH environment variable?

Created on 27 May 2019  路  7Comments  路  Source: NixOS/nixpkgs

Issue description

Could we delete the environment variable NIXOS_EXTRA_MODULE_PATH?

From the docs: https://nixos.org/nixos/manual/#sec-importing-modules

it is yet another source of implicit state with no good reason for it to be there.
You can already import modules by path using:

imports = [ ./my-module.nix ]

The original commit message that introduced this:

tree 233e56b7fec3f3c24b55bc322f219dec09fb0be8
parent 8bfd6af9ed0eb774035431dab663ee131941a971
author Mathijs Kwik <[email protected]> Tue Dec 16 17:07:14 2014 +0100
committer Mathijs Kwik <[email protected]> Tue Dec 16 19:13:15 2014 +0100

nixos: allow adding extra modules through environment

This is useful for adding extra functionality or defaults to _every_
nixos evaluation.

My use case is overriding behaviour for all nixos tests, for example
setting packageOverrides to newer versions and changing some default
dependencies/settings.

By making this accessible through an environment variable, this can now
be fully accomplished externally. No more need to fork
nixos/nixpkgs (which becomes a maintenance burden), just use the channel
instead and plug in via this envvar.

The usecase described in the commit message seems to be superseded by the fact
that nixos tests are now part of the all-packages.nix fixpoint.

  nixosTests = import ../../nixos/tests/all-tests.nix {
    inherit pkgs;
    system = stdenv.hostPlatform.system;
    callTest = t: t.test;
  };

So overriding packages for all tests should work fine, with for example packageOverrides or overlays

Rationale

I'm slowly cleaning up eval-config.nix to a point that we can basically replace all its uses with lib.evalModules as was suggested in the comments of eval-config.nix

# !!! Please think twice before adding to this argument list!
# Ideally eval-config.nix would be an extremely thin wrapper
# around lib.evalModules, so that modular systems that have nixos configs
# as subcomponents (e.g. the container feature, or nixops if network
# expressions are ever made modular at the top level) can just use
# types.submodule instead of using eval-config.nix

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the
results.

Most helpful comment

:+1: on getting rid of this and preferably other ad hoc environment variables (like NIXPKGS_CONFIG and NIXOS_CONFIG).

All 7 comments

cc @shlevy as you left the comments about the idea to clean up eval-config.nix in the first place

:+1: on getting rid of this and preferably other ad hoc environment variables (like NIXPKGS_CONFIG and NIXOS_CONFIG).

I guess NIXOS_CONFIG is superseded by -I nixos-config=blah right?

Turns out the use case by the OC is not fixed currently. Overlays have no effect on nixosTests https://github.com/NixOS/nixpkgs/issues/50301

There is an actionable issue for fixing that https://github.com/NixOS/nixpkgs/issues/55798 so I think we should just do this, and remove all the ad hoc environment variables. I'll come up with a PR

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.

@edolstra does your work on flakes solve this? Given that build contexts now need to be 'pure'

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vaibhavsagar picture vaibhavsagar  路  3Comments

matthiasbeyer picture matthiasbeyer  路  3Comments

lverns picture lverns  路  3Comments

teto picture teto  路  3Comments

ob7 picture ob7  路  3Comments