modules/nixpkgs: don't set args.lib

`lib.evalModules` always includes `lib`, `config`, `options`, &
(configured) `specialArgs` in the (final) `specialArgs`[1].

Therefore, setting `_module.args.lib` has no effect.

[1]: 329d232802/lib/modules.nix (L233)
This commit is contained in:
Matt Sturgeon 2024-07-02 20:22:34 +01:00
parent 11df0d6c9e
commit 87f50db84d
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -1,24 +1,16 @@
{ { defaultPkgs, lib, ... }:
defaultPkgs,
pkgs,
lib,
...
}:
let let
# TODO: https://github.com/nix-community/nixvim/issues/1784 # TODO: https://github.com/nix-community/nixvim/issues/1784
finalPackage = defaultPkgs; finalPackage = defaultPkgs;
in in
{ {
config = { config = {
_module.args = { # We explicitly set the default override priority, so that we do not need
# We explicitly set the default override priority, so that we do not need # to evaluate finalPkgs in case an override is placed on `_module.args.pkgs`.
# to evaluate finalPkgs in case an override is placed on `_module.args.pkgs`. # After all, to determine a definition priority, we need to evaluate `._type`,
# After all, to determine a definition priority, we need to evaluate `._type`, # which is somewhat costly for Nixpkgs. With an explicit priority, we only
# which is somewhat costly for Nixpkgs. With an explicit priority, we only # evaluate the wrapper to find out that the priority is lower, and then we
# evaluate the wrapper to find out that the priority is lower, and then we # don't need to evaluate `finalPkgs`.
# don't need to evaluate `finalPkgs`. _module.args.pkgs = lib.mkOverride lib.modules.defaultOverridePriority finalPackage;
pkgs = lib.mkOverride lib.modules.defaultOverridePriority finalPackage;
inherit (pkgs) lib;
};
}; };
} }