wrappers/standalone: make pkgs arg optional, allow specifying system

This commit is contained in:
Matt Sturgeon 2024-12-23 14:44:23 +00:00
parent 8c6f9ed8c4
commit 9bf4c9d55b
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
4 changed files with 44 additions and 17 deletions

View file

@ -1,8 +1,13 @@
default_pkgs: self:
{
self,
lib,
defaultSystem,
}:
{
# TODO: Deprecate this arg in favour of using module options
pkgs ? default_pkgs,
lib ? pkgs.lib,
pkgs ? null,
# NOTE: `defaultSystem` is the only reason this function can't go in `<nixvim>.lib`
system ? defaultSystem,
extraSpecialArgs ? { },
_nixvimTests ? false,
module,
@ -12,23 +17,32 @@ let
helpers = self.lib.nixvim.override { inherit _nixvimTests; };
inherit (helpers.modules) evalNixvim;
systemMod =
if pkgs == null then
{
_file = ./standalone.nix;
nixpkgs.hostPlatform = lib.mkDefault { inherit system; };
}
else
{
_file = ./standalone.nix;
nixpkgs.pkgs = lib.mkDefault pkgs;
};
mkNvim =
mod:
let
nixvimConfig = evalNixvim {
modules = [
mod
# TODO: only include this when `args?pkgs`:
{
_file = ./standalone.nix;
nixpkgs.pkgs = lib.mkDefault pkgs;
}
systemMod
];
inherit extraSpecialArgs;
};
inherit (nixvimConfig.config) enableMan build;
inherit (nixvimConfig._module.args.pkgs) symlinkJoin;
in
(pkgs.symlinkJoin {
(symlinkJoin {
name = "nixvim";
paths = [
build.package