feat: can give dependencies to new package
parent
2ea188c185
commit
7b26400707
|
|
@ -17,11 +17,10 @@
|
||||||
utils,
|
utils,
|
||||||
alejandra,
|
alejandra,
|
||||||
...
|
...
|
||||||
} @ inputs: let
|
} @ inputs:
|
||||||
in
|
|
||||||
utils.lib.mkFlake {
|
utils.lib.mkFlake {
|
||||||
inherit self inputs;
|
inherit self inputs;
|
||||||
outputsBuilder = channel: let
|
outputsBuilder = channel: let
|
||||||
system = channel.nixpkgs.system;
|
system = channel.nixpkgs.system;
|
||||||
in {
|
in {
|
||||||
formatter = alejandra.defaultPackage.${channel.nixpkgs.system};
|
formatter = alejandra.defaultPackage.${channel.nixpkgs.system};
|
||||||
|
|
@ -31,6 +30,6 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
lib = import ./lib.nix { inherit nixpkgs; };
|
lib = import ./lib.nix;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
48
lib.nix
48
lib.nix
|
|
@ -1,4 +1,50 @@
|
||||||
{...}: {
|
{
|
||||||
|
mkNeovimPkg = {
|
||||||
|
pkgs,
|
||||||
|
package ? pkgs.neovim-unwrapped,
|
||||||
|
namePrefix ? "",
|
||||||
|
nameSuffix ? "",
|
||||||
|
dependencies ? [],
|
||||||
|
dependenciesExtraArgs ? {},
|
||||||
|
customRC ? "",
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) isPath;
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
callPackage = lib.callPackageWith (pkgs // dependenciesExtraArgs);
|
||||||
|
inherit (lib.lists) concatMap;
|
||||||
|
inherit (lib.attrsets) attrNames;
|
||||||
|
# inherit (lib.debug) traceIf traceSeq traceVal traceValSeq traceValFn;
|
||||||
|
|
||||||
|
remotePluginToNeovimPlugin = p:
|
||||||
|
pkgs.vimUtils.buildVimPlugin rec {
|
||||||
|
inherit (p) src name;
|
||||||
|
pname = name;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkDep = dep:
|
||||||
|
if isPath dep
|
||||||
|
then mkDependencies (callPackage dep {})
|
||||||
|
else if dep ? plugin
|
||||||
|
then let
|
||||||
|
inherit (dep) plugin;
|
||||||
|
in
|
||||||
|
if attrNames plugin == ["name" "src"]
|
||||||
|
then [(remotePluginToNeovimPlugin plugin)]
|
||||||
|
else [plugin]
|
||||||
|
else [dep];
|
||||||
|
mkDependencies = concatMap mkDep;
|
||||||
|
|
||||||
|
neovimConfig = pkgs.neovimUtils.makeNeovimConfig {
|
||||||
|
inherit customRC;
|
||||||
|
plugins = mkDependencies dependencies;
|
||||||
|
};
|
||||||
|
pkg = pkgs.wrapNeovimUnstable package neovimConfig;
|
||||||
|
# TODO nameSuffix is buggy :'(
|
||||||
|
name = "${namePrefix}${pkg.name}${nameSuffix}";
|
||||||
|
in
|
||||||
|
pkg // {inherit name;};
|
||||||
|
|
||||||
mkNeovimModule = {
|
mkNeovimModule = {
|
||||||
pluginsDir ? null,
|
pluginsDir ? null,
|
||||||
attrName ? "neoflake",
|
attrName ? "neoflake",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue