add misc dotfiles (etc/)

This commit is contained in:
Lyla Bravo 2020-10-18 15:30:41 -03:00
parent fcadfc6cfc
commit 82538540ca
4 changed files with 204 additions and 56 deletions

View File

@ -1,39 +1,16 @@
{ config, pkgs, ... }:
with builtins;
with import <nixpkgs> {};
with import <nixpkgs> { };
let
kakoune-smarttab = stdenv.mkDerivation {
name = "kakoune-smarttab";
src = fetchFromGitHub {
owner = "andreyorst";
repo = "smarttab.kak";
rev = "e7fe8efd0b91ab8dc1c99c131f138de9b38fd965";
sha256 = "0x93mmxv9qi7vxsyqdhg4x5bvsl8sss9m2mq2qks6ghr5h9pmigk";
};
installPhase = ''
mkdir -p $out/share/kak/autoload/plugins
cp -r rc $out/share/kak/autoload/plugins/smarttab
'';
};
kakoune-joule = stdenv.mkDerivation {
name = "kakoune-joule";
src = fetchFromGitHub {
owner = "katesuyu";
repo = "joule.kak";
rev = "17fb4a08c525b6a7e7899c29efafd55a94908cd4";
sha256 = "1jpl9x7a07f7igwd60dn2y3sxakpnlh07cja06l9fsnfpb02jis3";
};
installPhase = ''
mkdir -p $out/share/kak/autoload
cp colors/joule.kak $out/share/kak/autoload
'';
};
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";
url =
"https://ziglang.org/builds/zig-linux-x86_64-0.6.0+0e4c3934a.tar.xz";
sha256 =
"f51d45e0780af942f9128fa915ab96ec8afc7b11dde8b24c8c40ff46a12b8228";
};
installPhase = ''
mkdir -p $out/bin
@ -46,10 +23,7 @@ in {
username = "lyla";
homeDirectory = "/home/lyla";
stateVersion = "20.09";
packages = with pkgs; [
kak-lsp rnix-lsp
zig-master
];
packages = with pkgs; [ xclip neofetch kak-lsp rnix-lsp nixfmt zig-master ];
};
programs = {
@ -67,12 +41,23 @@ in {
kakoune = let
lspFiletypes = [ "zig" "c" "cpp" "rust" "nix" ];
tabSettings = [
{ filetype = [ "zig" "rust" "nix" ]; tab = "expandtab"; }
{ filetype = [ "c" "cpp" ]; tab = "smarttab"; }
{
filetype = [ "zig" "rust" "nix" ];
tab = "expandtab";
}
{
filetype = [ "c" "cpp" ];
tab = "smarttab";
}
];
in {
enable = true;
plugins = [ kakoune-joule kakoune-smarttab ];
plugins = with pkgs.kakounePlugins; [
kak-fzf
kakPlugins.kakboard
kakPlugins.joule
kakPlugins.smarttab
];
config = {
tabStop = 4;
numberLines = {
@ -89,8 +74,15 @@ in {
assistant = "none";
setTitle = true;
};
keyMappings = [{
docstring = "fzf mode";
mode = "user";
effect = ": fzf-mode<ret>";
key = "d";
}];
hooks = [
{ name = "ModuleLoaded";
{
name = "ModuleLoaded";
option = "smarttab";
commands = ''
set-option global softtabstop 4
@ -99,35 +91,35 @@ in {
set-option global smarttab_smarttab_mode_name 'smart'
'';
}
] ++ lib.lists.forEach
tabSettings
(v: {
name = "WinSetOption";
commands = "${v.tab}";
option =
if isList v.filetype then
let
flist = builtins.concatStringsSep "|" v.filetype;
in
"filetype=(${flist})"
else
"filetype=${v.filetype}";
});
{
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 = let ftypes = builtins.concatStringsSep "|" lspFiletypes; in ''
extraConfig = ''
# kak-lsp initialization
eval %sh{kak-lsp --kakoune -s $kak_session}
hook global WinSetOption filetype=(${ftypes}) %{
map buffer normal p ': enter-user-mode lsp<ret>'
hook global WinSetOption filetype=(${builtins.concatStringsSep "|" lspFiletypes}) %{
map buffer user l ': enter-user-mode lsp<ret>' -docstring 'LSP mode'
lsp-enable-window
}
'';
};
};
};
xdg = {
dataFile = {
# not done here: compile ZLS and copy the binaries to ~/.local/share/zls
# 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/",
@ -138,6 +130,12 @@ in {
}
'';
};
configFile = {
"kak-lsp/kak-lsp.toml".source = ~/etc/kak-lsp.toml;
"../.tmux.conf".source = ~/etc/tmux.conf;
};
userDirs = {
enable = true;
desktop = "$HOME/usr";

View File

@ -0,0 +1,48 @@
with import <nixpkgs> { };
with lib;
let
kakboard = stdenv.mkDerivation {
name = "kakoune-kakboard";
src = fetchFromGitHub {
owner = "lePerdu";
repo = "kakboard";
rev = "2f13f5cd99591b76ad5cba230815b80138825120";
sha256 = "1kvnbsv20y09rlnyar87qr0h26i16qsq801krswvxcwhid7ijlvd";
};
installPhase = ''
mkdir -p $out/share/kak/autoload/plugins
cp kakboard.kak $out/share/kak/autoload/plugins/kakboard.kak
'';
};
smarttab = stdenv.mkDerivation {
name = "kakoune-smarttab";
src = fetchFromGitHub {
owner = "andreyorst";
repo = "smarttab.kak";
rev = "e7fe8efd0b91ab8dc1c99c131f138de9b38fd965";
sha256 = "0x93mmxv9qi7vxsyqdhg4x5bvsl8sss9m2mq2qks6ghr5h9pmigk";
};
installPhase = ''
mkdir -p $out/share/kak/autoload/plugins
cp -r rc $out/share/kak/autoload/plugins/smarttab
'';
};
joule = stdenv.mkDerivation {
name = "kakoune-joule";
src = fetchFromGitHub {
owner = "katesuyu";
repo = "joule.kak";
rev = "17fb4a08c525b6a7e7899c29efafd55a94908cd4";
sha256 = "1jpl9x7a07f7igwd60dn2y3sxakpnlh07cja06l9fsnfpb02jis3";
};
installPhase = ''
mkdir -p $out/share/kak/autoload
cp colors/joule.kak $out/share/kak/autoload
'';
};
in {
kakboard = kakboard;
joule = joule;
smarttab = smarttab;
}

60
etc/kak-lsp.toml Normal file
View File

@ -0,0 +1,60 @@
snippet_support = true
verbosity = 2
[semantic_scopes]
variable = "variable"
entity_name_function = "function"
entity_name_type = "type"
variable_other_enummember = "variable"
entity_name_namespace = "module"
[semantic_tokens]
type = "type"
variable = "variable"
namespace = "module"
function = "function"
string = "string"
keyword = "keyword"
operator = "operator"
comment = "comment"
[semantic_modifiers]
documentation = "documentation"
readonly = "default+d"
[server]
timeout = 1800 # seconds = 30 minutes
[language.c_cpp]
filetypes = ["c", "cpp"]
roots = ["compile_commands.json", ".clangd"]
command = "clangd"
[language.haskell]
filetypes = ["haskell"]
roots = ["Setup.hs", "stack.yaml", "*.cabal"]
# You might also be interested in the newer, but early stage, haskell-language-server
# https://github.com/haskell/haskell-language-server
command = "hie-wrapper"
args = ["--lsp"]
[language.latex]
filetypes = ["latex"]
roots = [".git"]
command = "texlab"
[language.nix]
filetypes = ["nix"]
roots = ["flake.nix", "shell.nix", ".git"]
command = "rnix-lsp"
[language.rust]
filetypes = ["rust"]
roots = ["Cargo.toml"]
command = "sh"
args = ["-c", "if command -v rustup >/dev/null; then $(rustup which rls); else rls; fi"]
[language.zig]
filetypes = ["zig"]
roots = ["build.zig"]
command = "/home/lyla/.local/share/zls/zls"

42
etc/tmux.conf Normal file
View File

@ -0,0 +1,42 @@
set -g mouse on
set -g prefix C-a
set-option -g set-titles on
set-option -g set-titles-string '[#S:#I] #W'
set-window-option -g automatic-rename on
set-option -g status-bg "#070707"
set-option -g status-fg "#969896"
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*col*:Tc"
unbind c
bind c new-window
bind C-c new-window
unbind &
bind k confirm-before kill-window
bind C-k confirm-before kill-window
unbind l
bind C-a last-window
unbind C-b
bind a send-prefix
unbind n
bind n next-window
bind C-n next-window
unbind p
bind p previous-window
bind C-p previous-window
unbind d
bind d detach
bind C-d detach
set-option escape-time 0
unbind [
bind Escape copy-mode
unbind %
bind h split-window -h
bind C-h split-window -h
unbind "'"
bind v split-window -v
bind C-v split-window -v
bind / command-prompt "split-window 'exec man %%'"