nix-community.nixvim/tests/extend.nix
Matt Sturgeon 55fee7051f
standalone: rename nixvimExtend to extend
This is our scope, so there's no need to be explicit.

This also follows the precedent set by `lib.extend`, although that takes
an overlay function.
2024-07-01 15:54:29 +01:00

24 lines
623 B
Nix

{ makeNixvimWithModule, pkgs }:
let
firstStage = makeNixvimWithModule {
module = {
extraConfigLua = "-- first stage";
};
};
secondStage = firstStage.extend { extraConfigLua = "-- second stage"; };
generated = secondStage.extend { extraConfigLua = "-- third stage"; };
in
pkgs.runCommand "extend-test" { printConfig = "${generated}/bin/nixvim-print-init"; } ''
config=$($printConfig)
for stage in "first" "second" "third"; do
if ! "$printConfig" | grep -q -- "-- $stage stage"; then
echo "Missing $stage stage in config"
echo "$config"
exit 1
fi
done
touch $out
''