summary refs log tree commit diff stats
path: root/user
diff options
context:
space:
mode:
Diffstat (limited to 'user')
-rw-r--r--user/modules/nvim-coc.nix25
-rw-r--r--user/nvim/coc-settings.json5
-rw-r--r--user/settings/base.nix12
3 files changed, 35 insertions, 7 deletions
diff --git a/user/modules/nvim-coc.nix b/user/modules/nvim-coc.nix
new file mode 100644
index 00000000..5aa462f0
--- /dev/null
+++ b/user/modules/nvim-coc.nix
@@ -0,0 +1,25 @@
+{ config,  lib, pkgs, ... }:
+
+with lib;
+
+let
+  inherit (pkgs) stdenv;
+  cfg = config.programs.neovim.coc;
+in
+{
+  options.programs.neovim.coc = {
+    config = mkOption {
+      type = types.attrs;
+      default = {};
+      description = ''
+        Settings for coc.nvim
+      '';
+    };
+  };
+
+  config = {
+    xdg.configFile."nvim/coc-settings.json" = {
+      source = pkgs.writeText "coc-settings.json" (builtins.toJSON cfg.config);
+    };
+  };
+}
diff --git a/user/nvim/coc-settings.json b/user/nvim/coc-settings.json
deleted file mode 100644
index 718446b1..00000000
--- a/user/nvim/coc-settings.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-	"json.enable": true,
-	"suggest.enablePreview": true
-}
-
diff --git a/user/settings/base.nix b/user/settings/base.nix
index 45336f5c..b181d4ad 100644
--- a/user/settings/base.nix
+++ b/user/settings/base.nix
@@ -1,6 +1,10 @@
 { config, lib, pkgs, ... }:
 
 {
+  imports = [
+    ../modules/nvim-coc.nix
+  ];
+
   # Let Home Manager install and manage itself.
   programs.home-manager.enable = true;
   manual = {
@@ -31,9 +35,13 @@
         opt = [ ];
       };
     };
+    coc = {
+      config = {
+        "json.enable" = true;
+        "suggest.enablePreview" = true;
+      };
+    };
   };
-  xdg.configFile."nvim/coc-settings.json".source = ../nvim/coc-settings.json;
-  home.sessionVariables = {
     EMAIL = "alan@alanpearce.eu";
     XDG_CACHE_HOME = if pkgs.stdenv.isDarwin then "$HOME/Library/Caches/XDG" else "$HOME/.cache";
     XDG_CONFIG_HOME = "$HOME/.config";