-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlib.nix
33 lines (31 loc) · 1.18 KB
/
lib.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{ nixpkgs ? import <nixpkgs> { }
}:
let
inherit (nixpkgs.lib) attrNames elem evalModules filter filterAttrs hasAttr hasAttrByPath hasSuffix last listToAttrs mapAttrs mkDefault mkOverride nameValuePair optionalAttrs optionals removeSuffix replaceStrings splitString;
getNvimSubmoduleDefs = options: options.sn.programs.neovim.definitions;
in
rec {
# Builds a neovim module configuration.
# NOTE: This may evaluate the current system's NixOS and/or home-manager
# configurations, and if it does, it uses the nixpkgs and home-manager paths
# that are given to it -- which may not necessarily be the ones used outside
# of this.
configuredNeovimModule = { pkgs ? nixpkgs, nvimConfig }: let
nixpkgsPath = pkgs.path;
cfg = (evalModules {
modules = [
({ ... }: { _module.args.pkgs = pkgs; })
nvimConfig nvimModule
];
}).config;
in cfg;
nvimModule = import ./module.nix nixpkgs;
buildVimPluginFromNiv = pins: pluginName: let
pin = pins.${pluginName};
in nixpkgs.vimUtils.buildVimPlugin (rec {
name = "${pname}-${version}";
pname = last (splitString "/" pluginName);
version = pin.version or "unstable-${pin.rev}";
src = pin;
});
}