152 lines
3.9 KiB
Nix
152 lines
3.9 KiB
Nix
{ config, pkgs, ... }:
|
|
with builtins;
|
|
with import <nixpkgs> { };
|
|
|
|
let
|
|
kakPlugins = import ./modules/kakoune-plugins.nix;
|
|
zig-master = stdenv.mkDerivation {
|
|
name = "zig-master";
|
|
src = fetchurl {
|
|
url =
|
|
"https://ziglang.org/builds/zig-linux-x86_64-0.6.0+0e4c3934a.tar.xz";
|
|
sha256 =
|
|
"f51d45e0780af942f9128fa915ab96ec8afc7b11dde8b24c8c40ff46a12b8228";
|
|
};
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
cp -r . $out
|
|
mv $out/zig $out/bin/zig
|
|
'';
|
|
};
|
|
in {
|
|
home = {
|
|
username = "lyla";
|
|
homeDirectory = "/home/lyla";
|
|
stateVersion = "20.09";
|
|
packages = with pkgs; [ xclip neofetch kak-lsp rnix-lsp nixfmt zig-master ];
|
|
};
|
|
|
|
programs = {
|
|
home-manager.enable = true;
|
|
fish.enable = true;
|
|
fzf.enable = true;
|
|
jq.enable = true;
|
|
git = {
|
|
enable = true;
|
|
package = pkgs.gitAndTools.gitFull;
|
|
userName = "Lyla Bravo";
|
|
userEmail = "arqv@protonmail.com";
|
|
delta.enable = true;
|
|
};
|
|
kakoune = let
|
|
lspFiletypes = [ "zig" "c" "cpp" "rust" "nix" ];
|
|
tabSettings = [
|
|
{
|
|
filetype = [ "zig" "rust" "nix" ];
|
|
tab = "expandtab";
|
|
}
|
|
{
|
|
filetype = [ "c" "cpp" ];
|
|
tab = "smarttab";
|
|
}
|
|
];
|
|
in {
|
|
enable = true;
|
|
plugins = with pkgs.kakounePlugins; [
|
|
kak-fzf
|
|
kakPlugins.kakboard
|
|
kakPlugins.joule
|
|
kakPlugins.smarttab
|
|
];
|
|
config = {
|
|
tabStop = 4;
|
|
numberLines = {
|
|
enable = true;
|
|
highlightCursor = true;
|
|
};
|
|
wrapLines = {
|
|
enable = true;
|
|
indent = true;
|
|
word = true;
|
|
};
|
|
ui = {
|
|
enableMouse = true;
|
|
assistant = "none";
|
|
setTitle = true;
|
|
};
|
|
keyMappings = [{
|
|
docstring = "fzf mode";
|
|
mode = "user";
|
|
effect = ": fzf-mode<ret>";
|
|
key = "d";
|
|
}];
|
|
hooks = [
|
|
{
|
|
name = "ModuleLoaded";
|
|
option = "smarttab";
|
|
commands = ''
|
|
set-option global softtabstop 4
|
|
set-option global smarttab_expandtab_mode_name 'exp'
|
|
set-option global smarttab_noexpandtab_mode_name 'noexp'
|
|
set-option global smarttab_smarttab_mode_name 'smart'
|
|
'';
|
|
}
|
|
{
|
|
name = "WinCreate";
|
|
option = ".*";
|
|
commands = "kakboard-enable";
|
|
}
|
|
] ++ lib.lists.forEach tabSettings (v: {
|
|
name = "WinSetOption";
|
|
commands = "${v.tab}";
|
|
option = if isList v.filetype then
|
|
"filetype=(${builtins.concatStringsSep "|" v.filetype})"
|
|
else
|
|
"filetype=${v.filetype}";
|
|
});
|
|
};
|
|
extraConfig = ''
|
|
# kak-lsp initialization
|
|
eval %sh{kak-lsp --kakoune -s $kak_session}
|
|
hook global WinSetOption filetype=(${builtins.concatStringsSep "|" lspFiletypes}) %{
|
|
map buffer user l ': enter-user-mode lsp<ret>' -docstring 'LSP mode'
|
|
lsp-enable-window
|
|
}
|
|
'';
|
|
};
|
|
};
|
|
|
|
xdg = {
|
|
dataFile = {
|
|
# compile ZLS and copy the binaries manually to ~/.local/share/zls
|
|
# TODO: get ZLS to compile with Nix.
|
|
"zls/zls.json".text = ''
|
|
{
|
|
"zig_lib_path": "${zig-master}/lib/zig/",
|
|
"zig_exe_path": "${zig-master}/bin/zig",
|
|
"warn_style": true,
|
|
"enable_semantic_tokens": true,
|
|
"operator_completions": true
|
|
}
|
|
'';
|
|
};
|
|
|
|
configFile = {
|
|
"kak-lsp/kak-lsp.toml".source = ~/etc/kak-lsp.toml;
|
|
"../.tmux.conf".source = ~/etc/tmux.conf;
|
|
};
|
|
|
|
userDirs = {
|
|
enable = true;
|
|
desktop = "$HOME/usr";
|
|
documents = "$HOME/usr/doc";
|
|
download = "$HOME/usr/dl";
|
|
music = "$HOME/usr/mus";
|
|
pictures = "$HOME/usr/vis";
|
|
videos = "$HOME/usr/vis";
|
|
publicShare = "$HOME/.etc";
|
|
templates = "$HOME/.etc";
|
|
};
|
|
};
|
|
}
|