1769288238

This commit is contained in:
2026-01-24 22:57:18 +02:00
parent fa32ae5510
commit 84020b1572
94 changed files with 1428 additions and 1024 deletions
+8
View File
@@ -0,0 +1,8 @@
{
programs.atuin.enable = true; # shell history and more in rust
programs.atuin = {
flags = [
"--disable-up-arrow"
];
};
}
+16
View File
@@ -0,0 +1,16 @@
{
imports = [
./atuin.nix
./direnv.nix
./fish.nix
./ghostty.nix
./helix.nix
./kitty.nix
./oh-my-posh.nix
./syncthing.nix
./wezterm.nix
./wl-kbptr.nix
./yazi.nix
./zed-editor.nix
];
}
+7
View File
@@ -0,0 +1,7 @@
{
programs.direnv.enable = true;
programs.direnv = {
silent = true;
nix-direnv.enable = true;
};
}
+35
View File
@@ -0,0 +1,35 @@
{
pkgs,
lib,
...
}: let
inherit (lib) getExe;
in {
programs.fish.enable = true; # friendly interactive shell in rust
programs.fish = {
shellAliases = {
cd = "z";
ed = "$EDITOR";
jf = "jj-fzf"; # think of jeff
jo = "joshuto"; # think of josh
l = "ls -lah";
la = "ls -ah";
ll = "ls -lh";
p = "pueue";
s = "systemctl";
stui = "systemctl-tui";
};
shellAbbrs = {
pa = "pueue add --";
pl = "pueue log";
};
interactiveShellInit = ''
bind \e\[3\;5~ kill-word
bind \cH backward-kill-word
set fish_greeting
set fish_cursor_default block blink
# ${getExe pkgs.bat-extras.batman} --export-env | source
if test -e ~/.profile; source ~/.profile; end
'';
};
}
+18
View File
@@ -0,0 +1,18 @@
{
config,
lib,
perSystem,
...
}: {
programs.ghostty.enable = true;
programs.ghostty = {
package = perSystem.ghostty.ghostty;
settings = {
gtk-single-instance = true;
window-decoration = "client";
keybind = [
"ctrl+shift+f=close_surface"
];
};
};
}
+190
View File
@@ -0,0 +1,190 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) getExe;
in {
programs.helix.enable = true;
programs.helix = {
# defaultEditor = true;
package = pkgs.helix.overrideAttrs (previousAttrs: {
patches =
(previousAttrs.patches or [])
++ [
./loader.patch
./term.patch
];
});
settings = {
editor = {
bufferline = "multiple";
cursorline = true;
inline-diagnostics.cursor-line = "warning";
line-number = "relative";
lsp = {
display-messages = true;
display-inlay-hints = true;
};
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
statusline = {
left = ["mode" "spinner" "version-control"];
center = ["file-name"];
right = ["diagnostics" "selections" "position" "file-encoding" "file-line-ending" "file-type"];
separator = "|";
};
soft-wrap = {
enable = true;
max-wrap = 25;
max-indent-retain = 0;
wrap-indicator = "";
};
};
keys = {
insert.C-c = "normal_mode";
normal = {
esc = ["collapse_selection" "keep_primary_selection"];
space = {
space = "file_picker";
w = ":w";
q = ":q";
x = ":x";
n = ":n";
"," = "goto_previous_buffer";
"." = "goto_next_buffer";
l = ":reflow";
};
};
};
};
languages = {
language-server = {
# markdown-oxide.command = getExe pkgs.markdown-oxide;
# nixd.command = getExe pkgs.nixd;
# pyright = {
# command = getExe pkgs.pyright;
# args = ["-"];
# };
# rust-analyzer.command = getExe pkgs.rust-analyzer;
# texlab.command = getExe pkgs.texlab;
bash-language-server = {
command = getExe pkgs.bash-language-server;
environment = {
"SHELLCHECK_PATH" = getExe pkgs.shellcheck;
"SHFMT_PATH" = getExe pkgs.shfmt;
};
};
clangd.command = "${pkgs.clang-tools}/bin/clangd";
# fsac = {
# command = getExe pkgs.fsautocomplete;
# config = {
# editor.formatOnSave = true;
# AutomaticWorkspaceInit = true;
# FSharp.ExternalAutocomplete = true;
# FSharp.linting.fsharplint.enabled = true;
# FSharp.linting.fsharplint.configFile = "fsharplint.json";
# FSharp.formatting.fantomas.enabled = true;
# };
# };
nil = {
command = getExe pkgs.nil;
config = {
formatting.command = [(getExe pkgs.alejandra)];
};
};
ruff = {
command = getExe pkgs.ruff;
args = ["server"];
};
tinymist.command = getExe pkgs.tinymist;
vscode-json-language-server.command = getExe pkgs.nodePackages.vscode-json-languageserver;
yaml-language-server.command = getExe pkgs.yaml-language-server;
zk = {
command = getExe pkgs.zk;
args = ["lsp"];
};
};
language = [
{
name = "nix";
auto-format = true;
language-servers = ["nil"];
}
{
name = "typst";
auto-format = true;
formatter.command = getExe pkgs.typstyle;
formatter.args = ["-l" "100"];
language-servers = ["tinymist"];
}
{
name = "markdown";
# auto-format = true;
language-servers = ["zk" "markdown-oxide"];
}
{
name = "c";
auto-format = true;
# formatter.command = "${pkgs.clang-tools}/bin/clang-format";
}
{
name = "cpp";
auto-format = true;
# formatter.command = "${pkgs.clang-tools}/bin/clang-format";
}
# {
# name = "fsharp";
# auto-format = true;
# language-servers = ["fsac"];
# scope = "source.fs";
# roots = ["fsproj" "sln" ".git"];
# }
# {
# name = "rust";
# auto-format = true;
# language-servers = ["rust-analyzer"];
# formatter.command = getExe pkgs.rustfmt;
# }
{
name = "json";
auto-format = true;
formatter.command = getExe pkgs.jq;
language-servers = ["vscode-json-language-server"];
}
{
name = "yaml";
auto-format = true;
formatter.command = getExe pkgs.yamlfmt;
formatter.args = ["-"];
language-servers = ["yaml-language-server"];
}
{
name = "bash";
auto-format = true;
# formatter.command = getExe pkgs.shfmt;
# formatter.args = ["-"];
}
{
name = "python";
auto-format = true;
language-servers = [
{
name = "ruff";
# only-features = ["format" "diagnostics"];
}
# {
# name = "pyright";
# except-features = ["format" "diagnostics"];
# }
];
}
];
};
};
}
+14
View File
@@ -0,0 +1,14 @@
{
config,
lib,
...
}: {
programs.kitty = {
settings = {
tab_bar_edge = "bottom";
tab_bar_align = "left";
tab_bar_style = "fade";
# tab_separator = " ";
};
};
}
+10
View File
@@ -0,0 +1,10 @@
--- a/helix-loader/src/config.rs
+++ b/helix-loader/src/config.rs
@@ -11,7 +11,6 @@ pub fn default_lang_config() -> toml::Value {
pub fn user_lang_config() -> Result<toml::Value, toml::de::Error> {
let config = [
crate::config_dir(),
- crate::find_workspace().0.join(".helix"),
]
.into_iter()
.map(|path| path.join("languages.toml"))
+123
View File
@@ -0,0 +1,123 @@
{
config,
lib,
...
}: {
programs.oh-my-posh.enable = true;
programs.oh-my-posh = {
settings = {
# version = 2;
final_space = true;
shell_integration = true;
console_title_template = "{{ .Shell }} in {{ .Folder }}";
blocks = [
{
type = "prompt";
alignment = "left";
overflow = "hidden";
segments = [
{
type = "path";
style = "plain";
background = "transparent";
foreground = "blue";
template = "{{ .Path }}";
properties = {
style = "full";
};
}
{
type = "text";
style = "plain";
background = "transparent";
template = "{{ if .Env.BW_SESSION }} 󰞀{{ end }}";
}
{
type = "nix-shell";
style = "plain";
background = "transparent";
template = "{{ if ne .Type \"unknown\" }} {{ end }}";
}
{
type = "git";
style = "plain";
foreground = "p:grey";
background = "transparent";
template = " {{ .HEAD }}{{ if or (.Working.Changed) (.Staging.Changed) }}*{{ end }} <cyan>{{ if gt .Behind 0 }}{{ end }}{{ if gt .Ahead 0 }}{{ end }}</>";
properties = {
branch_icon = "";
commit_icon = "@";
fetch_status = true;
};
}
];
}
{
type = "prompt";
alignment = "right";
segments = [
{
type = "session";
style = "plain";
foreground = "white";
background = "transparent";
template = "{{ if .SSHSession }} {{ .UserName }}@{{ .HostName }}{{ end }}";
}
{
style = "plain";
foreground = "white";
background = "transparent";
properties = {
charged_icon = "󰁹";
charging_icon = "󱟡";
discharging_icon = "󱟟";
};
template = "{{ if not .Error }} {{ .Icon }} {{ .Percentage }}%{{ end }}";
type = "battery";
}
];
}
{
type = "rprompt";
overflow = "hidden";
segments = [
{
type = "executiontime";
style = "plain";
foreground = "yellow";
background = "transparent";
template = "{{.FormattedMs}}";
properties = {
threshold = 5000;
};
}
];
}
{
type = "prompt";
alignment = "left";
newline = true;
segments = [
{
type = "text";
style = "plain";
foreground_templates = ["{{if gt .Code 0}}red{{end}}" "{{if eq .Code 0}}magenta{{end}}"];
background = "transparent";
template = ">";
}
];
}
];
transient_prompt = {
foreground_templates = ["{{if gt .Code 0}}red{{end}}" "{{if eq .Code 0}}magenta{{end}}"];
background = "transparent";
template = "> ";
};
secondary_prompt = {
foreground = "magenta";
background = "transparent";
template = "-> ";
};
};
};
}
+26
View File
@@ -0,0 +1,26 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.syncthing;
in {
options = {
syncthing.enable = mkEnableOption "enable syncthing";
};
config = mkIf cfg.enable {
services.syncthing = {
enable = true;
overrideDevices = false;
overrideFolders = false;
tray.enable = true;
settings = {
options = {
urAccepted = -1;
relaysEnabled = true;
};
};
};
};
}
+17
View File
@@ -0,0 +1,17 @@
--- a/helix-term/src/config.rs
+++ b/helix-term/src/config.rs
@@ -58,12 +58,11 @@ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
impl Config {
pub fn load(
global: Result<String, ConfigLoadError>,
- local: Result<String, ConfigLoadError>,
+ _local: Result<String, ConfigLoadError>,
) -> Result<Config, ConfigLoadError> {
let global_config: Result<ConfigRaw, ConfigLoadError> =
global.and_then(|file| toml::from_str(&file).map_err(ConfigLoadError::BadConfig));
- let local_config: Result<ConfigRaw, ConfigLoadError> =
- local.and_then(|file| toml::from_str(&file).map_err(ConfigLoadError::BadConfig));
+ let local_config: Result<ConfigRaw, ConfigLoadError> = Err(ConfigLoadError::default());
let res = match (global_config, local_config) {
(Ok(global), Ok(local)) => {
let mut keys = keymap::default();
+192
View File
@@ -0,0 +1,192 @@
{
config,
# inputs,
# pkgs,
lib,
...
}: {
programs.wezterm.enable = true;
programs.wezterm = {
# package = inputs.wezterm.packages.${pkgs.system}.default;
extraConfig = let
arrows = {
left = "LeftArrow";
down = "DownArrow";
up = "UpArrow";
right = "RightArrow";
};
homerow-arrows = {
left = "n";
down = "e";
up = "i";
right = "o";
};
genNavigation = keys: ''
{ key = '${keys.left}', mods = 'LEADER', action = act.ActivatePaneDirection 'Left' },
{ key = '${keys.down}', mods = 'LEADER', action = act.ActivatePaneDirection 'Down' },
{ key = '${keys.up}', mods = 'LEADER', action = act.ActivatePaneDirection 'Up' },
{ key = '${keys.right}', mods = 'LEADER', action = act.ActivatePaneDirection 'Right' },
{ key = '${keys.left}', mods = 'CTRL|SHIFT', action = act.ActivatePaneDirection 'Left' },
{ key = '${keys.down}', mods = 'CTRL|SHIFT', action = act.ActivatePaneDirection 'Down' },
{ key = '${keys.up}', mods = 'CTRL|SHIFT', action = act.ActivatePaneDirection 'Up' },
{ key = '${keys.right}', mods = 'CTRL|SHIFT', action = act.ActivatePaneDirection 'Right' },
'';
in
# lua
''
local wezterm = require 'wezterm'
local act = wezterm.action
local resurrect = wezterm.plugin.require("https://github.com/MLFlexer/resurrect.wezterm")
local workspace_switcher = wezterm.plugin.require("https://github.com/MLFlexer/smart_workspace_switcher.wezterm")
wezterm.on("augment-command-palette", function(window, pane)
local workspace_state = resurrect.workspace_state
return {
{
brief = "Window | Workspace: Switch Workspace",
icon = "md_briefcase_arrow_up_down",
action = workspace_switcher.switch_workspace(),
},
{
brief = "Window | Workspace: Rename Workspace",
icon = "md_briefcase_edit",
action = wezterm.action.PromptInputLine({
description = "Enter new name for workspace",
action = wezterm.action_callback(function(window, pane, line)
if line then
wezterm.mux.rename_workspace(wezterm.mux.get_active_workspace(), line)
resurrect.state_manager.save_state(workspace_state.get_workspace_state())
end
end),
}),
},
}
end)
return {
front_end = 'WebGpu',
unix_domains = {
{
name = 'unix',
},
},
enable_kitty_graphics = true,
window_padding = {
left = 0,
right = 0,
top = 0,
bottom = 0,
},
use_fancy_tab_bar = false,
inactive_pane_hsb = {
-- saturation = 0.8,
brightness = 0.7,
},
-- window_frame = {
-- font = wezterm.font { family = 'Cantarell', weight = 'Bold' },
-- },
disable_default_key_bindings = true,
leader = { key = 'Space', mods = 'CTRL', timeout_milliseconds = 2000 },
keys = {
{
key = "w",
mods = "LEADER",
action = resurrect.window_state.save_window_action(),
},
{
key = "t",
mods = "LEADER",
action = resurrect.tab_state.save_tab_action(),
},
{
key = "s",
mods = "LEADER",
action = wezterm.action_callback(function(win, pane)
resurrect.state_manager.save_state(resurrect.workspace_state.get_workspace_state())
resurrect.window_state.save_window_action()
end),
},
{
key = "r",
mods = "LEADER",
action = wezterm.action_callback(function(win, pane)
resurrect.fuzzy_loader.fuzzy_load(win, pane, function(id, label)
local type = string.match(id, "^([^/]+)") -- match before '/'
id = string.match(id, "([^/]+)$") -- match after '/'
id = string.match(id, "(.+)%..+$") -- remove file extention
local opts = {
relative = true,
restore_text = true,
on_pane_restore = resurrect.tab_state.default_on_pane_restore,
}
if type == "workspace" then
local state = resurrect.state_manager.load_state(id, "workspace")
resurrect.workspace_state.restore_workspace(state, opts)
elseif type == "window" then
local state = resurrect.state_manager.load_state(id, "window")
resurrect.window_state.restore_window(pane:window(), state, opts)
elseif type == "tab" then
local state = resurrect.state_manager.load_state(id, "tab")
resurrect.tab_state.restore_tab(pane:tab(), state, opts)
end
end)
end),
},
{
key = "d",
mods = "LEADER",
action = wezterm.action_callback(function(win, pane)
resurrect.fuzzy_loader.fuzzy_load(win, pane, function(id)
resurrect.state_manager.delete_state(id)
end,
{
title = "Delete State",
description = "Select State to Delete and press Enter = accept, Esc = cancel, / = filter",
fuzzy_description = "Search State to Delete: ",
is_fuzzy = true,
})
end),
},
{
key = 'p',
mods = 'LEADER',
action = wezterm.action.ActivateCommandPalette,
},
{ key = 'Enter', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
{ key = 'R', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
{ key = '=', mods = 'CTRL', action = act.IncreaseFontSize },
{ key = '-', mods = 'CTRL', action = act.DecreaseFontSize },
{ key = '0', mods = 'CTRL', action = act.ResetFontSize },
{ key = 'C', mods = 'SHIFT|CTRL', action = act.CopyTo 'Clipboard' },
-- { key = 'N', mods = 'SHIFT|CTRL', action = act.SpawnWindow },
{ key = 'l', mods = 'SHIFT|CTRL', action = act.CharSelect{ copy_on_select = true, copy_to = 'ClipboardAndPrimarySelection' } },
{ key = 'v', mods = 'SHIFT|CTRL', action = act.PasteFrom 'Clipboard' },
{ key = '<', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(-1) },
{ key = '>', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(1) },
{ key = 'Tab', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(-1) },
{ key = 'Tab', mods = 'CTRL', action = act.ActivateTabRelative(1) },
{ key = '%', mods = 'SHIFT|CTRL', action = act.SplitVertical { domain = 'CurrentPaneDomain' }, },
{ key = '"', mods = 'SHIFT|CTRL', action = act.SplitHorizontal { domain = 'CurrentPaneDomain' }, },
-- pane navigation
${genNavigation arrows}
${genNavigation homerow-arrows}
{ key = 't', mods = 'SHIFT|CTRL', action = act.SpawnTab 'CurrentPaneDomain' },
{ key = 'w', mods = 'SHIFT|CTRL', action = act.CloseCurrentTab{ confirm = false } },
{ key = 'f', mods = 'SHIFT|CTRL', action = act.CloseCurrentPane{ confirm = false } },
{ key = 'b', mods = 'LEADER|CTRL', action = act.SendString '\x02', },
{ key = 'Enter', mods = 'LEADER', action = act.ActivateCopyMode, },
-- { key = 'p', mods = 'LEADER', action = act.PasteFrom 'PrimarySelection', },
{ key = 'k', mods = 'SHIFT|CTRL', action = act.Multiple
{
act.ClearScrollback 'ScrollbackAndViewport',
act.SendKey { key = 'L', mods = 'CTRL' },
},
},
},
}
'';
};
}
+28
View File
@@ -0,0 +1,28 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.programs.wl-kbptr;
iniFormat = pkgs.formats.ini {listsAsDuplicateKeys = true;};
in {
options = {
programs.wl-kbptr = {
enable = mkEnableOption "enable niri desktop";
settings = mkOption {
inherit (iniFormat) type;
default = {};
};
};
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
wl-kbptr
];
xdg.configFile."wl-kbptr/config" = mkIf (cfg.settings != {}) {
source = iniFormat.generate "wl-kbptr-config" cfg.settings;
};
};
}
+107
View File
@@ -0,0 +1,107 @@
{
pkgs,
# config,
lib,
...
}: {
programs.yazi.enable = true;
programs.yazi = {
shellWrapperName = "y";
settings = {
opener = {
open = [
{
run = "xdg-open \"$@\"";
orphan = true;
desc = "Open";
}
];
edit = [
{
run = "$EDITOR \"$@\"";
block = true;
desc = "Edit";
}
];
dragdrop = [
{
run = "${lib.getExe pkgs.ripdrag} -ab \"$@\"";
desc = "Drag'n'drop";
orphan = true;
for = "unix";
}
];
};
open.rules = [
{
mime = "text/*";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.json";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.yaml";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.yml";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.toml";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.sh";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.ini";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.conf";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.csv";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.go";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.html";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.c";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.cpp";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.rs";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.nix";
use = ["edit" "open" "dragdrop"];
}
{
name = "*.py";
use = ["edit" "open" "dragdrop"];
}
{
name = "*";
use = ["open" "edit" "dragdrop"];
}
];
};
};
}
+150
View File
@@ -0,0 +1,150 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib) getExe mkForce;
in {
programs.zed-editor = {
extensions = [
"bash"
"fsharp"
"justfile"
"nix"
"typst"
];
userSettings = {
vim_mode = true;
ui_font_size = mkForce 16;
buffer_font_size = mkForce 16;
# features = {inline_completion_provider = "none";};
auto_update = false;
languages = {
"FSharp" = {
language-servers = [
"fsautocomplete"
];
};
"Nix" = {
language-servers = [
"nil"
];
# formatter = {
# external.command = getExe pkgs.alejandra;
# };
};
# "Rust" = {
# formatter = {
# external = {
# command = getExe pkgs.rustfmt;
# arguments = ["--edition" "2021"];
# };
# };
# };
"typst" = {
language-servers = ["tinymist"];
format_on_save = "on";
# formatter = {
# external = {
# command = getExe pkgs.typstyle;
# arguments = ["-i" "{buffer_path}"];
# };
# };
};
"Python" = {
format_on_save = "on";
formatter = [
{
language_server = {
name = "ruff";
};
}
];
language_servers = ["ruff"];
};
};
lsp = {
bash-language-server = {
binary = {
path = getExe pkgs.bash-language-server;
env = {
"SHELLCHECK_PATH" = getExe pkgs.shellcheck;
"SHFMT_PATH" = getExe pkgs.shfmt;
};
};
};
fsautocomplete = {
binary = {
path = getExe pkgs.fsautocomplete;
};
settings = {
AutomaticWorkspaceInit = true;
FSharp.ExternalAutocomplete = true;
FSharp.linting.fsharplint.enabled = true;
FSharp.linting.fsharplint.configFile = "fsharplint.json";
FSharp.formatting.fantomas.enabled = true;
};
};
clangd = {
binary = {
arguments = [];
path = "${pkgs.clang-tools}/bin/clangd";
};
};
# rust-analyzer = {
# binary = {
# arguments = [];
# path = getExe pkgs.rust-analyzer;
# };
# };
ruff = {
binary = {
arguments = [];
path = getExe pkgs.ruff;
};
};
# nixd = {
# binary = {
# arguments = [];
# path = getExe pkgs.nixd;
# };
# initialization_options.formatting.command = [(getExe pkgs.alejandra)];
# };
nil = {
binary = {
arguments = [];
path = getExe pkgs.nil;
};
settings.formatting.command = [(getExe pkgs.alejandra)];
};
# texlab = {
# binary = {
# arguments = [];
# path = getExe pkgs.texlab;
# };
# };
tinymist = {
binary = {
arguments = [];
path = getExe pkgs.tinymist;
};
};
vscode-json-language-server = {
binary = {
path = getExe pkgs.nodePackages.vscode-json-languageserver;
};
};
yaml-language-server = {
binary = {
path = getExe pkgs.yaml-language-server;
};
};
};
telemetry = {
diagnostics = false;
metrics = false;
};
};
};
}