flake: cleanup

This commit is contained in:
Charlie Root 2024-11-03 23:35:35 +01:00
commit 46f14be415
Signed by: faukah
SSH key fingerprint: SHA256:jpYIt4Vkz1NBTQcks/N9OPTfTFxE6KF2W/rV7hrfrIw
17 changed files with 4 additions and 867 deletions

View file

@ -12,7 +12,6 @@
evince
eza
gcc
ghidra
ida-free
gnumake
halloy

View file

@ -1,43 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
inherit (config.modules.other.system) username;
cfg = config.modules.system.programs.editors.kakoune;
inherit (lib) mkIf mkEnableOption;
custom-kakoune = pkgs.stdenv.mkDerivation {
name = "custom-kakoune";
src = pkgs.fetchFromGitHub {
owner = "mawww";
repo = "kakoune";
rev = "be82047dbf5f74f123e925b96e0e13962a4e0c09";
hash = "sha256-akSmIe0SUe9re8a90ssrykowCzThZnzqVow9erT+0U4=";
};
makeFlags = ["debug=no" "PREFIX=${placeholder "out"}"];
enableParallellBuilding = true;
doInstallCheck = false;
installCheckPhase = ''
$out/bin/kak -ui json -e "kill 0"
'';
postInstall = ''
cd "$out/share/kak"
autoload_target=$(readlink autoload)
rm autoload
mkdir autoload
ln -s --relative "$autoload_target" autoload
'';
};
in {
imports = [./mappings.nix];
options.modules.programs.editors.kakoune.enable = mkEnableOption "kakoune";
config = mkIf false {
environment.systemPackages = [
custom-kakoune
];
};
}

View file

@ -1,18 +0,0 @@
[language.haskell]
filetypes = ["haskell"]
roots = ["Setup.hs", "stack.yaml", "*.cabal"]
command = "haskell-language-server-wrapper"
args = ["--lsp"]
[language.rust]
filetypes = ["rust"]
roots = ["Cargo.toml"]
command = "rust-analyzer"
settings_section = "rust-analyzer"
[language.rust.settings.rust-analyzer]
"proMacro.enable" = true
[language.nix]
filetypes = ["nix"]
roots = ["shell.nix", "default.nix", "home.nix", "flake.nix"]
command = "rnix-lsp"

View file

@ -1,135 +0,0 @@
{
config,
lib,
pkgs,
buildGoModule,
...
}:
with lib; let
cfg = config.modules.programs.kakoune;
username = config.modules.other.system.username;
kakship = pkgs.rustPlatform.buildRustPackage rec {
pname = "kakship";
version = "0.2.8";
src = pkgs.fetchFromGitHub {
owner = "mesabloo";
repo = "kakship";
rev = "937d904a893daf59f70dc955e60209cd8866a7c3";
sha256 = "1pk0v0b31bppjzl08qgrjld40pc7rqc257zzgdl4r8zaamqsmkz9";
};
cargoLock = {
lockFile = "${src}/Cargo.lock";
outputHashes = {
"kak-0.1.2" = "sha256-RhtHQkC9yCSJtr/kbC5c9MavbL79acrsiEGXyoAST8U=";
"yew-ansi-0.1.0" = "sha256-dSaEzqiOon+OqCZKQudzLRNP+Iv97kC+XZcTElKNrzs=";
};
};
# patchPhase = ''
# substituteInPlace src/main.rs \
# --replace '"starship"' "\"${pkgs.starship}/bin/starship\""
# '';
postInstall = ''
# Copy rc files to /share/kak/autoload
mkdir -p $out/share/kak/autoload/plugins/${pname}
cp $src/rc/*.kak $out/share/kak/autoload/plugins/${pname}
'';
};
kak-rainbow = pkgs.kakouneUtils.buildKakounePluginFrom2Nix rec {
pname = "kak-rainbow";
version = "1.0.0";
src = pkgs.fetchFromGitHub {
owner = "Bodhizafa";
repo = "kak-rainbow";
rev = "9c3d0aa62514134ee5cb86e80855d9712c4e8c4b";
sha256 = "sha256-ryYq4A89wVUsxgvt4YqBPXsTFMDrMJM6BDBEHrWHD1c=";
};
postInstall = ''
mkdir -p $out/lib
mv $out/share/kak/autoload/plugins/${pname}/rainbow.kak $out/lib
cat >$out/share/kak/autoload/plugins/${pname}/rainbow.kak <<EOF
provide-module rainbow %{
source $out/lib/rainbow.kak
}
EOF
'';
};
kks = pkgs.buildGoModule rec {
pname = "kks";
version = "8113ea3";
src = pkgs.fetchFromGitHub {
owner = "kkga";
repo = pname;
rev = "8113ea3bd718dec88b812faa1a41bacba0110fd7";
sha256 = "sha256-/0ocgWArELGQkOZqbYRljPnzM/zQ9HCZq7gqhMD0Mq4=";
};
vendorHash = "sha256-E4D9FGTpS9NkZy6tmnuI/F4dnO9bv8MVaRstxVPvEfo=";
doCheck = false;
meta = with lib; {
description = "Handy Kakoune companion.";
homepage = "https://github.com/kkga/kks";
license = licenses.unfree;
maintainers = with maintainers; [kalbasit];
};
};
kak-alacritty = pkgs.kakouneUtils.buildKakounePluginFrom2Nix rec {
pname = "alacritty.kak";
version = "10025b8";
src = pkgs.fetchFromGitHub {
owner = "Lokasku";
repo = pname;
rev = "66b0d2e2451c01719262effd008c40614427bb35";
sha256 = "sha256-Ibjs6dCU8/XEjUoWNB5a8R4QW7z8w6cFBSxd7UvZrxE=";
};
};
kakoune-snow = pkgs.kakouneUtils.buildKakounePluginFrom2Nix rec {
pname = "kakoune-snow";
version = "35f8187";
src = pkgs.fetchFromGitHub {
owner = "caksoylar";
repo = pname;
rev = "35f81876bcaea061982396f8071b89528940ae61";
sha256 = "";
};
};
# with lib;
in {
options.modules.programs.kakoune.enable = mkEnableOption "kakoune";
config = mkIf cfg.enable {
home-manager.users.${username} = {programs.kakoune.enable = true;};
environment.systemPackages = with pkgs; [
rust-analyzer
rustfmt # Rust LSP
kakship
kks
];
programs.kakoune = {
plugins = with pkgs.kakounePlugins; [
kakoune-lsp
fzf-kak
kak-rainbow
kak-alacritty
];
config = {
numberLines = {
enable = true;
# separator = "|";
};
scrollOff = {
columns = 15;
lines = 15;
};
};
extraConfig = builtins.readFile ./kakrc;
};
xdg.configFile."kak/starship.toml".source = ./starship.toml;
xdg.configFile."kak-lsp/kak-lsp.toml".source = ./kak-lsp.toml;
};
}

View file

@ -1,88 +0,0 @@
# --- kks
eval %sh{ kks init }
# --- kak-lsp
eval %sh{kak-lsp --kakoune -s $kak_session}
hook global WinCreate .* %{
lsp-inlay-hints-enable window
lsp-auto-signature-help-enable
}
hook global WinSetOption filetype=(nix|haskell) %{
lsp-enable-window
}
set-option global lsp_completion_trigger "execute-keys 'h<a-h><a-k>\S[^\h\n,=;*(){}\[\]]\z<ret>'"
set-option global lsp_diagnostic_line_error_sign "!"
set-option global lsp_diagnostic_line_warning_sign "?"
hook global WinSetOption filetype=(rust) %{
map window user "l" ':enter-user-mode lsp<ret>' -docstring "LSP mode"
lsp-enable-window
lsp-auto-hover-insert-mode-disable
set-option window lsp_hover_anchor true
set-face window DiagnosticError default+u
set-face window DiagnosticWarning default+u
set-option window lsp_server_configuration rust.clippy_preference="on"
}
# hook global WinSetOption filetype=rust %{
# lsp-enable-window hook window BufWritePre .* lsp-formatting-sync
# hook window -group rust-inlay-hints BufWritePost .* rust-analyzer-inlay-hints
# hook -once -always window WinSetOption filetype=.* %{
# remove-hooks window rust-inlay-hints
# }
# }
map global normal <a-d> ':lsp-definition<ret>'
# --- kakoune-rainbow
hook global ModuleLoaded rainbow %{
set-option global rainbow_colors rgb:FF3B2F+db rgb:FF9500+db rgb:FFCC02+db rgb:27cd41+db rgb:007AFF+db rgb:AF52DE+db
hook global WinSetOption filetype=(rust|python|c|cpp|scheme|lisp|clojure|javascript|json|kak|haskell|python|latex|nix) %{
rainbow-enable-window
}
}
# --- alacritty.kak
hook global ModuleLoaded x11 %{
alias global terminal kitty-terminal
alias global popup alacritty-terminal-popup
}
# --- Kakship
hook global ModuleLoaded kakship %{
kakship-enable
}
# --- Broot
define-command -override broot-oneoff-select -docstring 'focus broot' %{
evaluate-commands %sh{
d="$(dirname "$kak_buffile")"
b="$(basename "$kak_buffile")"
echo echo -debug "$d"
broot_cmd="broot"
if [ -d "$d" ]; then
broot_cmd="$broot_cmd --cmd \":focus $d;:select $b\""
fi
echo "kks-connect ala-popup sh -c '""kks send edit $broot_cmd""'"
}
}
define-command ala-popup -params .. -shell-completion -docstring 'alacritty-terminal-popup <program> [arguments]: create a new terminal as an Alacritty window (class: popup, app_id: popup)' %{
nop %sh{
setsid alacritty -o window.dimensions.columns=200 window.dimensions.lines=57 --title popup --class 'alacritty-popup' --command "$@" < /dev/null > /dev/null 2>&1 &
}
}
# --- Map
map global normal <c-f> ':fzf-mode<ret>f<ret>'
map global normal <c-t> ':alacritty-popup<ret>'
require-module fzf
set-option global fzf_terminal_command 'ala-popup kak -c %val{session} -e "%arg{@}"'
require-module alacritty
require-module rainbow

View file

@ -1,48 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
inherit (config.modules.other.system) username;
in {
config.home-manager.users.${username}.programs.kakoune.config.keyMappings = [
{
mode = "normal";
key = "<esc>";
effect = ";,";
docstring = "Press escape to clear highlighted text and collapse cursors";
}
{
mode = "normal";
key = "<c-v>";
effect = ":comment-line<ret>";
docstring = "Comment a line with <c-v>!";
}
{
mode = "normal";
key = "b";
effect = ":db<ret>";
docstring = "close current buffer";
}
{
mode = "normal";
key = "n";
effect = ":bp<ret>";
docstring = "go to next buffer";
}
{
mode = "normal";
key = "m";
effect = ":bn<ret>";
docstring = "go to next buffer";
}
{
mode = "normal";
key = " f";
effect = ":fzf-mode<ret>";
docstring = "open fzf";
}
];
}

View file

@ -1,20 +0,0 @@
# add_newline = false
format = """
\$directory
\${custom.separator}
"""
[directory]
format = '[$path/]($style)'
truncate_length = 2
truncate_to_repo = false
use_logical_pat = true
style = "fg:cyan"
truncate_symbol = "../"
disabled = false
[custom.separator]
format = "[ ||| ]($style)"
style = "fg:purple"
disabled = false

View file

@ -1,5 +0,0 @@
_: {
imports = [
./kakoune
];
}

View file

@ -1,3 +1,3 @@
_: {
imports = [./btop.nix ./ncmpcpp.nix ./yazi.nix];
imports = [./btop.nix];
}

View file

@ -1,162 +0,0 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.modules.usrEnv.programs.media.ncmpcpp;
inherit (config.modules.other.system) username;
inherit (config.modules.usrEnv.services.media.mpd) musicDirectory;
in {
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.ncmpcpp = {
enable = true;
package = pkgs.ncmpcpp.override {visualizerSupport = true;};
mpdMusicDir = "${musicDirectory}";
bindings = [
{
key = "j";
command = "scroll_down";
}
{
key = "k";
command = "scroll_up";
}
{
key = "J";
command = ["select_item" "scroll_down"];
}
{
key = "K";
command = ["select_item" "scroll_up"];
}
];
settings = {
# Miscelaneous
ignore_leading_the = true;
external_editor = "nvim";
message_delay_time = 1;
playlist_disable_highlight_delay = 2;
autocenter_mode = "yes";
centered_cursor = "yes";
allow_for_physical_item_deletion = "no";
lines_scrolled = "0";
follow_now_playing_lyrics = "yes";
# lyrics_fetchers = "musixmatch";
connected_message_on_startup = "no";
mouse_support = "yes";
# visualizer
visualizer_data_source = "/tmp/mpd.fifo";
visualizer_output_name = "mpd_visualizer";
visualizer_type = "ellipse";
visualizer_look = " ";
visualizer_color = "blue, green";
# appearance
colors_enabled = "yes";
browser_playlist_prefix = "$2 $5 ";
playlist_display_mode = "classic";
user_interface = "classic";
volume_color = "white";
# window
song_window_title_format = "Music";
statusbar_visibility = "no";
header_visibility = "no";
titles_visibility = "no";
# progress bar
progressbar_look = "";
progressbar_color = "black";
progressbar_elapsed_color = "blue";
# song list
song_status_format = "$7%t";
song_list_format = "$(008)%t$R $(247)%a$R$5 %l$8";
song_columns_list_format = "(53)[blue]{tr} (45)[blue]{a}";
current_item_prefix = "$b$2| ";
current_item_suffix = "$/b$5";
now_playing_prefix = "$b$5| ";
now_playing_suffix = "$/b$5";
song_library_format = "{{%a - %t} (%b)}|{%f}";
# colors
main_window_color = "blue";
current_item_inactive_column_prefix = "$b$5";
current_item_inactive_column_suffix = "$/b$5";
color1 = "white";
color2 = "blue";
/*
alternative_header_first_line_format = "$5{$b%t$/b}$9";
alternative_header_second_line_format = "$3by $7{$b%a$/b}$9 $3from $7{$b%b$/b}$9 $5{(%y)}";
song_list_format = " $2%n$(end) $9 $3%a$(end) $(245)-$9 $(246)%t$9 $R{ $5%y$9}$(end) $(246)%lq$(end)";
song_columns_list_format = "(3f)[red]{n} (3f)[246]{} (35)[white]{t} (18)[blue]{a} (30)[green]{b} (5f)[yellow]{d} (5f)[red]{y} (7f)[magenta]{l}";
song_status_format = "$b $8%A $8$3 $3%t $3$5 $5%b $5$2 $2%y $2$8 %g";
playlist_display_mode = "columns";
browser_display_mode = "columns";
search_engine_display_mode = "columns";
now_playing_prefix = "$b";
now_playing_suffix = "$/b";
browser_playlist_prefix = "$2 $5 ";
playlist_disable_highlight_delay = "1";
message_delay_time = "1";
progressbar_look = "";
colors_enabled = "yes";
empty_tag_color = "red";
statusbar_color = "blue";
state_line_color = "black";
state_flags_color = "default";
main_window_color = "blue";
header_window_color = "white";
alternative_ui_separator_color = "black";
window_border_color = "green";
active_window_border = "red";
volume_color = "default";
progressbar_color = "black";
progressbar_elapsed_color = "blue";
statusbar_time_color = "blue";
player_state_color = "default";
display_bitrate = "yes";
autocenter_mode = "yes";
centered_cursor = "yes";
titles_visibility = "no";
enable_window_title = "yes";
statusbar_visibility = "yes";
empty_tag_marker = "";
mouse_support = "yes";
header_visibility = "no";
display_remaining_time = "no";
ask_before_clearing_playlists = "yes";
discard_colors_if_item_is_selected = "yes";
user_interface = "alternative";
default_find_mode = "wrapped";
lyrics_directory = "~/.lyrics";
follow_now_playing_lyrics = "yes";
store_lyrics_in_song_dir = "no";
ignore_leading_the = "yes";
lines_scrolled = "1";
mouse_list_scroll_whole_page = "no";
show_hidden_files_in_local_browser = "no";
startup_screen = "playlist";
connected_message_on_startup = "no";
playlist_separate_albums = "no";
allow_for_physical_item_deletion = "no";
visualizer_in_stereo = "yes";
visualizer_data_source = "/tmp/mpd.fifo";
visualizer_type = "wave_filled";
visualizer_look = "";
*/
};
};
};
};
}

View file

@ -1,20 +0,0 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.modules.programs.yazi;
inherit (config.modules.other.system) username;
in {
options.modules.programs.yazi = {enable = mkEnableOption "yazi";};
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.yazi = {
enable = true;
enableFishIntegration = true;
};
};
};
}

View file

@ -9,7 +9,7 @@
inherit (lib) mkIf;
in {
config = mkIf cfg.enable {
environment.systemPackages = [pkgs.mpc-cli];
environment.systemPackages = [pkgs.mpc];
systemd.services.mpd.environment = {
# https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/609
XDG_RUNTIME_DIR = "/run/user/1000";

View file

@ -1,7 +1,4 @@
{
pkgs,
...
}: rec {
{pkgs, ...}: rec {
packages = {
fish = pkgs.callPackage ./shell {};
# helix = pkgs.callPackge ./helix {};

View file

@ -1,36 +0,0 @@
{
inputs,
pkgs,
...
}: let
toml = pkgs.formats.toml {};
inherit (inputs.helix.packages.${pkgs.stdenv.system}) helix;
packages = with pkgs; [
# C/C++
clang-tools
# Markdown
marksman
# Nix
nil
lldb_19
# Bash
bash-language-server
# Shell
shellcheck
];
helix-config = import ./config.nix;
helix-wrapped = pkgs.symlinkJoin {
name = "fish-wrapped";
paths = [helix] ++ packages;
buildInputs = [pkgs.makeWrapper];
postBuild = ''
wrapProgram $out/bin/fish --set XDG_CONFIG_HOME "${toml.generate "config.toml" helix-config}"
'';
};
in
helix-wrapped

View file

@ -1,203 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.modules.system.programs.editors.helix;
inherit (config.modules.other.system) username;
inherit (lib) mkIf getExe;
in {
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.helix.languages = {
language = let
extraFormatter = lang: {
command = getExe pkgs.deno;
args = ["fmt" "-" "--ext" lang];
};
in [
{
name = "bash";
auto-format = true;
formatter = {
command = getExe pkgs.shfmt;
args = ["-i" "2"];
};
}
{
name = "clojure";
injection-regex = "(clojure|clj|edn|boot|yuck)";
file-types = ["clj" "cljs" "cljc" "clje" "cljr" "cljx" "edn" "boot" "yuck"];
}
{
name = "cmake";
auto-format = true;
language-servers = ["cmake-language-server"];
formatter = {
command = getExe pkgs.cmake-format;
args = ["-"];
};
}
{
name = "javascript";
auto-format = true;
language-servers = ["dprint" "typescript-language-server"];
}
{
name = "json";
formatter = extraFormatter "json";
}
{
name = "markdown";
auto-format = true;
formatter = extraFormatter "md";
}
{
name = "python";
language-servers = ["pyright"];
formatter = {
command = getExe pkgs.black;
args = ["-" "--quiet" "--line-length 100"];
};
}
{
name = "typescript";
auto-format = true;
language-servers = ["dprint" "typescript-language-server"];
}
{
name = "rust";
debugger = {
command = "${pkgs.lldb_19}/bin/lldb-dap";
name = "lldb";
transport = "stdio";
templates = [
{
name = "binary";
request = "launch";
completion = [
{
name = "binary";
completion = "filename";
}
];
args = {
program = "{0}";
runInTerminal = true;
};
}
];
};
}
{
name = "c";
debugger = {
name = "gdb";
command = "${pkgs.gdb}/bin/gdb";
transport = "stdio";
templates = [
{
name = "binary";
request = "launch";
completion = [
{
name = "binary";
completion = "filename";
}
];
args = {
program = "{0}";
runInTerminal = true;
};
}
];
};
}
];
language-server = {
bash-language-server = {
command = getExe pkgs.bash-language-server;
args = ["start"];
};
clangd = {
command = "${pkgs.clang-tools}/bin/clangd";
clangd.fallbackFlags = ["-std=c++2b"];
};
cmake-language-server = {
command = getExe pkgs.cmake-language-server;
};
dprint = {
command = getExe pkgs.dprint;
args = ["lsp"];
};
nil = {
command = getExe pkgs.nil;
# alejandro
config.nil.formatting.command = ["${getExe pkgs.alejandra}" "-q"];
};
qmlls = {
command = "${pkgs.kdePackages.full}/bin/qmlls";
};
pyright = {
command = "${pkgs.pyright}/bin/pyright-langserver";
args = ["--stdio"];
config = {
reportMissingTypeStubs = false;
analysis = {
typeCheckingMode = "basic";
autoImportCompletions = true;
};
};
};
typescript-language-server = {
command = getExe pkgs.typescript-language-server;
args = ["--stdio"];
config = let
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
in {
typescript-language-server.source = {
addMissingImports.ts = true;
fixAll.ts = true;
organizeImports.ts = true;
removeUnusedImports.ts = true;
sortImports.ts = true;
};
typescript = {inherit inlayHints;};
javascript = {inherit inlayHints;};
hostInfo = "helix";
};
};
# vscode-css-language-server = {
# command = "${pkgs.nodePackages.vscode-langservers-extracted}/bin/vscode-css-languageserver";
# args = ["--stdio"];
# config = {
# provideFormatter = true;
# css.validate.enable = true;
# scss.validate.enable = true;
# };
# };
};
};
};
};
}

View file

@ -1,81 +0,0 @@
{
config,
inputs,
lib,
pkgs,
...
}: let
cfg = config.modules.system.programs.editors.helix;
inherit (config.modules.other.system) username;
inherit (lib) mkIf getExe;
inherit (inputs.helix.packages.${pkgs.stdenv.system}) helix;
wrapped-helix = pkgs.symlinkJoin {
name = "helix-wrapped";
paths = with pkgs; [
helix
# C/C++
clang-tools
# Markdown
marksman
# Nix
nil
lldb_19
# Bash
bash-language-server
# Shell
shellcheck
];
};
in {
imports = [./languages.nix];
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.helix = {
enable = true;
package = wrapped-helix;
settings = {
theme = "catppuccin_mocha";
editor = {
cursorline = false;
color-modes = true;
indent-guides.render = true;
lsp = {
display-inlay-hints = true;
display-messages = true;
};
line-number = "relative";
true-color = true;
auto-format = true;
completion-timeout = 5;
mouse = true;
bufferline = "multiple";
soft-wrap.enable = true;
cursor-shape = {insert = "bar";};
statusline = {
left = ["spinner" "version-control" "diagnostics" "file-name"];
right = ["file-base-name" "file-type" "selections" "position" "file-encoding"];
};
gutters.layout = ["diff" "diagnostics" "line-numbers" "spacer"];
inline-diagnostics = {
cursor-line = "hint";
other-lines = "error";
};
};
keys.normal = {
space.g = [":new" ":insert-output ${getExe pkgs.lazygit}" ":buffer-close!" ":redraw"];
esc = ["collapse_selection" "keep_primary_selection" "normal_mode"];
A-H = "goto_previous_buffer";
A-L = "goto_next_buffer";
A-w = ":buffer-close";
A-f = ":format";
};
};
};
};
};
}

View file

@ -9,7 +9,7 @@ pkgs: (with pkgs; [
bat
# clipboard
yazi
# yazi
serpl
diff-so-fancy
tig