From b7d4d80c1b1240686415283cc1d6f0cc15dfcd04 Mon Sep 17 00:00:00 2001
From: Matei Adriel <rafaeladriel11@gmail.com>
Date: Thu, 21 Apr 2022 14:09:11 +0300
Subject: [PATCH] feat: custom vim syntax for my project, printer drivers, etc

---
 configuration.nix                            |  7 +++++
 dotfiles/kmonad/keymap.kbd                   |  3 ++-
 dotfiles/neovim/lua/my/options.lua           |  1 +
 dotfiles/neovim/lua/my/options/files.lua     | 16 +++++++++++
 dotfiles/neovim/lua/my/plugins/lspconfig.lua |  8 +++++-
 dotfiles/neovim/syntax/bkf.vim               | 28 ++++++++++++++++++++
 modules/applications/neovim.nix              |  2 ++
 modules/bluetooth.nix                        |  2 +-
 modules/default.nix                          |  3 ++-
 modules/dev/haskell/default.nix              |  3 +--
 modules/printers.nix                         |  6 +++++
 11 files changed, 73 insertions(+), 6 deletions(-)
 create mode 100644 dotfiles/neovim/lua/my/options/files.lua
 create mode 100644 dotfiles/neovim/syntax/bkf.vim
 create mode 100644 modules/printers.nix

diff --git a/configuration.nix b/configuration.nix
index 3776813..b1beb89 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -7,6 +7,13 @@
   home-manager.useGlobalPkgs = true;
   home-manager.useUserPackages = true;
 
+
+  hardware = {
+    pulseaudio = {
+      enable = true;
+    };
+  };
+
   boot.loader = {
     efi = {
       canTouchEfiVariables = true;
diff --git a/dotfiles/kmonad/keymap.kbd b/dotfiles/kmonad/keymap.kbd
index 2a5cbc1..52bb907 100644
--- a/dotfiles/kmonad/keymap.kbd
+++ b/dotfiles/kmonad/keymap.kbd
@@ -1,7 +1,8 @@
 (defcfg
   ;; For Linux
   ;; input  (device-file "$DEVICE") ;; gets dynamically replaced by nix
-  input  (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd") 
+  input  (device-file "/dev/input/by-path/pci-0000:00:14.0-usb-0:5:1.0-event-kbd") 
+  ;; input  (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd") 
   output (uinput-sink "My KMonad output"
     ;; To understand the importance of the following line, see the section on
     ;; Compose-key sequences at the near-bottom of this file.
diff --git a/dotfiles/neovim/lua/my/options.lua b/dotfiles/neovim/lua/my/options.lua
index 7113aad..c57f890 100644
--- a/dotfiles/neovim/lua/my/options.lua
+++ b/dotfiles/neovim/lua/my/options.lua
@@ -34,6 +34,7 @@ function M.setup()
 
     -- Import other options
     require("my.options.folding").setup()
+    require("my.options.files").setup()
 end
 
 return M
diff --git a/dotfiles/neovim/lua/my/options/files.lua b/dotfiles/neovim/lua/my/options/files.lua
new file mode 100644
index 0000000..0e79706
--- /dev/null
+++ b/dotfiles/neovim/lua/my/options/files.lua
@@ -0,0 +1,16 @@
+local au = require("my.helpers.augroup")
+local M = {}
+
+local syntaxFiles = {bkf = "bkf"}
+
+function M.setup()
+    au.augroup("myfiledetection", function()
+        for extension, syntax in pairs(syntaxFiles) do
+            au.autocmd("BufnewFile,BufRead", "*." .. extension,
+                       "setf " .. syntax)
+        end
+    end)
+
+end
+
+return M
diff --git a/dotfiles/neovim/lua/my/plugins/lspconfig.lua b/dotfiles/neovim/lua/my/plugins/lspconfig.lua
index eba77dd..7e631ac 100644
--- a/dotfiles/neovim/lua/my/plugins/lspconfig.lua
+++ b/dotfiles/neovim/lua/my/plugins/lspconfig.lua
@@ -89,7 +89,13 @@ local servers = {
             }
         }
     },
-    rnix = {}
+    rnix = {},
+    hls = {
+        haskell = {
+            -- set formatter
+            formattingProvider = "ormolu"
+        }
+    }
     -- agda = {}, Haven't gotten this one to work yet
 }
 
diff --git a/dotfiles/neovim/syntax/bkf.vim b/dotfiles/neovim/syntax/bkf.vim
new file mode 100644
index 0000000..eb4b6ce
--- /dev/null
+++ b/dotfiles/neovim/syntax/bkf.vim
@@ -0,0 +1,28 @@
+if exists("b:current_syntax")
+    finish
+endif
+
+echom "Our syntax highlighting code will go here."
+
+syntax keyword kfKeyword alias template layer using
+" syntax keyword kfFunction tap-macro 
+syntax match kfComment "\v--.*$"
+
+syntax match kfOperator "\v_"
+syntax match kfOperator "\v\:"
+syntax match kfOperator "\v\|"
+syntax match kfOperator "\v\="
+syntax match kfOperator "\v\=\>"
+syntax match kfOperator "\v\*"
+syntax match kfOperator "\v\("
+syntax match kfOperator "\v\)"
+
+syntax region kfString start=/\v"/ skip=/\v\\./ end=/\v"/
+
+highlight link kfKeyword Keyword
+" highlight link kfFunction Function
+highlight link kfComment Comment
+highlight link kfOperator Operator
+highlight link kfString String
+
+let b:current_syntax = "kf" 
diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix
index ed5df2f..eb3d23c 100644
--- a/modules/applications/neovim.nix
+++ b/modules/applications/neovim.nix
@@ -41,9 +41,11 @@ in
       idris2-pkgs.lsp # idris2
       sumneko-lua-language-server # lua
       rnix-lsp # nix
+      haskell-language-server # haskell
 
       # Formatters
       luaformatter # lua
+      ormolu # haskell
       prettierd # prettier but faster
 
       # Others
diff --git a/modules/bluetooth.nix b/modules/bluetooth.nix
index a5866af..c65911a 100644
--- a/modules/bluetooth.nix
+++ b/modules/bluetooth.nix
@@ -36,7 +36,7 @@
         ## module fails to load with 
         ##   module-bluez5-device.c: Failed to get device path from module arguments
         ##   module.c: Failed to load module "module-bluez5-device" (argument: ""): initialization failed.
-        # load-module module-bluez5-device
+         load-module module-bluez5-device
         # load-module module-bluez5-discover
       '';
 
diff --git a/modules/default.nix b/modules/default.nix
index 18407f1..1818b82 100644
--- a/modules/default.nix
+++ b/modules/default.nix
@@ -9,6 +9,7 @@
     ./xserver.nix
     ./users.nix
     ./nix.nix
-    ./bluetooth.nix
+    ./printers.nix
+    # ./bluetooth.nix
   ];
 }
diff --git a/modules/dev/haskell/default.nix b/modules/dev/haskell/default.nix
index 956c76d..f00fb56 100644
--- a/modules/dev/haskell/default.nix
+++ b/modules/dev/haskell/default.nix
@@ -1,5 +1,4 @@
 { pkgs, ... }:
-# let hie = pkgs.all-hies.selection { selector = p: { inherit (p) ghc865; }; };
 {
   home-manager.users.adrielus.home = {
     file.".ghci".source = ./ghci;
@@ -7,6 +6,6 @@
     packages = with pkgs;
       [ ghc ghcid hlint cabal-install stack ]
 
-      ++ (with haskellPackages; [ brittany hoogle hpack ]);
+      ++ (with haskellPackages; [ hoogle hpack ]);
   };
 }
diff --git a/modules/printers.nix b/modules/printers.nix
new file mode 100644
index 0000000..6d29aed
--- /dev/null
+++ b/modules/printers.nix
@@ -0,0 +1,6 @@
+{ pkgs, ... }: {
+  services.printing.enable = true;
+  services.printing.drivers = with pkgs; [
+    hplip
+  ];
+}