aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/ai/default.nix51
-rw-r--r--modules/email.home/.gitignore1
-rw-r--r--modules/email.home/aerc.conf4
-rw-r--r--modules/kakoune/default.nix25
-rw-r--r--modules/kakoune/kak-tree-sitter.nix19
-rw-r--r--modules/xresources.home.nix2
6 files changed, 99 insertions, 3 deletions
diff --git a/modules/ai/default.nix b/modules/ai/default.nix
new file mode 100644
index 0000000..034e33b
--- /dev/null
+++ b/modules/ai/default.nix
@@ -0,0 +1,51 @@
+{ lib, pkgs, ... }:
+let
+ llama-cpp-pkg = pkgs.llama-cpp-vulkan;
+ port = 9081;
+ ctx-size = 128; # 32
+ hf-file = "gemma-3-4b-it-Q4_K_M.gguf";
+ hf-repo =
+ "unsloth/gemma-3-4b-it-GGUF";
+ # "itlwas/Phi-4-mini-instruct-Q4_K_M-GGUF";
+ # "unsloth/gemma-3-4b-it-GGUF";
+ # "yasserrmd/DeepSeek-7B-1M-gguf";
+ # "unsloth/Seed-Coder-8B-Instruct-GGUF";
+ api-key = "foobar";
+
+ llama-start-server = pkgs.writeShellScriptBin "llama-start-server" ''
+ exec ${llama-cpp-pkg}/bin/llama-server --log-disable \
+ --port ${toString port} \
+ --hf-repo ${hf-repo} \
+ ${if hf-file != "" then "--hf-file ${hf-file}" else ""} \
+ --ctx-size ${toString (ctx-size * 1024)} \
+ --api-key ${api-key} \
+ --threads 12 --no-perf
+ '';
+ llama-start-server-background = pkgs.writeShellScriptBin "llama-start-server-background" ''
+ is_running() { ${pkgs.lsof}/bin/lsof -i ":${toString port}" >/dev/null 2>&1; }
+
+ if ! is_running; then
+ setsid -f ${llama-start-server}/bin/llama-start-server >"$HOME/.local/state/local-ai-logs" 2>&1
+
+ attempts=20;
+ while ! ([ "$attempts" == "0" ] || is_running); do
+ sleep 5;
+ attempts=$((attempts - 1));
+ done
+ fi
+ '';
+in
+{
+ environment.systemPackages = with pkgs; [
+ llama-cpp-pkg
+ llama-start-server
+ llama-start-server-background
+ aichat
+ piper-tts
+ ];
+
+ environment.variables = {
+ AI_API_URL = "http://localhost:${toString port}";
+ AI_API_KEY = api-key;
+ };
+}
diff --git a/modules/email.home/.gitignore b/modules/email.home/.gitignore
index a211cae..41d633b 100644
--- a/modules/email.home/.gitignore
+++ b/modules/email.home/.gitignore
@@ -1 +1,2 @@
private.nix
+*.private.*
diff --git a/modules/email.home/aerc.conf b/modules/email.home/aerc.conf
index e7dc011..656d4a1 100644
--- a/modules/email.home/aerc.conf
+++ b/modules/email.home/aerc.conf
@@ -9,8 +9,8 @@ auto-mark-read = true
parse-http-links = true
[compose]
-editor = nvim
-file-picker-cmd = lf -selection-path=%f
+editor = kak-tmux
+file-picker-cmd = sh -c "DAFFM_SELECTIONS_OUT=%f daffm -c @picker"
empty-subject-warning = true
no-attachment-warning = ^[^>]*attach(ed|ment)
edit-headers = true
diff --git a/modules/kakoune/default.nix b/modules/kakoune/default.nix
new file mode 100644
index 0000000..bacab15
--- /dev/null
+++ b/modules/kakoune/default.nix
@@ -0,0 +1,25 @@
+{ pkgs, lib, ... }:
+with pkgs;
+let
+ kak-tree-sitter-unstable = import ./kak-tree-sitter.nix { inherit pkgs lib; };
+ kak-tmux = pkgs.writeShellScriptBin "kak-tmux" ''
+ if [ -t 0 ] && [ -z "$TMUX" ]; then
+ exec </dev/tty; exec <&1; ${tmux}/bin/tmux new "${kakoune}/bin/kak$(printf ' %q' "$@")"
+ else
+ exec "${kakoune}/bin/kak" "$@"
+ fi
+ '';
+in {
+ environment.systemPackages = [
+ kakoune
+ kakoune-lsp
+ kakoune-cr
+ kak-tree-sitter-unstable
+ kak-tmux
+
+ ripgrep
+ tmux
+ gitu
+ moreutils
+ ];
+}
diff --git a/modules/kakoune/kak-tree-sitter.nix b/modules/kakoune/kak-tree-sitter.nix
new file mode 100644
index 0000000..8860d64
--- /dev/null
+++ b/modules/kakoune/kak-tree-sitter.nix
@@ -0,0 +1,19 @@
+{ lib, pkgs }:
+with pkgs;
+rustPlatform.buildRustPackage rec {
+ pname = "kak-tree-sitter";
+ version = "3.0.0-local";
+
+ src = fetchFromSourcehut {
+ owner = "~hadronized";
+ repo = "kak-tree-sitter";
+ rev = "cdcfb42da9affd9dd0db9e8df1173731c61e3d9f"; # 27 Oct 2025
+ hash = "sha256-Q8R++fEJMZFftiI9zGjwF7X8mek2oc40Yl9WMUtQWEA=";
+ };
+
+ cargoHash = "sha256-lZNM5HqICP6JfaMiBjACcUNRTTTIRhq2ou8cOLU0yOU=";
+
+ meta = {
+ mainProgram = "kak-tree-sitter";
+ };
+}
diff --git a/modules/xresources.home.nix b/modules/xresources.home.nix
index 4f83d45..9c99896 100644
--- a/modules/xresources.home.nix
+++ b/modules/xresources.home.nix
@@ -10,7 +10,7 @@
"*.cursorColor" = theme.foreground;
"*.accent" = theme.accent;
- "*.color0" = "#171717";
+ "*.color0" = "#222222";
"*.color8" = "#555555";
"*.color1" = "#e06c75";