Commit Graph
25 Commits
Author SHA1 Message Date
Matt Sturgeon 78acb50d9a modules/nixpkgs: import libForPkgs correctly 2026-07-01 03:15:00 +00:00
Matt Sturgeon cc3b773a7a modules/nixpkgs: use libForPkgs for elaborate
`lib.systems.elaborate` is sensitive to Nixpkgs revision, so import a
`lib` instance from the Nixpkgs revision we're constructing.
2026-07-01 00:13:16 +00:00
Austin Horstman c6a99bb41f modules/nixpkgs: warn about platform specs
Document that fully elaborated platform attrsets from another Nixpkgs instance can be unsafe when Nixvim imports a different nixpkgs.source.
2026-06-29 04:20:49 +00:00
Matt Sturgeon 4d73571e54 modules/nixpkgs: use version-info.toml for source assertion
It may be cheaper to evaluate `(version-info.toml).nixpkgs_rev` instead
of `(nixpkgs.nix).rev` in some scenarios.

I've seen some reports of `builtins.fetchTree` _eagerly_ fetching the
FOD even without forcing `outPath`.
2026-06-09 19:46:00 +00:00
Adam Dinwoodie cb0107f6e1 modules/nixpkgs: pass lib to config function
Nixpkgs config, for defining things like which licenses are
permitted, can either be an attrset or a function that is passed a
`pkgs` argument.  Evaluating that `pkgs` argument requires computing the
Nixpkgs fixpoint, which requires checking whether the derivations used
in the Nixpkgs bootstrap have valid licenses.  This works provided
nothing tries to use Nixpkgs functions to validate or merge anything
included in the configuration.

f5deefd4631e (config: add and document {allow,block}listedLicenses,
2025-08-31), in #437723, added type checking and merging to the lists of
permitted/forbidden licenses.  That resulted in a recursion loop if a
list of licenses included, say, `pkgs.lib.licenses.bsd0`.

To allow licenses to be specified from Nixpkgs' library, pass `lib` as
well as `pkgs` to any config function.  Computing `lib` doesn't require
working out the full Nixpkgs fixpoint.  The change in #437723 will still
break things for some people, but it at least provides a sensible route
to getting the config working again.

Fixes https://github.com/NixOS/nixpkgs/issues/456994.

Cherry-picks https://github.com/NixOS/nixpkgs/commit/8e94561d62272983c93f6c635919874f8d19d8f9
2026-05-24 05:41:42 +00:00
‮rekcäH nitraM‮ a3dffa03ad modules/nixpkgs: add setting nixpkgs.config.allowUnfreePackages = ["list" "of "packages"]
Inspired by https://github.com/NixOS/nixpkgs/issues/197325 this adds a
new option `nixpkgs.allowUnfreePackages`, which merges additively and can
thus be defined in multiple modules close to where the unfree package is
installed.

I would have liked to name this option
`nixpkgs.config.allowUnfreePackages`, to define it closer to where the
`allowUnfree` and `allowUnfreePredicate` are defined, but I didn't see how
this could be achieved. I would welcome some guidance on how to do this.

Cherry-picks https://github.com/NixOS/nixpkgs/commit/a3c9221d642da4c0b22b9c9576bd2af8dcbb8263
2026-05-24 05:41:42 +00:00
Wolfgang Walther ff3cd5fa14 modules/nixpkgs: top-level pkgs now returns __splicedPackages
Cherry-picks https://github.com/NixOS/nixpkgs/commit/f2640ee208003ca7102cbda97740b07871fa7635
2026-05-24 05:41:42 +00:00
Matt Sturgeon 978a84388e Revert "modules/nixpkgs: don't assign elaborated platforms"
This reverts commit f99264c1fb.

Cherry-picks https://github.com/NixOS/nixpkgs/commit/7c251e2b5fda2b42c3ff2983fdcc9eac82f2ced6
2026-05-24 05:41:42 +00:00
Matt Sturgeon f58f056882 modules/nixpgks: warn when nixpkgs.source default is incorrect
Currently, `nixpkgs.source` can be affected by flake input following.
Nixvim is sensitive to the pinned Nixpkgs revision and users often
follow inputs without thinking too much about it, so warn when this is
detected.
2026-05-24 03:05:36 +00:00
Matt Sturgeon 886bd8fd62 modules/nixpkgs: nixpkgs.source fallback when flake undefined 2026-05-24 03:05:36 +00:00
Axel Karjalainen 4c4cac6445 docs: use official names of NixOS, Home Manager and nix-darwin 2025-10-18 00:05:26 +00:00
Matt Sturgeon f99264c1fb modules/nixpkgs: don't assign elaborated platforms
See https://github.com/NixOS/nixpkgs/pull/376988
2025-02-04 23:57:58 +00:00
Matt Sturgeon 82415eaa5d modules/nixpkgs: warn about changing defaults
If end-users change the nixpkgs revision to something other than our
default, they can run into issues not picked up by our test suite.
2025-01-19 13:13:15 +00:00
Matt Sturgeon 51474292cd modules/nixpkgs: remove pkgs default text 2025-01-17 10:16:10 +00:00
Matt Sturgeon 8c6f9ed8c4 lib/modules: allow specifying system as an evalNixvim arg 2025-01-17 10:16:10 +00:00
Matt Sturgeon 7790746d38 modules/nixpkgs: add useGlobalPackages option 2025-01-17 10:16:09 +00:00
Matt Sturgeon 912841c1a7 modules/nixpkgs: construct an instance of nixpkgs.source 2025-01-17 09:37:03 +00:00
Matt Sturgeon 8dc8fa38b0 modules/nixpkgs: add hostPlatform & buildPlatform options 2025-01-17 09:37:03 +00:00
Matt Sturgeon 5bd04ce09a modules/nixpkgs: add config option 2025-01-17 09:37:02 +00:00
Matt Sturgeon 9487403532 modules/context: flake option, provides access to our flake 2024-12-23 12:18:06 +00:00
Matt Sturgeon bef9feb446 lib/modules: pass inputs.nixpkgs into evalNixvim
Expose our locked nixpkgs as the `nixpkgs.source` module options.

This only happens when `evalNixvim` is part of a lib that was provided
`flake` as an argument.

Stubbed the `nixpkgs.source` option for now. Eventually, this will be
used to construct `pkgs` internally. For now, it's purely informational.
2024-12-15 18:41:23 +00:00
Matt Sturgeon c4ad4d0b2e modules/nixpkgs: add overlays option
Based on the `nixpkgs.overlays` option available in NixOS, allows users
to further customize the `pkgs` instance used when evaluating nixvim.

The standard module tests are now provided a few extra module args to
enable a test where we instantiate a custom nixpkgs instance.
2024-10-19 21:11:42 +01:00
Matt Sturgeon b9d17d5e6c modules/nixpkgs: restructure nixpkgs.pkgs.isDefined assertion
We can throw inline to ensure our error is displayed before any attempt
to use the (non-existent) `pkgs` arg results in a less helpful error.
2024-10-19 21:11:42 +01:00
Matt Sturgeon 4b7a41276a modules/nixpkgs: initial pkgs option, drop defaultPkgs specialArg
This minimal implementation allows `nixpkgs.pkgs` to be defined, but
does not implement evaluating an instance from a pkgsPath when _not_
defined.

The `defaultPkgs` specialArg is dropped in favour of `nixpkgs.pkgs`
being defined. If it's not defined, an assertion is thrown.

In the future, a nixpkgs source path can be supplied, defaulting to the
flake's `inputs.nixpkgs`. Along with other `nixpkgs.*` options, this
will allow a `pkgs` instance to be evaluated within the module eval.
2024-09-27 09:30:12 +01:00
Matt Sturgeon 8c3d521bff modules: move nixpkgs module to top-level modules
Make `pkgs` available to files submodules by passing _all_ module args
through. We already did this for `specialArgs`.
2024-09-27 09:30:12 +01:00