nix-community.nixvim/tests/no-flake.nix
Matt Sturgeon 6d10fc0c87
flake: partition dev dependencies
This removes the need for end-users to manually set
`nixvim.inputs.devshell.follows = ""` (etc)

We offload evaluation of some of our flake modules into a `dev`
partition submodule.
- When its not needed, this submodule is not evaluated.
- When it is needed, it fetches extra inputs from `flake/dev/flake.nix`
  as part of evaluating the submodule.

See https://flake.parts/options/flake-parts-partitions.html
2025-02-23 17:23:57 +00:00

31 lines
826 B
Nix

{
nixvim ? "${self}",
self ? throw "either supply `self` or `nixvim`",
system,
mkTestDerivationFromNvim,
}:
let
# This simulates the `default.nix`, but in a pure way so because we are currently in a flake.
nixvim' =
(import (
let
lock = builtins.fromJSON (builtins.readFile ../flake/dev/flake.lock);
in
fetchTarball {
url =
lock.nodes.flake-compat.locked.url
or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
) { src = nixvim; }).defaultNix;
config = {
colorschemes.gruvbox.enable = true;
};
nvim = nixvim'.legacyPackages."${system}".makeNixvim config;
in
mkTestDerivationFromNvim {
name = "no-flakes";
inherit nvim;
}