dot

NixOS dotfiles
git clone https://git.echoz.io/dot.git
Log | Files | Refs

default.nix (1158B)


      1 {
      2   lib,
      3   pkgs,
      4   config,
      5   ...
      6 }:
      7 {
      8   imports = lib.pipe ./plugins [
      9     builtins.readDir
     10     (lib.filterAttrs (name: type: type == "regular"))
     11     builtins.attrNames
     12     (builtins.filter (name: !isNull (builtins.match "^.*\.nix$" name)))
     13     (map (name: ./plugins + "/${name}"))
     14   ];
     15 
     16   options.programs.neovim = {
     17     plugins = lib.mkOption {
     18       type = with lib.types; listOf pathInStore;
     19     };
     20 
     21     customPlugins = lib.mkOption {
     22       type = with lib.types; attrsOf (attrsOf str);
     23     };
     24   };
     25 
     26   config.programs.neovim = {
     27     enable = true;
     28 
     29     defaultEditor = true;
     30     viAlias = true;
     31     vimAlias = true;
     32 
     33     withRuby = lib.mkDefault false;
     34     withPython3 = lib.mkDefault false;
     35     withNodeJs = lib.mkDefault false;
     36 
     37     configure.packages.plugins.start =
     38       let
     39         writeVimPlugin =
     40           name: files:
     41           pkgs.vimUtils.toVimPlugin (
     42             pkgs.symlinkJoin {
     43               inherit name;
     44               paths = lib.mapAttrsToList pkgs.writeTextDir files;
     45             }
     46           );
     47       in
     48       config.programs.neovim.plugins
     49       ++ (lib.mapAttrsToList writeVimPlugin config.programs.neovim.customPlugins);
     50   };
     51 }