added stuff

This commit is contained in:
vali 2024-04-09 23:11:33 +02:00
commit 7d4f626b7d
907 changed files with 70990 additions and 0 deletions

View file

@ -0,0 +1,8 @@
{
imports = [
./editors
./emulators
./shell
./tools
];
}

View file

@ -0,0 +1,6 @@
{
imports = [
#./helix # sucks
./neovim # full-blown IDE
];
}

View file

@ -0,0 +1,203 @@
{
lib,
pkgs,
osConfig,
inputs',
...
}: let
inherit (lib) mkIf;
dev = osConfig.modules.device;
acceptedTypes = ["desktop" "laptop" "hybrid" "server" "lite"];
in {
config = mkIf (builtins.elem dev.type acceptedTypes) {
programs.helix = {
enable = false;
package = inputs'.helix.packages.default.overrideAttrs (self: {
makeWrapperArgs = with pkgs;
self.makeWrapperArgs
or []
++ [
"--suffix"
"PATH"
":"
(lib.makeBinPath [
clang-tools
marksman
nil
luajitPackages.lua-lsp
nodePackages.bash-language-server
nodePackages.vscode-css-languageserver-bin
nodePackages.vscode-langservers-extracted
nodePackages.prettier
rustfmt
rust-analyzer
black
alejandra
shellcheck
])
];
});
settings = {
theme = "catppuccin_mocha_transparent";
icons = "nerdfonts";
keys.normal = {
"{" = "goto_prev_paragraph";
"}" = "goto_next_paragraph";
"X" = "extend_line_above";
"esc" = ["collapse_selection" "keep_primary_selection"];
"C-q" = ":xa";
"C-w" = "file_picker";
"space" = {
"space" = "file_picker";
"w" = ":w";
"q" = ":bc";
"u" = {
"f" = ":format"; # format using LSP formatter
"w" = ":set whitespace.render all";
"W" = ":set whitespace.render none";
};
};
};
keys.select = {
"%" = "match_brackets";
};
editor = {
color-modes = true;
cursorline = true;
mouse = true;
idle-timeout = 1;
line-number = "relative";
scrolloff = 5;
rainbow-brackets = true;
completion-replace = true;
cursor-word = true;
bufferline = "always";
true-color = true;
rulers = [80];
soft-wrap.enable = true;
indent-guides = {
render = true;
};
sticky-context = {
enable = true;
indicator = true;
};
lsp = {
display-messages = true;
display-inlay-hints = true;
};
gutters = ["diagnostics" "line-numbers" "spacer" "diff"];
statusline = {
mode-separator = "";
separator = "";
left = ["mode" "selections" "spinner" "file-name" "total-line-numbers"];
center = [];
right = ["diagnostics" "file-encoding" "file-line-ending" "file-type" "position-percentage" "position"];
mode = {
normal = "NORMAL";
insert = "INSERT";
select = "SELECT";
};
};
whitespace.characters = {
space = "·";
nbsp = "";
tab = "";
newline = "";
};
cursor-shape = {
insert = "bar";
normal = "block";
select = "block";
};
};
};
# override catppuccin theme and remove background to fix transparency
themes = {
catppuccin_mocha_transparent = {
"inherits" = "catppuccin_mocha";
"ui.virtual.inlay-hint" = {
fg = "surface1";
};
"ui.background" = "{}";
};
};
languages = {
language = [
{
name = "bash";
auto-format = true;
formatter = {
command = "${pkgs.shfmt}/bin/shfmt";
args = ["-i" "2" "-"];
};
}
{
name = "html";
file-types = ["html" "tera"];
}
{
name = "clojure";
injection-regex = "(clojure|clj|edn|boot|yuck)";
file-types = ["clj" "cljs" "cljc" "clje" "cljr" "cljx" "edn" "boot" "yuck"];
}
];
language-server = {
bash-language-server = {
command = "${pkgs.nodePackages.bash-language-server}/bin/bash-language-server";
args = ["start"];
};
clangd = {
command = "${pkgs.clang-tools}/bin/clangd";
clangd.fallbackFlags = ["-std=c++2b"];
};
nil = {
command = lib.getExe pkgs.nil;
config.nil.formatting.command = ["${lib.getExe pkgs.alejandra}" "-q"];
};
vscode-css-language-server = {
command = "${pkgs.nodePackages.vscode-css-languageserver-bin}/bin/css-languageserver";
args = ["--stdio"];
};
};
};
};
home.packages = with pkgs; [
# some other lsp related packages / dev tools
lldb # debugging stuff
gopls # go
revive # go
rust-analyzer # rust
texlab # latex
zls # zig
#elixir_ls # broken
gcc # C/++
uncrustify # source code beautifier
black # python
alejandra # nix formatting
shellcheck # bash
gawk
haskellPackages.haskell-language-server
nodePackages.typescript-language-server
java-language-server
kotlin-language-server
nodePackages.vls
nodePackages.yaml-language-server
nodePackages.jsonlint
nodePackages.yarn
nodePackages.pnpm
sumneko-lua-language-server
nodePackages.vscode-langservers-extracted
cargo
];
};
}

View file

@ -0,0 +1,31 @@
{
inputs,
lib,
...
}: let
inherit (builtins) filter map toString elem;
inherit (lib.filesystem) listFilesRecursive;
inherit (lib.strings) hasSuffix;
inherit (lib.lists) concatLists;
mkNeovimModule = {
path,
ignoredPaths ? [./plugins/sources/default.nix],
}:
filter (hasSuffix ".nix") (
map toString (
filter (path: path != ./default.nix && !elem path ignoredPaths) (listFilesRecursive path)
)
);
nvf = inputs.neovim-flake;
in {
imports = concatLists [
# neovim-flake home-manager module
[nvf.homeManagerModules.default]
# construct this entire directory as a module
# which means all default.nix files will be imported automatically
(mkNeovimModule {path = ./.;})
];
}

View file

@ -0,0 +1,60 @@
-- alias for vim.api.nvim_create_autocmd
local create_autocmd = vim.api.nvim_create_autocmd
-- taken from https://github.com/sitiom/nvim-numbertoggle
-- I would much rather avoid fetching yet another plugin for something
-- that should be done locally - and not as a plugin
local augroup = vim.api.nvim_create_augroup("numbertoggle", {})
create_autocmd({ "BufEnter", "FocusGained", "InsertLeave", "CmdlineLeave", "WinEnter" }, {
pattern = "*",
group = augroup,
callback = function()
if vim.o.nu and vim.api.nvim_get_mode().mode ~= "i" then
vim.opt.relativenumber = true
end
end,
})
create_autocmd({ "BufLeave", "FocusLost", "InsertEnter", "CmdlineEnter", "WinLeave" }, {
pattern = "*",
group = augroup,
callback = function()
if vim.o.nu then
vim.opt.relativenumber = false
vim.cmd "redraw"
end
end,
})
-- enable spell checking & line wrapping
-- for git commit messages
create_autocmd({ "FileType" }, {
pattern = { "gitcommit" },
callback = function()
vim.opt_local.wrap = true
vim.opt_local.spell = true
end,
})
-- Highlight yank after yanking
create_autocmd({ "TextYankPost" }, {
callback = function()
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
end,
})
-- Close terminal window if process exists with code 0
create_autocmd("TermClose", {
callback = function()
if not vim.b.no_auto_quit then
vim.defer_fn(function()
if vim.api.nvim_get_current_line() == "[Process exited 0]" then
vim.api.nvim_buf_delete(0, { force = true })
end
end, 50)
end
end,
})

View file

@ -0,0 +1,25 @@
local options = {
-- disable the -- STATUS -- line
showmode = false,
-- spellchecking
spell = true,
-- spell langs
spelllang = { "en" },
}
-- iterate over the options table and set the options
-- for each key = value pair
for key, value in pairs(options) do
vim.opt[key] = value
end
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = { "toggleterm" },
callback = function()
vim.opt_local.wrap = false
vim.opt_local.spell = false
end,
})

View file

@ -0,0 +1,37 @@
local float_options = {
border = 'single',
max_width = math.ceil(vim.api.nvim_win_get_width(0) * 0.6),
max_height = math.ceil(vim.api.nvim_win_get_height(0) * 0.8),
}
vim.lsp.handlers['textDocument/publishDiagnostics'] =
vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = true,
signs = false,
underline = true,
update_in_insert = false,
severity_sort = true,
})
vim.lsp.handlers['textDocument/show_line_diagnostics'] =
vim.lsp.with(vim.lsp.handlers.hover, float_options)
-- Prevent show notification
-- <https://github.com/neovim/neovim/issues/20457#issuecomment-1266782345>
vim.lsp.handlers['textDocument/hover'] = function(_, result, ctx, config)
config = config or float_options
config.focus_id = ctx.method
if not result then
return
end
local markdown_lines =
vim.lsp.util.convert_input_to_markdown_lines(result.contents)
markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines)
if vim.tbl_isempty(markdown_lines) then
return
end
return vim.lsp.util.open_floating_preview(markdown_lines, 'markdown', config)
end
vim.lsp.handlers['textDocument/signatureHelp'] =
vim.lsp.with(vim.lsp.handlers.signature_help, float_options)

View file

@ -0,0 +1,4 @@
-- disables "how to disable mouse" message
-- in right click popups
vim.cmd.aunmenu [[PopUp.How-to\ disable\ mouse]]
vim.cmd.aunmenu [[PopUp.-1-]]

View file

@ -0,0 +1,5 @@
if vim.g.neovide then
vim.o.guifont = "Iosevka Nerd Font:h14" -- text below applies for VimScript
vim.g.neovide_theme = 'auto'
vim.g.neovide_transparency = 0.95
end

View file

@ -0,0 +1,59 @@
local noice = require("noice")
local no_top_text = {
opts = {
border = {
text = { top = "" },
},
},
}
noice.setup({
cmdline = {
format = {
cmdline = no_top_text,
filter = no_top_text,
lua = no_top_text,
search_down = no_top_text,
search_up = no_top_text,
},
},
lsp = {
override = {
["cmp.entry.get_documentation"] = true,
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
},
progress = {
enabled = false,
},
},
popupmenu = {
backend = "cmp",
},
routes = {
{
filter = {
event = "msg_show",
kind = "search_count",
},
opts = { skip = true },
},
},
views = {
cmdline_popup = {
border = {
style = "single",
},
},
confirm = {
border = {
style = "single",
text = { top = "" },
},
},
},
})

View file

@ -0,0 +1,9 @@
{
programs.neovim-flake.settings.vim.maps = {
insert = {
# vsnip
#"<C-jn>".action = "<Plug>(vsnip-jump-next)";
#"<C-jp>".action = "<Plug>(vsnip-jump-prev)";
};
};
}

View file

@ -0,0 +1,59 @@
{
programs.neovim-flake.settings.vim.maps = {
normal = {
# General
"<leader>fd".action = ":lua vim.g.formatsave = not vim.g.formatsave<CR>";
"<leader>zt".action = ":<C-U>let g:default_terminal = v:count1<CR>";
"<leader>e".action = ":NvimTreeToggle<CR>";
"<leader>ld".action = ":lua vim.diagnostic.setqflist({open = true})<CR>";
"<leader>lf".action = ":lua vim.lsp.buf.format()<CR>";
"<leader>li".action = ":lua vim.lsp.buf.implementation()<CR>";
# Diffview
"<leader>gdq".action = ":DiffviewClose<CR>";
"<leader>gdd".action = ":DiffviewOpen ";
"<leader>gdm".action = ":DiffviewOpen<CR>";
"<leader>gdh".action = ":DiffviewFileHistory %<CR>";
"<leader>gde".action = ":DiffviewToggleFiles<CR>";
# Git
"<leader>gu".action = "<cmd>Gitsigns undo_stage_hunk<CR>";
"<leader>g<C-w>".action = "<cmd>Gitsigns preview_hunk<CR>";
"<leader>gp".action = "<cmd>Gitsigns prev_hunk<CR>";
"<leader>gn".action = "<cmd>Gitsigns next_hunk<CR>";
"<leader>gP".action = "<cmd>Gitsigns preview_hunk_inline<CR>";
"<leader>gR".action = "<cmd>Gitsigns reset_buffer<CR>";
"<leader>gb".action = "<cmd>Gitsigns blame_line<CR>";
"<leader>gD".action = "<cmd>Gitsigns diffthis HEAD<CR>";
"<leader>gw".action = "<cmd>Gitsigns toggle_word_diff<CR>";
# Telescope
"<M-f>".action = ":Telescope resume<CR>";
"<leader>fq".action = ":Telescope quickfix<CR>";
"<leader>f/".action = ":Telescope live_grep<cr>";
# Aerial
"<S-O>".action = ":AerialToggle<CR>";
# vsnip
#"<C-jn>".action = "<Plug>(vsnip-jump-next)";
#"<C-jp>".action = "<Plug>(vsnip-jump-prev)";
};
normalVisualOp = {
"<leader>gs".action = ":Gitsigns stage_hunk<CR>";
"<leader>gr".action = ":Gitsigns reset_hunk<CR>";
"<leader>lr".action = "<cmd>lua vim.lsp.buf.references()<CR>";
# ssr.nvim
"<leader>sr".action = ":lua require('ssr').open()<CR>";
# Toggleterm
"<leader>ct" = {
# action = ":<C-U>ToggleTermSendVisualLines v:count<CR>";
action = "':ToggleTermSendVisualLines ' . v:count == 0 ? g:default_terminal : v:count";
expr = true;
};
};
};
}

View file

@ -0,0 +1,9 @@
{
programs.neovim-flake.settings.vim.maps = {
select = {
# vsnip
#"<C-jn>".action = "<Plug>(vsnip-jump-next)";
#"<C-jp>".action = "<Plug>(vsnip-jump-prev)";
};
};
}

View file

@ -0,0 +1,7 @@
{
programs.neovim-flake.settings.vim.maps = {
terminal = {
"<M-x>".action = "<cmd>q<CR>";
};
};
}

View file

@ -0,0 +1,141 @@
{
self,
pkgs,
...
}: let
inherit (pkgs.vimPlugins) friendly-snippets aerial-nvim nvim-surround undotree mkdir-nvim ssr-nvim direnv-vim legendary-nvim;
pluginSources = import ./sources {inherit self pkgs;};
in {
programs.neovim-flake.settings.vim.extraPlugins = {
# plugins that are pulled from nixpkgs
direnv = {package = direnv-vim;};
friendly-snippets = {package = friendly-snippets;};
mkdir-nvim = {package = mkdir-nvim;};
aerial = {
package = aerial-nvim;
setup = "require('aerial').setup {}";
};
nvim-surround = {
package = nvim-surround;
setup = "require('nvim-surround').setup {}";
};
undotree = {
package = undotree;
setup = ''
vim.g.undotree_ShortIndicators = true
vim.g.undotree_TreeVertShape = ''
'';
};
ssr-nvim = {
package = ssr-nvim;
setup = "require('ssr').setup {}";
};
legendary = {
package = legendary-nvim;
setup = ''
require('legendary').setup {};
'';
};
# plugins that are built from their sources
regexplainer = {package = pluginSources.regexplainer;};
vim-nftables = {package = pluginSources.vim-nftables;};
data-view = {
package = pluginSources.data-viewer-nvim;
setup = ''
-- open data files in data-viewer.nvim
vim.api.nvim_exec([[
autocmd BufReadPost,BufNewFile *.sqlite,*.csv,*.tsv DataViewer
]], false)
-- keybinds
vim.api.nvim_set_keymap('n', '<leader>dv', ':DataViewer<CR>', {noremap = true})
vim.api.nvim_set_keymap('n', '<leader>dvn', ':DataViewerNextTable<CR>', {noremap = true})
vim.api.nvim_set_keymap('n', '<leader>dvp', ':DataViewerPrevTable<CR>', {noremap = true})
vim.api.nvim_set_keymap('n', '<leader>dvc', ':DataViewerClose<CR>', {noremap = true})
'';
};
slides-nvim = {
package = pluginSources.slides-nvim;
setup = "require('slides').setup {}";
};
hmts = {
package = pluginSources.hmts;
after = ["treesitter"];
};
smart-splits = {
package = pluginSources.smart-splits;
setup = "require('smart-splits').setup {}";
};
neotab-nvim = {
package = pluginSources.neotab-nvim;
setup = ''
require('neotab').setup {
tabkey = "<Tab>",
act_as_tab = true,
behavior = "nested", ---@type ntab.behavior
pairs = { ---@type ntab.pair[]
{ open = "(", close = ")" },
{ open = "[", close = "]" },
{ open = "{", close = "}" },
{ open = "'", close = "'" },
{ open = '"', close = '"' },
{ open = "`", close = "`" },
{ open = "<", close = ">" },
},
exclude = {},
smart_punctuators = {
enabled = false,
semicolon = {
enabled = false,
ft = { "cs", "c", "cpp", "java" },
},
escape = {
enabled = false,
triggers = {}, ---@type table<string, ntab.trigger>
},
},
}
'';
};
specs-nvim = {
package = pluginSources.specs-nvim;
setup = ''
require('specs').setup {
show_jumps = true,
popup = {
delay_ms = 0,
inc_ms = 15,
blend = 15,
width = 10,
winhl = "PMenu",
fader = require('specs').linear_fader,
resizer = require('specs').shrink_resizer
},
ignore_filetypes = {'NvimTree', 'undotree'},
ignore_buftypes = {nofile = true},
}
-- toggle specs using the <C-b> keybind
vim.api.nvim_set_keymap('n', '<C-b>', ':lua require("specs").show_specs()', { noremap = true, silent = true })
-- bind specs to navigation keys
vim.api.nvim_set_keymap('n', 'n', 'n:lua require("specs").show_specs()<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', 'N', 'N:lua require("specs").show_specs()<CR>', { noremap = true, silent = true })
'';
};
};
}

View file

@ -0,0 +1,8 @@
{
programs.neovim-flake.settings.vim = {
assistant.copilot = {
enable = true;
cmp.enable = true;
};
};
}

View file

@ -0,0 +1,16 @@
{
programs.neovim-flake.settings.vim = {
autocomplete = {
enable = true;
type = "nvim-cmp";
mappings = {
# close = "<C-e>";
confirm = "<C-y>";
next = "<C-n>";
previous = "<C-p>";
scrollDocsDown = "<C-j>";
scrollDocsUp = "<C-k>";
};
};
};
}

View file

@ -0,0 +1,5 @@
{
programs.neovim-flake.settings.vim = {
autopairs.enable = true;
};
}

View file

@ -0,0 +1,8 @@
{
programs.neovim-flake.settings.vim = {
binds = {
whichKey.enable = true;
cheatsheet.enable = false;
};
};
}

View file

@ -0,0 +1,5 @@
{
programs.neovim-flake.settings.vim = {
comments.comment-nvim.enable = true;
};
}

View file

@ -0,0 +1,7 @@
{
programs.neovim-flake.settings.vim = {
dashboard = {
alpha.enable = true;
};
};
}

View file

@ -0,0 +1,8 @@
{
programs.neovim-flake.settings.vim = {
debugger.nvim-dap = {
enable = true;
ui.enable = true;
};
};
}

View file

@ -0,0 +1,63 @@
{
programs.neovim-flake.settings.vim = {
filetree = {
nvimTree = {
enable = true;
openOnSetup = true;
disableNetrw = true;
mappings = {
toggle = "<C-w>";
};
setupOpts = {
update_focused_file.enable = true;
hijack_unnamed_buffer_when_opening = true;
hijack_cursor = true;
hijack_directories = {
enable = true;
auto_open = true;
};
git = {
enable = true;
show_on_dirs = false;
timeout = 500;
};
view = {
cursorline = false;
width = 35;
};
renderer = {
indent_markers.enable = true;
root_folder_label = false; # inconsistent
icons = {
modified_placement = "after";
git_placement = "after";
show.git = true;
show.modified = true;
};
};
diagnostics.enable = true;
modified = {
enable = true;
show_on_dirs = false;
show_on_open_dirs = true;
};
actions = {
change_dir.enable = false;
change_dir.global = false;
open_file.window_picker.enable = true;
};
};
};
};
};
}

View file

@ -0,0 +1,5 @@
{
programs.neovim-flake.settings.vim = {
gestures.gesture-nvim.enable = false;
};
}

View file

@ -0,0 +1,11 @@
{
programs.neovim-flake.settings.vim = {
git = {
enable = true;
gitsigns = {
enable = true;
codeActions = false;
};
};
};
}

View file

@ -0,0 +1,58 @@
{
config,
pkgs,
lib,
...
}: {
programs.neovim-flake.settings.vim = {
languages = {
enableLSP = true;
enableFormat = true;
enableTreesitter = true;
enableExtraDiagnostics = true;
markdown.enable = true;
nix.enable = true;
html.enable = true;
css.enable = true;
tailwind.enable = true;
ts.enable = true;
go.enable = true;
python.enable = true;
bash.enable = true;
zig.enable = false;
dart.enable = false;
elixir.enable = false;
svelte.enable = false;
sql.enable = false;
java = let
jdtlsCache = "${config.xdg.cacheHome}/jdtls";
in {
enable = true;
lsp.package = [
"${lib.getExe pkgs.jdt-language-server}"
"-configuration ${jdtlsCache}/config"
"-data ${jdtlsCache}/workspace"
];
};
lua = {
enable = true;
lsp.neodev.enable = true;
};
rust = {
enable = true;
crates.enable = true;
};
clang = {
enable = true;
lsp = {
enable = true;
server = "clangd";
};
};
};
};
}

View file

@ -0,0 +1,15 @@
{
programs.neovim-flake.settings.vim = {
lsp = {
formatOnSave = true;
lspkind.enable = true;
lsplines.enable = true;
lightbulb.enable = true;
lspsaga.enable = false;
lspSignature.enable = true;
nvimCodeActionMenu.enable = true;
trouble.enable = false;
nvim-docs-view.enable = true;
};
};
}

View file

@ -0,0 +1,9 @@
{
programs.neovim-flake.settings.vim = {
minimap = {
# cool for vanity but practically useless on small screens
minimap-vim.enable = false;
codewindow.enable = false;
};
};
}

View file

@ -0,0 +1,9 @@
{
programs.neovim-flake.settings.vim = {
notes = {
todo-comments.enable = true;
mind-nvim.enable = false;
obsidian.enable = false;
};
};
}

View file

@ -0,0 +1,7 @@
{
programs.neovim-flake.settings.vim = {
notify = {
nvim-notify.enable = true;
};
};
}

View file

@ -0,0 +1,5 @@
{
programs.neovim-flake.settings.vim = {
presence.neocord.enable = false;
};
}

View file

@ -0,0 +1,22 @@
{
programs.neovim-flake.settings.vim = {
projects = {
project-nvim = {
enable = true;
setupOpts = {
manualMode = false;
detectionMethods = ["lsp" "pattern"];
patterns = [
".git"
".hg"
"Makefile"
"package.json"
"index.*"
".anchor"
"flake.nix"
];
};
};
};
};
}

View file

@ -0,0 +1,8 @@
{
programs.neovim-flake.settings.vim = {
session.nvim-session-manager = {
enable = false;
setupOpts.autoload_mode = "Disabled"; # misbehaves with dashboard
};
};
}

View file

@ -0,0 +1,10 @@
{
programs.neovim-flake.settings.vim = {
statusline = {
lualine = {
enable = true;
theme = "catppuccin";
};
};
};
}

View file

@ -0,0 +1,7 @@
{
programs.neovim-flake.settings.vim = {
tabline = {
nvimBufferline.enable = true;
};
};
}

View file

@ -0,0 +1,5 @@
{
programs.neovim-flake.settings.vim = {
telescope.enable = true;
};
}

View file

@ -0,0 +1,4 @@
{
programs.neovim-flake.settings.vim = {
};
}

View file

@ -0,0 +1,18 @@
{
programs.neovim-flake.settings.vim = {
terminal = {
toggleterm = {
enable = true;
mappings.open = "<C-t>";
setupOpts = {
direction = "tab";
lazygit = {
enable = true;
direction = "tab";
};
};
};
};
};
}

View file

@ -0,0 +1,10 @@
{
programs.neovim-flake.settings.vim = {
theme = {
enable = true;
name = "catppuccin";
style = "mocha";
transparent = true;
};
};
}

View file

@ -0,0 +1,14 @@
{pkgs, ...}: {
programs.neovim-flake.settings.vim = {
treesitter = {
fold = true;
context.enable = true;
# extra grammars that will be installed by Nix
grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
regex # for regexplainer
kdl # zellij configurations are in KDL, I want syntax highlighting
];
};
};
}

View file

@ -0,0 +1,34 @@
{
programs.neovim-flake.settings.vim = {
ui = {
noice.enable = true;
colorizer.enable = true;
modes-nvim.enable = false;
illuminate.enable = true;
breadcrumbs = {
enable = true;
source = "nvim-navic";
navbuddy.enable = false;
};
smartcolumn = {
enable = true;
setupOpts = {
columnAt.languages = {
markdown = [80];
nix = [150];
ruby = 110;
java = 120;
go = [130];
};
};
};
borders = {
enable = true;
globalStyle = "rounded";
};
};
};
}

View file

@ -0,0 +1,24 @@
{pkgs, ...}: {
programs.neovim-flake.settings.vim = {
utility = {
ccc.enable = true;
icon-picker.enable = true;
diffview-nvim.enable = true;
vim-wakatime = {
enable = true;
cli-package = pkgs.wakatime;
};
motion = {
hop.enable = true;
leap.enable = false;
};
preview = {
glow.enable = true;
markdownPreview.enable = true;
};
};
};
}

View file

@ -0,0 +1,34 @@
{
programs.neovim-flake.settings.vim = {
visuals = {
enable = true;
nvimWebDevicons.enable = true;
scrollBar.enable = true;
smoothScroll.enable = false;
cellularAutomaton.enable = false;
highlight-undo.enable = true;
indentBlankline = {
enable = true;
fillChar = null;
eolChar = null;
scope.enabled = true;
};
cursorline = {
enable = true;
lineTimeout = 0;
};
fidget-nvim = {
enable = true;
setupOpts = {
notification.window = {
winblend = 0;
border = "none";
};
};
};
};
};
}

View file

@ -0,0 +1,87 @@
{
self,
pkgs,
...
}: let
inherit (self) pins;
inherit (pkgs) fetchFromGitHub;
inherit (pkgs.vimUtils) buildVimPlugin;
sources = {
hmts = buildVimPlugin {
name = "hmts.nvim";
src = pins."hmts.nvim";
};
smart-splits = buildVimPlugin {
name = "smart-splits";
src = pins."smart-splits.nvim";
};
slides-nvim = buildVimPlugin {
name = "slides.nvim";
src = pins."slides.nvim";
};
regexplainer = buildVimPlugin {
name = "nvim-regexplainer";
src = fetchFromGitHub {
owner = "bennypowers";
repo = "nvim-regexplainer";
rev = "4250c8f3c1307876384e70eeedde5149249e154f";
hash = "sha256-15DLbKtOgUPq4DcF71jFYu31faDn52k3P1x47GL3+b0=";
};
};
specs-nvim = buildVimPlugin {
name = "specs.nvim";
src = fetchFromGitHub {
owner = "edluffy";
repo = "specs.nvim";
rev = "2743e412bbe21c9d73954c403d01e8de7377890d";
hash = "sha256-mYTzltCEKO8C7BJ3WrB/iFa1Qq1rgJlcjW6NYHPfmPk=";
};
};
deferred-clipboard = buildVimPlugin {
name = "deferred-clipboard";
src = fetchFromGitHub {
owner = "EtiamNullam";
repo = "deferred-clipboard.nvim";
rev = "810a29d166eaa41afc220cc7cd85eeaa3c43b37f";
hash = "sha256-nanNQEtpjv0YKEkkrPmq/5FPxq+Yj/19cs0Gf7YgKjU=";
};
};
data-viewer-nvim = buildVimPlugin {
name = "data-viewer.nvim";
src = fetchFromGitHub {
owner = "VidocqH";
repo = "data-viewer.nvim";
rev = "40ddf37bb7ab6c04ff9e820812d1539afe691668";
hash = "sha256-D5hvLhsYski11H9qiDDL2zlZMtYmbpHgpewiWR6C7rE=";
};
};
vim-nftables = buildVimPlugin {
name = "vim-nftables";
src = fetchFromGitHub {
owner = "awisse";
repo = "vim-nftables";
rev = "bc29309080b4c7e1888ffb1a830846be16e5b8e7";
hash = "sha256-L1x3Hv95t/DBBrLtPBKrqaTbIPor/NhVuEHVIYo/OaA=";
};
};
neotab-nvim = buildVimPlugin {
name = "neotab.nvim";
src = fetchFromGitHub {
owner = "kawre";
repo = "neotab.nvim";
rev = "6c6107dddaa051504e433608f59eca606138269b";
hash = "sha256-bSFKbjj8fJHdfBzYoQ9l3NU0GAYfdfCbESKbwdbLNSw=";
};
};
};
in
sources

View file

@ -0,0 +1,57 @@
{
inputs,
pkgs,
lib,
...
}: let
inherit (builtins) filter map toString;
inherit (lib.filesystem) listFilesRecursive;
inherit (lib.strings) hasSuffix fileContents removeSuffix;
inherit (lib.attrsets) genAttrs;
nvf = inputs.neovim-flake;
in {
config = {
programs.neovim-flake = {
enable = true;
settings = {
vim = {
package = pkgs.neovim-unwrapped;
viAlias = true;
vimAlias = true;
enableEditorconfig = true;
preventJunkFiles = true;
enableLuaLoader = true;
useSystemClipboard = true;
spellChecking.enable = false;
debugMode = {
enable = false;
logFile = "/tmp/nvim.log";
};
luaConfigRC = let
inherit (nvf.lib.nvim.dag) entryAnywhere;
# get the name of each lua file in the lua directory, where setting files reside
configPaths = map (f: removeSuffix ".lua" f) (filter (hasSuffix ".lua") (map toString (listFilesRecursive ./lua)));
# get the path of each file by removing the ./. prefix from each element in the list
configNames = map (p: removeSuffix "./" p) configPaths;
# generates a key-value pair that looks roughly as follows:
# "fileName" = entryAnywhere "<contents of ./lua/fileName.lua>"
# which is expected by neovim-flake's modified DAG library
luaConfig = genAttrs configNames (name:
entryAnywhere ''
${fileContents "${name}.lua"}
'');
in
luaConfig;
};
};
};
};
}

View file

@ -0,0 +1,31 @@
{
config,
pkgs,
lib,
...
}: {
xdg.desktopEntries."Neovim" = lib.mkForce {
name = "Neovim";
type = "Application";
mimeType = ["text/plain"];
icon = builtins.fetchurl {
url = "https://raw.githubusercontent.com/NotAShelf/neovim-flake/main/assets/neovim-flake-logo-work.svg";
sha256 = "19n7n9xafyak35pkn4cww0s5db2cr97yz78w5ppbcp9jvxw6yyz3";
};
exec = let
wezterm = lib.getExe config.programs.wezterm.package;
direnv = lib.getExe pkgs.direnv;
in "${pkgs.writeShellScript "wezterm-neovim" ''
# define target filename
filename="$(readlink -f "$1")"
# get the directory target file is in
dirname="$(dirname "$filename")"
# launch a wezterm instance with direnv and nvim
${wezterm} -e --cwd "$dirname" -- ${lib.getExe pkgs.zsh} -c "${direnv} exec . nvim '$filename'"
''} %f";
};
}

View file

@ -0,0 +1,7 @@
_: {
imports = [
./foot
./kitty
./wezterm
];
}

View file

@ -0,0 +1,75 @@
{
osConfig,
lib,
config,
pkgs,
inputs',
...
}: let
inherit (osConfig.modules.style.colorScheme) slug colors;
inherit (lib) mkIf;
dev = osConfig.modules.device;
acceptedTypes = ["laptop" "desktop" "hybrid" "lite"];
in {
config = mkIf (builtins.elem dev.type acceptedTypes) {
home.packages = with pkgs; [
libsixel # for displaying images
];
programs.foot = {
enable = true;
package = inputs'.nyxpkgs.packages.foot-transparent;
server.enable = true;
settings = {
main = {
# window settings
app-id = "foot";
title = "foot";
locked-title = "no";
term = "xterm-256color";
pad = "16x16 center";
shell = "zsh";
# notifications
notify = "notify-send -a \${app-id} -i \${app-id} \${title} \${body}";
selection-target = "clipboard";
# font and font rendering
dpi-aware = false; # this looks more readable on a laptop, but it's unreasonably large
font = "Iosevka Nerd Font:size=14";
font-bold = "Iosevka Nerd Font:size=14";
vertical-letter-offset = "-0.90";
};
scrollback = {
lines = 10000;
multiplier = 3;
};
tweak = {
font-monospace-warn = "no"; # reduces startup time
sixel = "yes";
};
cursor = {
style = "beam";
beam-thickness = 2;
};
mouse = {
hide-when-typing = "yes";
};
url = {
launch = "xdg-open \${url}";
label-letters = "sadfjklewcmpgh";
osc8-underline = "url-mode";
protocols = "http, https, ftp, ftps, file";
uri-characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.,~:;/?#@!$&%*+=\"'()[]";
};
colors = import ./presets/${slug}/colors.nix {inherit colors;} // {alpha = "0.85";};
};
};
};
}

View file

@ -0,0 +1,22 @@
{colors}: {
foreground = "${colors.base05}"; # Text
background = "${colors.base00}"; # Base
regular0 = "${colors.base03}"; # Surface 1
regular1 = "${colors.base08}"; # red
regular2 = "${colors.base0B}"; # green
regular3 = "${colors.base0A}"; # yellow
regular4 = "${colors.base0D}"; # blue
regular5 = "${colors.base0F}"; # pink
regular6 = "${colors.base0C}"; # teal
regular7 = "${colors.base06}"; # Subtext 0
# Subtext 1 ???
bright0 = "${colors.base04}"; # Surface 2
bright1 = "${colors.base08}"; # red
bright2 = "${colors.base0B}"; # green
bright3 = "${colors.base0A}"; # yellow
bright4 = "${colors.base0D}"; # blue
bright5 = "${colors.base0F}"; # pink
bright6 = "${colors.base0C}"; # teal
bright7 = "${colors.base07}"; # Subtext 0
}

View file

@ -0,0 +1,21 @@
{colors}: {
background = "${colors.base00}";
foreground = "${colors.base06}";
regular0 = "${colors.base01}";
regular1 = "${colors.base0C}";
regular2 = "${colors.base0D}";
regular3 = "${colors.base05}";
regular4 = "${colors.base0B}";
regular5 = "${colors.base0A}";
regular6 = "${colors.base08}";
regular7 = "${colors.base04}";
bright0 = "${colors.base02}";
bright1 = "${colors.base0C}";
bright2 = "${colors.base0D}";
bright3 = "${colors.base05}";
bright4 = "${colors.base0B}";
bright5 = "${colors.base0A}";
bright6 = "${colors.base08}";
bright7 = "${colors.base06}";
}

View file

@ -0,0 +1,57 @@
{
osConfig,
lib,
...
}: let
inherit (lib) mkIf;
inherit (osConfig) modules;
inherit (modules.style.colorScheme) colors;
dev = modules.device;
acceptedTypes = ["laptop" "desktop" "hybrid"];
in {
config = mkIf (builtins.elem dev.type acceptedTypes) {
programs.kitty = {
enable = true;
settings = import ./settings.nix {inherit colors;};
keybindings = {
"ctrl+c" = "copy_or_interrupt";
"ctrl+alt+c" = "copy_to_clipboard";
"ctrl+alt+v" = "paste_from_clipboard";
"ctrl+shift+v" = "paste_from_clipboard";
"ctrl+shift+up" = "increase_font_size";
"ctrl+shift+down" = "decrease_font_size";
"ctrl+shift+backspace" = "restore_font_size";
"ctrl+shift+enter" = "new_window";
"ctrl+shift+n" = "new_os_window";
"ctrl+shift+w" = "close_window";
"ctrl+shift+]" = "next_window";
"ctrl+shift+[" = "previous_window";
"ctrl+shift+f" = "move_window_forward";
"ctrl+shift+b" = "move_window_backward";
"ctrl+shift+`" = "move_window_to_top";
"ctrl+shift+1" = "first_window";
"ctrl+shift+2" = "second_window";
"ctrl+shift+3" = "third_window";
"ctrl+shift+4" = "fourth_window";
"ctrl+shift+5" = "fifth_window";
"ctrl+shift+6" = "sixth_window";
"ctrl+shift+7" = "seventh_window";
"ctrl+shift+8" = "eighth_window";
"ctrl+shift+9" = "ninth_window";
"ctrl+shift+0" = "tenth_window";
"ctrl+shift+right" = "next_tab";
"ctrl+shift+left" = "previous_tab";
"ctrl+shift+t" = "new_tab";
"ctrl+shift+q" = "close_tab";
"ctrl+shift+l" = "next_layout";
"ctrl+shift+." = "move_tab_forward";
"ctrl+shift+," = "move_tab_backward";
"ctrl+shift+alt+t" = "set_tab_title";
};
};
};
}

View file

@ -0,0 +1,63 @@
{colors, ...}: {
# General
background_opacity = "0.85";
font_family = "monospace";
font_size = 14;
disable_ligatures = "never";
cursor_shape = "underline";
cursor_blink_interval = "0.5";
cursor_stop_blinking_after = "15.0";
scrollback_lines = 10000;
click_interval = "0.5";
select_by_word_characters = ":@-./_~?&=%+#";
remember_window_size = false;
allow_remote_control = true;
initial_window_width = 640;
initial_window_height = 400;
repaint_delay = 15;
input_delay = 3;
visual_bell_duration = "0.0";
url_style = "double";
open_url_with = "default";
confirm_os_window_close = 0;
enable_audio_bell = false;
window_padding_width = 15;
window_margin_width = 10;
# Colorscheme
foreground = "#${colors.base05}";
background = "#${colors.base00}";
selection_background = "#${colors.base05}";
selection_foreground = "#${colors.base00}";
url_color = "#${colors.base04}";
cursor = "#${colors.base05}";
active_border_color = "#${colors.base03}";
inactive_border_color = "#${colors.base01}";
active_tab_background = "#${colors.base00}";
active_tab_foreground = "#${colors.base05}";
inactive_tab_background = "#${colors.base01}";
inactive_tab_foreground = "#${colors.base04}";
tab_bar_background = "#${colors.base01}";
color0 = "#${colors.base00}";
color1 = "#${colors.base08}";
color2 = "#${colors.base0B}";
color3 = "#${colors.base0A}";
color4 = "#${colors.base0D}";
color5 = "#${colors.base0E}";
color6 = "#${colors.base0C}";
color7 = "#${colors.base05}";
color8 = "#${colors.base03}";
color9 = "#${colors.base08}";
color10 = "#${colors.base0B}";
color11 = "#${colors.base0A}";
color12 = "#${colors.base0D}";
color13 = "#${colors.base0E}";
color14 = "#${colors.base0C}";
color15 = "#${colors.base07}";
color16 = "#${colors.base09}";
color17 = "#${colors.base0F}";
color18 = "#${colors.base01}";
color19 = "#${colors.base02}";
color20 = "#${colors.base04}";
color21 = "#${colors.base06}";
}

View file

@ -0,0 +1,71 @@
{colors}:
with colors; {
followSystem = {
# basic colors
background = "#${base00}";
foreground = "#${base05}";
cursor_border = "#${base05}";
cursor_bg = "#${base05}";
cursor_fg = "#${base08}";
selection_bg = "#${base0E}";
selection_fg = "#${base00}";
split = "#${base01}";
# base16
ansi = [
"#${base03}"
"#${base08}"
"#${base0B}"
"#${base0A}"
"#${base0D}"
"#${base0F}"
"#${base0C}"
"#${base06}"
];
brights = [
"#${base04}"
"#${base08}"
"#${base0B}"
"#${base0A}"
"#${base0D}"
"#${base0F}"
"#${base0C}"
"#${base07}"
];
# tabbar
tab_bar = {
background = "#${base08}";
active_tab = {
bg_color = "#${base00}";
fg_color = "#${base05}";
};
inactive_tab = {
bg_color = "#${base08}";
fg_color = "#${base05}";
};
inactive_tab_hover = {
bg_color = "#${base00}";
fg_color = "#${base05}";
};
inactive_tab_edge = "#${base00}";
new_tab = {
bg_color = "#${base08}";
fg_color = "#${base07}";
};
new_tab_hover = {
bg_color = "#${base00}";
fg_color = "#${base05}";
};
};
};
}

View file

@ -0,0 +1,77 @@
{
osConfig,
pkgs,
lib,
...
}: let
inherit (lib) mkIf;
inherit (osConfig) modules;
inherit (modules.style.colorScheme) colors;
dev = modules.device;
acceptedTypes = ["laptop" "desktop" "hybrid"];
in {
config = mkIf (builtins.elem dev.type acceptedTypes) {
programs.wezterm = {
enable = true;
package = pkgs.wezterm;
colorSchemes = import ./colorSchemes.nix {inherit colors;};
extraConfig = ''
local wez = require("wezterm")
local act = wezterm.action
local baseConfig = {
-- general
check_for_updates = false, -- nix has updates covered, I don't care about updates
exit_behavior = "CloseOnCleanExit",
enable_scroll_bar = false,
audible_bell = "Disabled", -- annoying
warn_about_missing_glyphs = false,
-- anims
animation_fps = 1,
-- term window settings
adjust_window_size_when_changing_font_size = false,
window_background_opacity = 0.85,
window_padding = { left = 12, right = 12, top = 12, bottom = 12, },
window_close_confirmation = "NeverPrompt",
inactive_pane_hsb = {
saturation = 1.0,
brightness = 0.8
},
-- cursor
default_cursor_style = "SteadyBar",
cursor_blink_rate = 700,
cursor_blink_ease_in = 'Constant',
cursor_blink_ease_out = 'Constant',
-- tab bar
enable_tab_bar = true, -- no observable performance impact
use_fancy_tab_bar = false,
hide_tab_bar_if_only_one_tab = true,
show_tab_index_in_tab_bar = false,
-- font config
font_size = 14.0,
font = wezterm.font_with_fallback {
{ family = "Iosevka Nerd Font", weight = "Regular" },
{ family = "Symbols Nerd Font", weight = "Regular" }
},
-- perf
front_end = "WebGpu",
enable_wayland = true,
scrollback_lines = 10000,
-- colors
-- the followSystem theme is defined in colorSchemes.nix
-- as per my base16 theming options
color_scheme = "followSystem",
}
return baseConfig
'';
};
};
}

View file

@ -0,0 +1,22 @@
{
programs.bash = {
enable = false;
enableCompletion = true;
bashrcExtra = ''
set -o vi
bind -m vi-command 'Control-l: clear-screen'
bind -m vi-insert 'Control-l: clear-screen'
bind 'set show-mode-in-prompt on'
bind 'set vi-cmd-mode-string "n "'
bind 'set vi-ins-mode-string "i "'
# use ctrl-z to toggle in and out of bg
if [[ $- == *i* ]]; then
stty susp undef
bind -m vi-command 'Control-z: fg\015'
bind -m vi-insert 'Control-z: fg\015'
fi
'';
};
}

View file

@ -0,0 +1,115 @@
#!/usr/bin/env bash
# Function to compile and run a single .cpp file
function compile_and_run_file() {
filename="$1"
basename="''${filename%.*}"
echo "Compiling $filename..."
if g++ -o "$basename" "$filename"; then
echo "Running $basename..."
"./$basename"
else
echo "Compilation failed."
fi
}
# Function to prompt user to choose a .cpp file using skim or fzf
function choose_cpp_file() {
directory="$1"
if command -v skim >/dev/null 2>&1; then
file=$(find "$directory" -maxdepth 1 -type f -name "*.cpp" | skim --ansi --query "")
elif command -v fzf >/dev/null 2>&1; then
file=$(find "$directory" -maxdepth 1 -type f -name "*.cpp" | fzf)
else
echo "Error: skim or fzf is required for file selection."
exit 1
fi
if [ -n "$file" ]; then
compile_and_run_file "$file"
else
echo "No .cpp file selected."
fi
}
# Function to prompt user to choose a .cpp file recursively using skim or fzf
function choose_cpp_file_recursive() {
directory="$1"
if command -v skim >/dev/null 2>&1; then
file=$(find "$directory" -type f -name "*.cpp" | sk --ansi --query "")
elif command -v fzf >/dev/null 2>&1; then
file=$(find "$directory" -type f -name "*.cpp" | fzf)
else
echo "Error: skim or fzf is required for file selection."
exit 1
fi
if [ -n "$file" ]; then
compile_and_run_file "$file"
else
echo "No .cpp file selected."
fi
}
# Help menu
function display_help() {
echo "Usage: $0 [options] <file/directory>"
echo "Options:"
echo " --recursive Look for .cpp files recursively"
echo " --help Display this help menu"
echo
echo "Examples:"
echo " $0 ~/Dev/test.cpp"
echo " $0 ~/Dev"
echo " $0 ~/Dev --recursive"
}
# Parse command line arguments
recursive=false
directory=""
# Check if --help is passed
if [[ $1 == "--help" ]]; then
display_help
exit 0
fi
while [[ $# -gt 0 ]]; do
case "$1" in
--recursive)
recursive=true
shift
;;
*)
directory="$1"
shift
;;
esac
done
# Check if directory is provided
if [ -z "$directory" ]; then
echo "Error: No directory specified."
display_help
exit 1
fi
# Check if directory exists
if [ ! -d "$directory" ]; then
echo "Error: Directory does not exist."
display_help
exit 1
fi
# Compile and run or display help menu
if [ -f "$directory" ]; then
compile_and_run_file "$directory"
elif [ "$recursive" = true ]; then
choose_cpp_file_recursive "$directory"
else
choose_cpp_file "$directory"
fi

View file

@ -0,0 +1,94 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib) getExe;
inherit (builtins) readFile;
in {
home = {
# make sure the scripts linked below in the session PATH
# so that they can be referred to by name
sessionPath = ["${config.home.homeDirectory}/.local/bin"];
# link scripts to the local PATH
file = {
".local/bin/preview" = {
# Preview script for fzf tab
source = getExe (pkgs.writeShellApplication {
name = "preview";
runtimeInputs = with pkgs; [fzf eza catimg];
text = readFile ./preview/preview.sh;
});
};
".local/bin/show-zombie-parents" = {
# Show zombie processes and their parents
source = getExe (pkgs.writeShellApplication {
name = "show-zombie-parents";
runtimeInputs = with pkgs; [fzf eza catimg];
text = readFile ./show-zombie-parents/show-zombie-parents.sh;
});
};
".local/bin/tzip" = {
# Find all latest .tmod files recursively in current directory and zip them
# for tmodloader mods downloaded via steam workshop
source = getExe (pkgs.writeShellApplication {
name = "tzip";
runtimeInputs = with pkgs; [zip];
text = readFile ./tzip/tzip.sh;
});
};
".local/bin/extract" = {
# Extract the compressed file with the correct tool based on the extension
source = getExe (pkgs.writeShellApplication {
name = "extract";
runtimeInputs = with pkgs; [zip unzip gnutar p7zip];
text = readFile ./extract/extract.sh;
});
};
".local/bin/compilec" = {
# Interactively find and compile C++ programs
source = getExe (pkgs.writeShellApplication {
name = "compilec";
runtimeInputs = with pkgs; [skim coreutils gcc];
text = readFile ./compilec/compilec.sh;
});
};
".local/bin/fs-diff" = {
# Show diff of two directories
source = getExe (pkgs.writeShellApplication {
name = "fs-diff";
runtimeInputs = with pkgs; [coreutils gnused btrfs-progs];
text = readFile ./fs-diff/fs-diff.sh;
});
};
".local/bin/purge-direnv" = {
# Purge all direnv links
source = getExe (pkgs.writeShellApplication {
name = "purge-direnv";
runtimeInputs = with pkgs; [direnv];
text = readFile ./purge-direnv/purge-direnv.sh;
});
};
".local/bin/addr" = {
# Get external IP address
source = getExe (pkgs.writeShellApplication {
name = "addr";
runtimeInputs = with pkgs; [curl];
text = ''
#!${pkgs.stdenv.shell}
exec curl "$@" icanhazip.com
'';
});
};
};
};
}

View file

@ -0,0 +1,52 @@
#!/usr/bin/env bash
SAVEIFS=$IFS
IFS="$(printf '\n\t')"
function extract {
if [ $# -eq 0 ]; then
# display usage if no parameters given
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz|.zlib|.cso>"
echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
fi
for n in "$@"; do
if [ ! -f "$n" ]; then
echo "'$n' - file doesn't exist"
return 1
fi
case "''${n%,}" in
*.cbt | *.tar.bz2 | *.tar.gz | *.tar.xz | *.tbz2 | *.tgz | *.txz | *.tar)
tar zxvf "$n"
;;
*.lzma) unlzma ./"$n" ;;
*.bz2) bunzip2 ./"$n" ;;
*.cbr | *.rar) unrar x -ad ./"$n" ;;
*.gz) gunzip ./"$n" ;;
*.cbz | *.epub | *.zip) unzip ./"$n" ;;
*.z) uncompress ./"$n" ;;
*.7z | *.apk | *.arj | *.cab | *.cb7 | *.chm | *.deb | *.iso | *.lzh | *.msi | *.pkg | *.rpm | *.udf | *.wim | *.xar | *.vhd)
7z x ./"$n"
;;
*.xz) unxz ./"$n" ;;
*.exe) cabextract ./"$n" ;;
*.cpio) cpio -id <./"$n" ;;
*.cba | *.ace) unace x ./"$n" ;;
*.zpaq) zpaq x ./"$n" ;;
*.arc) arc e ./"$n" ;;
*.cso) ciso 0 ./"$n" ./"$n.iso" &&
extract "$n.iso" && \rm -f "$n" ;;
*.zlib) zlib-flate -uncompress <./"$n" >./"$n.tmp" &&
mv ./"$n.tmp" ./"''${n%.*zlib}" && rm -f "$n" ;;
*.dmg)
hdiutil mount ./"$n" -mountpoint "./$n.mounted"
;;
*)
echo "extract: '$n' - unknown archive method"
return 1
;;
esac
done
}
IFS=$SAVEIFS

View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
OLD_TRANSID=$(sudo btrfs subvolume find-new /mnt/root-blank 9999999)
OLD_TRANSID=${OLD_TRANSID#transid marker was }
sudo btrfs subvolume find-new "/mnt/root" "$OLD_TRANSID" |
sed '$d' |
cut -f17- -d' ' |
sort |
uniq |
while read -r path; do
path="/$path"
if [ -L "$path" ]; then
: # The path is a symbolic link, so is probably handled by NixOS already
elif [ -d "$path" ]; then
: # The path is a directory, ignore
else
echo "$path"
fi
done

View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
case "$1" in
-*) exit 0 ;;
esac
case "$(file --mime-type "$1")" in
*text*)
bat --color always --plain "$1"
;;
*image* | *pdf)
catimg -w 100 -r 2 "$1"
;;
*directory*)
eza --icons -1 --color=always "$1"
;;
*)
echo "unknown file format"
;;
esac

View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
# find all .direnv directories
direnv_dirs=$(fd -I -a --hidden --type directory --glob '.direnv')
# check if any directories were found
if [ -z "$direnv_dirs" ]; then
echo "No .direnv directories found."
exit 0
fi
# print report
echo "The following .direnv directories will be deleted:"
echo "$direnv_dirs"
# confirm deletion
read -p "Are you sure you want to delete these directories? (y/n) " -n 1 -r
# move to a new line
echo -en "\n"
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Delete directories
echo "Deleting directories..."
for dir in $direnv_dirs; do
rm -rf "$dir"
done
echo "Directories deleted."
else
echo "Operation cancelled."
fi

View file

@ -0,0 +1,4 @@
#!/usr/bin/env sh
# https://www.linkedin.com/pulse/how-identify-kill-zombiedefunct-processes-linux-without-george-gabra/
ps -A -ostat,ppid | grep -e '[zZ]' | awk '{ print $2 }' | uniq | xargs ps -p

View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
mkdir -p mods/
# Loop through each subdirectory in the current directory
for subdir in */; do
# Find the most recently accessed file with a .tmod extension in the subdirectory
latest_file=$(find "$subdir" -name "*.tmod" -type f -printf "%T@ %p\n" | sort -n | tail -1 | awk '{print $2}')
# Copy the latest file found (if any) to the mods/ directory
if [[ -n $latest_file ]]; then
cp "$latest_file" "mods/"
echo "Copied $latest_file to mods/"
else
echo "No .tmod files found in $subdir"
fi
done
# Zip up the mods/ directory
zip -r mods.zip mods/
echo -en "Zipped up mods/ directory to mods.zip"

View file

@ -0,0 +1,9 @@
{
imports = [
./bin
./zsh
./starship.nix
./bash.nix
];
}

View file

@ -0,0 +1,103 @@
{
config,
lib,
...
}: let
inherit (builtins) map;
inherit (lib.strings) concatStrings;
in {
home = {
sessionVariables = {
STARSHIP_CACHE = "${config.xdg.cacheHome}/starship";
};
};
programs.starship = let
elemsConcatted = concatStrings (
map (s: "\$${s}") [
"hostname"
"username"
"directory"
"shell"
"nix_shell"
"git_branch"
"git_commit"
"git_state"
"git_status"
"jobs"
"cmd_duration"
]
);
in {
enable = true;
settings = {
scan_timeout = 2;
command_timeout = 2000; # nixpkgs makes starship implode with lower values
add_newline = false;
line_break.disabled = false;
format = "${elemsConcatted}\n$character";
hostname = {
ssh_only = true;
disabled = false;
format = "@[$hostname](bold blue) "; # the whitespace at the end is actually important
};
# configure specific elements
character = {
error_symbol = "[](bold red)";
success_symbol = "[](bold green)";
vicmd_symbol = "[](bold yellow)";
format = "$symbol [|](bold bright-black) ";
};
username = {
format = "[$user]($style) in ";
};
directory = {
truncation_length = 2;
# removes the read_only symbol from the format, it doesn't play nicely with my folder icon
format = "[ ](bold green) [$path]($style) ";
# the following removes tildes from the path, and substitutes some folders with shorter names
substitutions = {
"~/Dev" = "Dev";
"~/Documents" = "Docs";
};
};
# git
git_commit.commit_hash_length = 7;
git_branch.style = "bold purple";
git_status = {
style = "red";
ahead = " ";
behind = " ";
conflicted = " ";
renamed = "»";
deleted = " ";
diverged = " ";
modified = "!";
stashed = "";
staged = "+";
untracked = "?";
};
# language configurations
# the whitespaces at the end *are* necessary for proper formatting
lua.symbol = "[ ](blue) ";
python.symbol = "[ ](blue) ";
rust.symbol = "[ ](red) ";
nix_shell.symbol = "[󱄅 ](blue) ";
golang.symbol = "[󰟓 ](blue)";
c.symbol = "[ ](black)";
nodejs.symbol = "[󰎙 ](yellow)";
package.symbol = "📦 ";
};
};
}

View file

@ -0,0 +1,70 @@
{
pkgs,
lib,
...
}: let
inherit (lib.meta) getExe getExe';
inherit (pkgs) eza bat ripgrep du-dust procs yt-dlp python3 netcat-gnu;
dig = getExe' pkgs.dnsutils "dig";
in {
programs.zsh.shellAliases = {
# make sudo use aliases
sudo = "sudo ";
# easy netcat alias for my fiche host
# https://github.com/solusipse/fiche
fbin = "${getExe netcat-gnu} p.frzn.dev 9999";
# nix specific aliases
cleanup = "sudo nix-collect-garbage --delete-older-than 3d && nix-collect-garbage -d";
bloat = "nix path-info -Sh /run/current-system";
curgen = "sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";
gc-check = "nix-store --gc --print-roots | egrep -v \"^(/nix/var|/run/\w+-system|\{memory|/proc)\"";
repair = "nix-store --verify --check-contents --repair";
run = "nix run";
search = "nix search";
shell = "nix shell";
build = "nix build $@ --builders \"\"";
# quality of life aliases
cat = "${getExe bat} --style=plain";
grep = "${getExe ripgrep}";
du = "${getExe du-dust}";
ps = "${getExe procs}";
mp = "mkdir -p";
fcd = "cd $(find -type d | fzf)";
ls = "${getExe eza} -h --git --icons --color=auto --group-directories-first -s extension";
l = "ls -lF --time-style=long-iso --icons";
ytmp3 = ''
${getExe yt-dlp} -x --continue --add-metadata --embed-thumbnail --audio-format mp3 --audio-quality 0 --metadata-from-title="%(artist)s - %(title)s" --prefer-ffmpeg -o "%(title)s.%(ext)s"
'';
# system aliases
sc = "sudo systemctl";
jc = "sudo journalctl";
scu = "systemctl --user ";
jcu = "journalctl --user";
la = "${getExe eza} -lah --tree";
tree = "${getExe eza} --tree --icons=always";
http = "${getExe python3} -m http.server";
burn = "pkill -9";
diff = "diff --color=auto";
killall = "pkill";
switch-yubikey = "gpg-connect-agent \"scd serialno\" \"learn --force\" /bye";
# insteaed of querying some weird and random"what is my ip" service
# we get our public ip by querying opendns directly.
# <https://unix.stackexchange.com/a/81699>
canihazip = "${dig} @resolver4.opendns.com myip.opendns.com +short";
canihazip4 = "${dig} @resolver4.opendns.com myip.opendns.com +short -4";
canihazip6 = "${dig} @resolver1.ipv6-sandbox.opendns.com AAAA myip.opendns.com +short -6";
# faster navigation
".." = "cd ..";
"..." = "cd ../../";
"...." = "cd ../../../";
"....." = "cd ../../../../";
"......" = "cd ../../../../../";
};
}

View file

@ -0,0 +1,53 @@
{config, ...}: {
imports = [
./aliases.nix
./init.nix
./plugins.nix
];
config = {
programs.zsh = {
enable = true;
dotDir = ".config/zsh";
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
sessionVariables = {LC_ALL = "en_US.UTF-8";};
history = {
# share history between different zsh sessions
share = true;
# avoid cluttering $HOME with the histfile
path = "${config.xdg.dataHome}/zsh/zsh_history";
# saves timestamps to the histfile
extended = true;
# optimize size of the histfile by avoiding duplicates
# or commands we don't need remembered
save = 100000;
size = 100000;
expireDuplicatesFirst = true;
ignoreDups = true;
ignoreSpace = true;
ignorePatterns = ["rm *" "pkill *" "kill *" "killall *"];
};
# dirhashes are easy aliases to commonly used directoryies
# e.g. `cd ~dl` would take you to $HOME/Downloads
dirHashes = {
docs = "$HOME/Documents";
dl = "$HOME/Downloads";
media = "$HOME/Media";
vids = "$HOME/Media/Videos";
music = "$HOME/Media/Music";
pics = "$HOME/Media/Pictures";
screenshots = "$HOME/Media/Pictures/Screenshots";
notes = "$HOME/Cloud/Notes";
dev = "$HOME/Dev";
dots = "$HOME/.config/nyx";
};
};
};
}

View file

@ -0,0 +1,71 @@
{
osConfig,
lib,
...
}: let
inherit (builtins) readFile;
inherit (lib.strings) fileContents;
inherit (osConfig.modules.style.colorScheme) colors;
in {
programs.zsh = {
completionInit = ''
${readFile ./rc/comp.zsh}
${readFile ./rc/fzf.zsh}
# configure fzf tab options
export FZF_DEFAULT_OPTS="
--color gutter:-1
--color bg:-1
--color bg+:-1
--color fg:#${colors.base04}
--color fg+:#${colors.base06}
--color hl:#${colors.base0D}
--color hl+:#${colors.base0D}
--color header:#${colors.base0D}
--color info:#${colors.base0A}
--color marker:#${colors.base0C}
--color pointer:#${colors.base0C}
--color prompt:#${colors.base0A}
--color spinner:#${colors.base0C}
--color preview-bg:#${colors.base01}
--color preview-fg:#${colors.base0D}
--prompt ' '
--pointer ''
--layout=reverse
-m --bind ctrl-space:toggle,pgup:preview-up,pgdn:preview-down
"
'';
initExtra = ''
# avoid duplicated entries in PATH
typeset -U PATH
# try to correct the spelling of commands
setopt correct
# disable C-S/C-Q
setopt noflowcontrol
# disable "no matches found" check
unsetopt nomatch
# my helper functions for setting zsh options that I normally use on my shell
# a description of each option can be found in the Zsh manual
# <https://zsh.sourceforge.io/Doc/Release/Options.html>
# NOTE: this slows down shell startup time considerably
${fileContents ./rc/unset.zsh}
${fileContents ./rc/set.zsh}
# binds, zsh modules and everything else
${fileContents ./rc/binds.zsh}
${fileContents ./rc/modules.zsh}
${fileContents ./rc/misc.zsh}
'';
initExtraFirst = ''
# Do this early so fast-syntax-highlighting can wrap and override this
if autoload history-search-end; then
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
fi
'';
};
}

View file

@ -0,0 +1,35 @@
{pkgs, ...}: let
inherit (pkgs) fetchFromGitHub;
in {
programs.zsh.plugins = [
{
# Must be before plugins that wrap widgets, such as zsh-autosuggestions or fast-syntax-highlighting
name = "fzf-tab";
src = "${pkgs.zsh-fzf-tab}/share/fzf-tab";
}
{
name = "zsh-nix-shell";
src = pkgs.zsh-nix-shell;
file = "share/zsh-nix-shell/nix-shell.plugin.zsh";
}
{
name = "zsh-vi-mode";
src = pkgs.zsh-vi-mode;
file = "share/zsh-vi-mode/zsh-vi-mode.plugin.zsh";
}
{
name = "fast-syntax-highlighting";
src = "${pkgs.zsh-fast-syntax-highlighting}/share/zsh/site-functions";
}
{
name = "zsh-autopair";
file = "zsh-autopair.plugin.zsh";
src = fetchFromGitHub {
owner = "hlissner";
repo = "zsh-autopair";
rev = "2ec3fd3c9b950c01dbffbb2a4d191e1d34b8c58a";
hash = "sha256-Y7fkpvCOC/lC2CHYui+6vOdNO8dNHGrVYTGGNf9qgdg=";
};
}
];
}

View file

@ -0,0 +1,11 @@
# Enable Vi mode
bindkey -v
# Use vim keys in the tab complete menu
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey "^A" vi-beginning-of-line
bindkey "^E" vi-end-of-line

View file

@ -0,0 +1,95 @@
# Completion
# autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
_comp_options+=(globdots)
# Group matches and describe.
zstyle ':completion:*' sort false
zstyle ':completion:complete:*:options' sort false
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'
zstyle ':completion:*' special-dirs true
zstyle ':completion:*' rehash true
# Sort completions
# disable sort when completing `git checkout`
zstyle ':completion:*:git-checkout:*' sort false
# set descriptions format to enable group support
zstyle ':completion:*:descriptions' format '[%d]'
# set list-colors to enable filename colorizing
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# preview directory's content when completing cd
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls -lAhF --group-directories-first --show-control-chars --quoting-style=escape --color=always $realpath'
zstyle ':fzf-tab:complete:cd:*' popup-pad 20 0
zstyle ':completion:*' file-sort modification
zstyle ':completion:*:eza' sort false
zstyle ':completion:files' sort false
# Job IDs
zstyle ':completion:*:jobs' numbers true
zstyle ':completion:*:jobs' verbose true
# Array completion element sorting.
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
# Don't complete unavailable commands.
zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec))'
# No correction
zstyle ':completion:*' completer _oldlist _expand _complete _files _ignored
# Don't insert tabs when there is no completion (e.g. beginning of line)
zstyle ':completion:*' insert-tab false
# allow one error for every three characters typed in approximate completer
zstyle ':completion:*:approximate:' max-errors 'reply=( $((($#PREFIX+$#SUFFIX)/3 )) numeric )'
# start menu completion only if it could find no unambiguous initial string
zstyle ':completion:*:correct:*' insert-unambiguous true
zstyle ':completion:*:corrections' format $'%{\e[0;31m%}%d (errors: %e)%{\e[0m%}'
zstyle ':completion:*:correct:*' original true
# List directory completions first
zstyle ':completion:*' list-dirs-first true
# Offer the original completion when using expanding / approximate completions
zstyle ':completion:*' original true
# Treat multiple slashes as a single / like UNIX does (instead of as /*/)
zstyle ':completion:*' squeeze-slashes true
# insert all expansions for expand completer
# # ???????????????ßß
zstyle ':completion:*:expand:*' tag-order all-expansions
# match uppercase from lowercase
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# separate matches into groups
zstyle ':completion:*:matches' group 'yes'
zstyle ':completion:*' group-name ''
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:options' auto-description '%d'
# describe options in full
zstyle ':completion:*:options' description 'yes'
# on processes completion complete all user processes
zstyle ':completion:*:processes' command 'ps -au$USER'
# provide verbose completion information
zstyle ':completion:*' verbose true
# Ignore completion functions for commands you don't have:
zstyle ':completion::(^approximate*):*:functions' ignored-patterns '_*'
# Provide more processes in completion of programs like killall:
zstyle ':completion:*:processes-names' command 'ps c -u ${USER} -o command | uniq'
# complete manual by their section
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*:manuals.*' insert-sections true
zstyle ':completion:*:man:*' menu yes select
# provide .. as a completion
zstyle ':completion:*' special-dirs ..

View file

@ -0,0 +1,73 @@
autoload -U add-zle-hook-widget
# autosuggests otherwise breaks these widgets.
# <https://github.com/zsh-users/zsh-autosuggestions/issues/619>
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(history-beginning-search-backward-end history-beginning-search-forward-end)
# FZF widgets
function __fzf() {
if [[ -n "$TMUX_PANE" && ( "${FZF_TMUX:-0}" != 0 || -n "$FZF_TMUX_OPTS" ) ]]; then
fzf-tmux -d"${FZF_TMUX_HEIGHT:-40%}" -- "$@"
else
fzf "$@"
fi
}
function __fzf_select() {
setopt localoptions pipefail no_aliases 2>/dev/null
local item
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} --reverse --bind=ctrl-z:ignore,tab:down,btab:up,change:top,ctrl-space:toggle $FZF_DEFAULT_OPTS" __fzf "$@" | while read item; do
echo -n "${(q)item} "
done
local ret=$?
echo
return $ret
}
function __fzf_find_files() {
local include_hidden=${1:-0}
local types=${2:-fdl}
shift 2
local type_selectors=()
local i
for (( i=0; i<${#types}; i++ )); do
[[ "$i" -gt 0 ]] && type_selectors+=('-o')
type_selectors+=('-type' "${types:$i:1}")
done
local hide_hidden_files=()
if [[ $include_hidden == "0" ]]; then
hide_hidden_files=('-path' '*/\.*' '-o')
fi
setopt localoptions pipefail no_aliases 2>/dev/null
command find -L . -mindepth 1 \
\( "${hide_hidden_files[@]}" -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \) -prune \
-o \( "${type_selectors[@]}" \) -print \
| __fzf_select "$@"
}
function __fzf_find_files_widget_helper() {
LBUFFER="${LBUFFER}$(__fzf_find_files "$@")"
local ret=$?
zle reset-prompt
return $ret
}
function fzf-select-file-or-dir() { __fzf_find_files_widget_helper 0 fdl -m; }; zle -N fzf-select-file-or-dir
function fzf-select-file-or-dir-hidden() { __fzf_find_files_widget_helper 1 fdl -m; }; zle -N fzf-select-file-or-dir-hidden
function fzf-select-dir() { __fzf_find_files_widget_helper 0 d -m; }; zle -N fzf-select-dir
function fzf-select-dir-hidden() { __fzf_find_files_widget_helper 1 d -m; }; zle -N fzf-select-dir-hidden
function fzf-cd() {
local dir="$(__fzf_find_files 0 d +m)"
if [[ -z "$dir" ]]; then
zle redisplay
return 0
fi
zle push-line # Clear buffer. Auto-restored on next prompt.
BUFFER="cd -- $dir"
zle accept-line
local ret=$?
unset dir # ensure this doesn't end up appearing in prompt expansion
zle reset-prompt
return $ret
}
zle -N fzf-cd

View file

@ -0,0 +1,22 @@
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty|kitty*)
TERM_TITLE=$'\e]0;%n@%m: %1~\a'
;;
*)
;;
esac
# enable keyword-style arguments in shell functions
set -k
# Colors
autoload -Uz colors && colors
# Autosuggest
ZSH_AUTOSUGGEST_USE_ASYNC="true"
# open commands in $EDITOR
autoload -z edit-command-line
zle -N edit-command-line
bindkey "^e" edit-command-line

View file

@ -0,0 +1,8 @@
# zsh Line Editor (ZLE) module
zmodload zsh/zle
# zsh pseudo-terminal (PTY) module
zmodload zsh/zpty
# zsh completion list (complist) module
zmodload zsh/complist

View file

@ -0,0 +1,31 @@
# Define a function to set Zsh options
function set_zsh_options() {
local options=(
"AUTO_CD" # if not command, then directory
"AUTO_LIST" # list choices on ambiguous completion
"AUTO_MENU" # use menu completion after the second consecutive request for completion
"AUTO_PARAM_SLASH" # if parameter is completed whose content is the name of a directory, then add trailing slash instead of space
"AUTO_PUSHD" # make cd push the old directory onto the directory stack
"APPEND_HISTORY" # append history list to the history file, rather than replace it
"ALWAYS_TO_END" # cursor is moved to the end of the word after completion
"CORRECT" # try to correct the spelling of commands
"EXTENDED_HISTORY" # save each commands beginning timestamp and the duration to the history file
"HIST_FCNTL_LOCK" # use systems fcntl call to lock the history file
"HIST_REDUCE_BLANKS" # remove superfluous blanks
"HIST_SAVE_NO_DUPS" # older commands that duplicate newer ones are omitted
"HIST_VERIFY" # dont execute the line directly; instead perform history expansion and reload the line into the editing buffer
"INC_APPEND_HISTORY" # new history lines are added to the $HISTFILE incrementally (as soon as they are entered)
"INTERACTIVE_COMMENTS" # allow comments even in interactive shells
"MENU_COMPLETE" # insert the first match immediately on ambiguous completion
"NO_NOMATCH" # not explained, probably disables NOMATCH lmao
"PUSHD_IGNORE_DUPS" # dont push multiple copies of the same directory
"PUSHD_TO_HOME" # have pushd with no arguments act like `pushd $HOME`
"PUSHD_SILENT" # do not print the directory stack
)
for option in "${options[@]}"; do
setopt $option
done
}
set_zsh_options

View file

@ -0,0 +1,14 @@
# Define a function to unset Zsh options
function unset_zsh_options() {
local options=(
"CORRECT_ALL" # try to correct the spelling of all arguments in a line.
"HIST_BEEP" # beep in ZLE when a widget attempts to access a history entry which isnt there
"SHARE_HISTORY" # read the documentation for more details
)
for option in "${options[@]}"; do
unsetopt $option
done
}
unset_zsh_options

View file

@ -0,0 +1,25 @@
{pkgs, ...}: let
catppuccin = builtins.readFile (pkgs.fetchurl {
url = "https://raw.githubusercontent.com/catppuccin/bat/main/Catppuccin-mocha.tmTheme";
hash = "sha256-qMQNJGZImmjrqzy7IiEkY5IhvPAMZpq0W6skLLsng/w=";
});
in {
programs.bat = {
enable = true;
themes = {
Catppuccin-mocha = {
src = pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "bat";
rev = "ba4d16880d63e656acced2b7d4e034e4a93f74b1";
sha256 = "sha256-6WVKQErGdaqb++oaXnY3i6/GuH2FhTgK0v4TN4Y0Wbw=";
};
file = "Catppuccin-mocha.tmTheme";
};
};
config = {
theme = "Catppuccin-mocha";
pager = "less -FR"; # frfr
};
};
}

View file

@ -0,0 +1,33 @@
{pkgs, ...}: {
home.packages = with pkgs; [
# replace top and htop with bottom
# if breaks shit? cope.
(writeScriptBin "htop" ''exec btm'')
(writeScriptBin "top" ''exec btm'')
];
programs.bottom = {
enable = true;
settings = {
flags.group_processes = true;
row = [
{
ratio = 2;
child = [
{type = "cpu";}
{type = "mem";}
];
}
{
ratio = 3;
child = [
{
type = "proc";
ratio = 1;
default = true;
}
];
}
];
};
};
}

View file

@ -0,0 +1,29 @@
{
imports = [
./fastfetch
./git
./neomutt
./newsboat
./vifm
./xplr
./yazi
./zellij
./bat.nix
./bottom.nix
./dircolors.nix
./eza.nix
./gh.nix
./gpg.nix
./man.nix
./nix-index.nix
./nix-init.nix
./nix-shell.nix
./ranger.nix
./ssh.nix
./tealdeer.nix
./transient-services.nix
./xdg.nix
./zoxide.nix
];
}

View file

@ -0,0 +1,10 @@
{
programs.dircolors = {
enable = true;
settings = {
OTHER_WRITABLE = "30;46";
".sh" = "01;32";
".csh" = "01;32";
};
};
}

View file

@ -0,0 +1,12 @@
{
programs.eza = {
enable = true;
icons = true;
git = true;
enableZshIntegration = false;
extraOptions = [
"--group-directories-first"
"--header"
];
};
}

View file

@ -0,0 +1,61 @@
{
pkgs,
lib,
...
}: {
config = {
home = {
packages = [pkgs.fastfetch];
};
xdg.configFile."fastfetch/config.jsonc".text = builtins.toJSON {
"$schema" = "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json";
logo = {
source = "nixos_small";
padding = {
left = 1;
right = 3;
};
};
display = {
separator = " ";
keyWidth = 14;
};
modules = [
{
type = "os";
key = " system ";
format = "{3}";
}
{
type = "kernel";
key = " kernel ";
format = "{1} {2} ({4})";
}
{
type = "uptime";
key = " uptime ";
}
{
type = "wm";
key = " wm ";
}
{
type = "command";
key = "󰆧 packages";
text = "(${lib.getExe' pkgs.nix "nix-store"} --query --requisites /run/current-system | wc -l | tr -d '\n') && echo ' (nix; /run/current-system)'";
}
{
type = "memory";
key = "󰍛 memory ";
}
{
type = "disk";
key = "󱥎 storage ";
format = "{1} / {2} ({3})";
folders = "/";
}
];
};
};
}

View file

@ -0,0 +1,16 @@
{pkgs, ...}: {
programs.gh = {
enable = true;
gitCredentialHelper.enable = false;
extensions = with pkgs; [
gh-dash # dashboard with pull requests and issues
gh-eco # explore the ecosystem
gh-cal # contributions calender terminal viewer
gh-poi # clean up local branches safely
];
settings = {
git_protocol = "ssh";
prompt = "enabled";
};
};
}

View file

@ -0,0 +1,23 @@
{
programs.git.aliases = {
br = "branch";
c = "commit -m";
ca = "commit -am";
co = "checkout";
d = "diff";
df = "!git hist | peco | awk '{print $2}' | xargs -I {} git diff {}^ {}";
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`";
fuck = "commit --amend -m";
graph = "log --all --decorate --graph";
ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)";
pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)";
af = "!git add $(git ls-files -m -o --exclude-standard | fzf -m)";
st = "status";
hist = ''
log --pretty=format:"%Cgreen%h %Creset%cd %Cblue[%cn] %Creset%s%C(yellow)%d%C(reset)" --graph --date=relative --decorate --all
'';
llog = ''
log --graph --name-status --pretty=format:"%C(red)%h %C(reset)(%cd) %C(green)%an %Creset%s %C(yellow)%d%Creset" --date=relative
'';
};
}

View file

@ -0,0 +1,111 @@
{
osConfig,
pkgs,
...
}: let
inherit (osConfig) modules;
cfg = modules.system.programs.git;
in {
imports = [
./aliases.nix
./ignore.nix
];
config = {
home.packages = with pkgs; [
gist # manage github gists
act # local github actions
zsh-forgit # zsh plugin to load forgit via `git forgit`
gitflow
];
programs.git = {
enable = true;
package = pkgs.gitAndTools.gitFull;
# my credientals
userName = "NotAShelf";
userEmail = "raf@notashelf.dev";
# lets sign using our own key
# this must be provided by the host
signing = {
key = cfg.signingKey;
signByDefault = true;
};
lfs = {
enable = true;
skipSmudge = true;
};
extraConfig = {
# I don't care about the usage of the term "master"
# but main is easier to type, so that's that
init.defaultBranch = "main";
# disable the horrendous GUI password prompt for Git when auth fails
core.askPass = "";
# prefer using libsecret for storing and retrieving credientals
credential.helper = "${pkgs.gitAndTools.gitFull}/bin/git-credential-libsecret";
# delta is some kind of a syntax highlighting pager for git
# it looks nice but I'd like to consider difftastic at some point
delta = {
enable = true;
line-numbers = true;
features = "decorations side-by-side navigate";
options = {
navigate = true;
line-numbers = true;
side-by-side = true;
dark = true;
};
};
branch.autosetupmerge = "true";
pull.ff = "only";
push = {
default = "current";
followTags = true;
autoSetupRemote = true;
};
merge = {
stat = "true";
conflictstyle = "diff3";
};
core.whitespace = "fix,-indent-with-non-tab,trailing-space,cr-at-eol";
color.ui = "auto";
repack.usedeltabaseoffset = "true";
rebase = {
autoSquash = true;
autoStash = true;
};
rerere = {
autoupdate = true;
enabled = true;
};
url = {
"https://github.com/".insteadOf = "github:";
"ssh://git@github.com/".pushInsteadOf = "github:";
"https://gitlab.com/".insteadOf = "gitlab:";
"ssh://git@gitlab.com/".pushInsteadOf = "gitlab:";
"https://aur.archlinux.org/".insteadOf = "aur:";
"ssh://aur@aur.archlinux.org/".pushInsteadOf = "aur:";
"https://git.sr.ht/".insteadOf = "srht:";
"ssh://git@git.sr.ht/".pushInsteadOf = "srht:";
"https://codeberg.org/".insteadOf = "codeberg:";
"ssh://git@codeberg.org/".pushInsteadOf = "codeberg:";
};
};
};
};
}

View file

@ -0,0 +1,53 @@
{lib, ...}: let
general = ''
.cache/
tmp/
*.tmp
log/
'';
ide = ''
*.swp
.idea/
.~lock*
'';
c = ''
.tags
tags
*~
*.o
*.so
*.cmake
CMakeCache.txt
CMakeFiles/
cmake-build-debug/
compile_commands.json
.ccls*
'';
nix = ''
result
result-*
.direnv/
'';
node = ''
node_modules/
'';
python = ''
venv
.venv
*pyc
*.egg-info/
__pycached__/
.mypy_cache
'';
ignore = lib.concatStringsSep "\n" [general c nix node ide python];
in {
# construct the list of ignored files from a very large string containing
# the list of ignored files, but in a plaintext format for my own convenience
programs.git.ignores = map (v: "${toString v}") (builtins.split "\n" ignore);
}

View file

@ -0,0 +1,81 @@
{
osConfig,
config,
pkgs,
lib,
...
}: let
sys = osConfig.modules.system;
pinentryPkg =
if sys.video.enable
then pkgs.pinentry-gnome3 # requires services.dbus.packages = [ pkgs.gcr ]
else pkgs.pinentry-curses;
in {
services = {
gpg-agent = {
enable = true;
pinentryPackage = pinentryPkg;
enableSshSupport = true;
defaultCacheTtl = 1209600;
defaultCacheTtlSsh = 1209600;
maxCacheTtl = 1209600;
maxCacheTtlSsh = 1209600;
extraConfig = "allow-preset-passphrase";
enableZshIntegration = true;
};
};
# Allow manually restarting gpg-agent in case of failure
systemd.user.services.gpg-agent.Unit.RefuseManualStart = lib.mkForce false;
programs = {
gpg = {
enable = true;
homedir = "${config.xdg.dataHome}/gnupg";
settings = {
keyserver = "keys.openpgp.org";
# https://github.com/drduh/config/blob/master/gpg.conf
# https://www.gnupg.org/documentation/manuals/gnupg/GPG-Configuration-Options.html
# https://www.gnupg.org/documentation/manuals/gnupg/GPG-Esoteric-Options.html
# Use AES256, 192, or 128 as cipher
personal-cipher-preferences = "AES256 AES192 AES";
# Use SHA512, 384, or 256 as digest
personal-digest-preferences = "SHA512 SHA384 SHA256";
# Use ZLIB, BZIP2, ZIP, or no compression
personal-compress-preferences = "ZLIB BZIP2 ZIP Uncompressed";
# Default preferences for new keys
default-preference-list = "SHA512 SHA384 SHA256 AES256 AES192 AES ZLIB BZIP2 ZIP Uncompressed";
# SHA512 as digest to sign keys
cert-digest-algo = "SHA512";
# SHA512 as digest for symmetric ops
s2k-digest-algo = "SHA512";
# AES256 as cipher for symmetric ops
s2k-cipher-algo = "AES256";
# UTF-8 support for compatibility
charset = "utf-8";
# Show Unix timestamps
fixed-list-mode = "";
# No comments in signature
no-comments = "";
# No version in signature
no-emit-version = "";
# Disable banner
no-greeting = "";
# Long hexidecimal key format
keyid-format = "0xlong";
# Display UID validity
list-options = "show-uid-validity";
verify-options = "show-uid-validity";
# Display all keys and their fingerprints
with-fingerprint = "";
# Cross-certify subkeys are present and valid
require-cross-certification = "";
# Disable caching of passphrase for symmetrical ops
no-symkey-cache = "";
# Enable smartcard
use-agent = "";
};
};
};
}

View file

@ -0,0 +1,6 @@
{
programs.man = {
enable = true;
generateCaches = true; # slows down rebuilds
};
}

View file

@ -0,0 +1,53 @@
{
binds = [
{
# Reply to a group or mailing list.
action = "group-reply";
key = "R";
map = [
"index"
"pager"
];
}
{
# Move to the previous box in the sidebar.
action = "sidebar-prev";
key = "\\cK";
map = [
"index"
"pager"
];
}
{
# Move to the next box in the sidebar.
action = "sidebar-next";
key = "\\cJ";
map = [
"index"
"pager"
];
}
{
# Open the current box highlighted in the sidebar.
action = "sidebar-open";
key = "\\cO";
map = [
"index"
"pager"
];
}
{
# View the raw contents of a message.
action = "view-raw-message";
key = "Z";
map = [
"index"
"pager"
];
}
];
}

View file

@ -0,0 +1,77 @@
# vim: filetype=nix
{pkgs, ...}: {
muttColors = pkgs.writeTextFile {
name = "muttColors";
text = ''
# vim: filetype=muttrc
# Header colors:
color header blue default ".*"
color header brightmagenta default "^(From)"
color header brightcyan default "^(Subject)"
color header brightwhite default "^(CC|BCC)"
mono bold bold
mono underline underline
mono indicator reverse
mono error bold
color normal default default
color indicator brightyellow default # currently selected message. default makes bar clear, disabled arrow to save space.
color sidebar_highlight red default
color sidebar_divider brightblack black
color sidebar_flagged red black
color sidebar_new green black
color normal brightyellow default
color error red default
color tilde black default
color message cyan default
color markers red white
color attachment white default
color search brightmagenta default
color status brightyellow black
color hdrdefault brightgreen default
color quoted green default
color quoted1 blue default
color quoted2 cyan default
color quoted3 yellow default
color quoted4 red default
color quoted5 brightred default
color signature brightgreen default
color bold black default
color underline black default
color normal default default
color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses
color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL
color body green default "\`[^\`]*\`" # Green text between ` and `
color body brightblue default "^# \.*" # Headings as bold blue
color body brightcyan default "^## \.*" # Subheadings as bold cyan
color body brightgreen default "^### \.*" # Subsubheadings as bold green
color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow
color body brightcyan default "[;:][-o][)/(|]" # emoticons
color body brightcyan default "[;:][)(|]" # emoticons
color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon?
color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon?
color body red default "(BAD signature)"
color body cyan default "(Good signature)"
color body brightblack default "^gpg: Good signature .*"
color body brightyellow default "^gpg: "
color body brightyellow red "^gpg: BAD signature from.*"
mono body bold "^gpg: Good signature"
mohttps://neomutt.org/code/config_vars.htmlno body bold "^gpg: BAD signature from.*"
color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]"
# Default index colors:
color index yellow default '.*'
color index_author red default '.*'
color index_number blue default
color index_subject cyan default '.*'
# For new mail:
color index brightyellow black "~N"
color index_author brightred black "~N"
color index_subject brightcyan black "~N"
color progress black cyan
'';
};
}

View file

@ -0,0 +1,74 @@
{
config,
lib,
...
}: let
inherit (lib) mapAttrsToList flatten concatStringsSep;
in {
config = {
programs.neomutt = {
enable = true;
vimKeys = true;
checkStatsInterval = 60;
# sidebar
sidebar = {
enable = true;
width = 30;
format = "%D%?F? [%F]?%* %?N?%N/?%S";
};
# sort default view by threads
sort = "threads";
# get keybinds from their respective file
inherit (import ./binds.nix) binds;
# get settings from their respective file
inherit (import ./settings.nix {inherit config;}) settings;
# get macros from their respective file
inherit (import ./macros.nix) macros;
extraConfig = let
# collect all addresses and aliases from accounts.email.accounts attribute of home-manager
accounts = mapAttrsToList (_: value: [value.address] ++ value.aliases) config.accounts.email.accounts;
addresses = flatten accounts;
in ''
# add collected accounts to neomutt config
alternates "${concatStringsSep "|" addresses}"
# mark anything marked by SpamAssassin as probably spam
spam "X-Spam-Score: ([0-9\\.]+).*" "SA: %1"
# only show the basic mail headers
ignore *
unignore From To Cc Bcc Date Subject
# show headers in the following order
unhdr_order *
hdr_order From: To: Cc: Bcc: Date: Subject:
'';
};
xdg = {
desktopEntries = {
neomutt = {
name = "Neomutt";
genericName = "Email Client";
comment = "Read and send emails";
exec = "neomutt %U";
icon = "neomutt";
terminal = true;
categories = ["Network" "Email" "ConsoleOnly"];
type = "Application";
mimeType = ["x-scheme-handler/mailto"];
};
};
mimeApps.defaultApplications = {
"x-scheme-handler/mailto" = "neomutt.desktop";
};
};
};
}

View file

@ -0,0 +1,15 @@
{
macros = [
{
# toggle the sidebar's visibility and refresh/redraw the screen
action = "<enter-command>toggle sidebar_visible<enter><refresh>";
key = "B";
map = ["index"];
}
{
action = "<enter-command>toggle sidebar_visible<enter><redraw-screen>";
key = "B";
map = ["pager"];
}
];
}

View file

@ -0,0 +1,92 @@
{config}: {
settings = {
# if the given mail doesn't have an explicit charset, assume an old
# and Windows-y compatible charset as fallback
assumed_charset = "iso-8859-1";
# use gpgme for cryptography
crypt_use_gpgme = "yes";
# use PKA to find keys via DNS records and possibly check whether an email
# address is controlled by who it says it is
crypt_use_pka = "yes";
# always try to verify signatures
crypt_verify_sig = "yes";
# ask to purge messages marked for delete when closing/syncing a box, with
# the default to do so
delete = "ask-yes";
# when editing outgoing mail, allow editing the headers too
edit_headers = "yes";
# the format to use for subjects when forwarding messages
forward_format = "\"Fwd: %s\"";
# save 10_000 lines of string buffer history per category
history = "10000";
# save history to a file in neomutt's directory
history_file = "${config.xdg.configHome}/neomutt/history";
# when connecting via IMAP, add all subscribed folders from the server
imap_check_subscribed = "yes";
# keep IMAP connections alive with a keepalive every 5 minutes
imap_keepalive = "300";
# use a smaller IMAP pipeline to play nice with servers like GMail
imap_pipeline_depth = "5";
# check for new mail every minute
mail_check = "60";
# the path to the mailcap file
mailcap_path = "${config.home.homeDirectory}/.mailcap";
# use Maildir-style mailboxes
mbox_type = "Maildir";
# scroll menus and such by a single line, rather than a whole page
menu_scroll = "yes";
# show five lines of context when moving between pages in the pager
pager_context = "5";
# the format for the pager status line.
pager_format = "\" %C - %[%H:%M] %.20v, %s%* %?H? [%H] ?\"";
# when in the mail pager, show 10 lines of the index above the current
# message
pager_index_lines = "10";
# don't move to the next message when reaching the bottom of a message
pager_stop = "yes";
# reply to mail using the same address the original was sent to
reverse_name = "yes";
# send all mail as UTF-8
send_charset = "utf-8";
# sort the mailboxes in the sidebar by mailbox path
sidebar_sort_method = "path";
# sort by last message date if messages are in the same thread
sort_aux = "last-date-received";
# separate matching spam headers with this separator
spam_separator = ", ";
# only group messages as a thread by the In-Reply-To or References headers
# rather than matching subject names
strict_threads = "yes";
# search messages against their decoded contents
thorough_search = "yes";
# pad blank lines at the bottom of the screen with tildes
tilde = "yes";
};
}

View file

@ -0,0 +1,83 @@
{
config,
pkgs,
lib,
osConfig,
...
}: let
inherit (lib) mkIf getExe;
mpv = "${getExe pkgs.mpv}";
glow = "${getExe pkgs.glow}";
pandoc = "${getExe pkgs.pandoc}";
dev = osConfig.modules.device;
acceptedTypes = ["laptop" "desktop" "hybrid" "lite"];
in {
config = mkIf (builtins.elem dev.type acceptedTypes) {
programs.newsboat = {
enable = true;
autoReload = true;
inherit ((import ./urls.nix)) urls;
extraConfig = ''
error-log /dev/null
download-full-page yes
download-retries 3
cookie-cache ~/.cache/newsboat/cookies.txt
auto-reload yes
max-items 0
scrolloff 999
reload-threads 100
bind-key j down
bind-key k up
bind-key j next articlelist
bind-key k prev articlelist
bind-key J next-feed articlelist
bind-key K prev-feed articlelist
bind-key G end
bind-key g home
bind-key d pagedown
bind-key u pageup
bind-key l open
bind-key h quit
bind-key a toggle-article-read
bind-key n next-unread
bind-key N prev-unread
bind-key D pb-download
bind-key U show-urls
bind-key x pb-delete
color listnormal color15 default
color listnormal_unread color2 default
color listfocus_unread color2 color0
color listfocus default color0
color background default default
color article default default
color end-of-text-marker color8 default
color info color4 color8
color hint-separator default color8
color hint-description default color8
color title color14 color8
highlight article "^(Feed|Title|Author|Link|Date): .+" color4 default bold
highlight article "^(Feed|Title|Author|Link|Date):" color14 default bold
highlight article "\\((link|image|video)\\)" color8 default
highlight article "https?://[^ ]+" color4 default
highlight article "\[[0-9]+\]" color6 default bold
user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
html-renderer "${pandoc} --from=html -t markdown_github-raw_html"
pager "${glow} --pager --width 72"
# macros
macro v set browser "${mpv} %u" ; open-in-browser ; set browser "firefox %u" -- "Open video on mpv"
macro , open-in-browser
'';
};
};
}

View file

@ -0,0 +1,59 @@
{
urls = [
# Weekly NixOS news and some other stuff
{
title = "NixOS Weekly";
tags = ["news" "twitter"];
url = "https://weekly.nixos.org/feeds/all.rss.xml";
}
# https://hackaday.com/blog/feed/
{
title = "Hacker News";
url = "https://hnrss.org/newest";
tags = ["tech"];
}
{
title = "Hacker News Daily";
url = "https://www.daemonology.net/hn-daily/index.rss";
tags = ["tech"];
}
# Reddit
{
title = "/r/neovim";
url = "https://www.reddit.com/r/neovim/.rss";
tags = ["neovim" "reddit"];
}
{
title = "/r/unixporn";
url = "https://www.reddit.com/r/unixporn/.rss";
tags = ["unix" "ricing" "style"];
}
# Computerphile
{
title = "Computerphile";
url = "https://www.youtube.com/feeds/videos.xml?channel_id=UC9-y-6csu5WGm29I7JiwpnA";
tags = ["tech" "youtube"];
}
# Security news
{
title = "Krebson Security";
url = "https://krebsonsecurity.com/feed/";
tags = ["tech" "security"];
}
# Unsorted
{url = "https://nitter.net/GergelyOrosz/rss";}
{url = "https://feeds.feedburner.com/ThePragmaticEngineer";}
{url = "https://www.reddit.com/r/ExperiencedDevs/.rss";}
{url = "https://news.ycombinator.com/rss";}
{url = "https://programming.dev/feeds/local.xml?sort=Active";}
{url = "https://programming.dev/feeds/c/functional_programming.xml?sort=Active";}
{url = "https://programming.dev/feeds/c/linux.xml?sort=Active";}
{url = "https://programming.dev/feeds/c/experienced_devs.xml?sort=Active";}
{url = "https://programming.dev/feeds/c/nix.xml?sort=Active";}
{url = "https://programming.dev/feeds/c/commandline.xml?sort=Active";}
{url = "https://beehaw.org/feeds/c/technology.xml?sort=Active";}
{url = "https://lobste.rs/rss";}
{url = "https://kiszamolo.hu/feed";}
];
}

View file

@ -0,0 +1,21 @@
{inputs, ...}: {
imports = [inputs.nix-index-db.hmModules.nix-index];
config = {
home.sessionVariables = {
# auto-run programs using nix-index-database
NIX_AUTO_RUN = "1";
};
programs = {
nix-index-database.comma.enable = true;
nix-index = {
enable = true;
# link nix-inde database to ~/.cache/nix-index
symlinkToCacheHome = true;
};
};
};
}

View file

@ -0,0 +1,12 @@
{pkgs, ...}: let
toTOML = name: (pkgs.formats.toml {}).generate "${name}";
in {
config = {
home.packages = [pkgs.nix-init];
xdg.configFile."nix-init/config.toml".source = toTOML "config.toml" {
commit = true;
maintainers = ["NotAShelf"];
};
};
}

View file

@ -0,0 +1,8 @@
{pkgs, ...}: {
home = {
packages = with pkgs; [
alejandra
nix-tree
];
};
}

View file

@ -0,0 +1,24 @@
{
pkgs,
lib,
osConfig,
config,
...
}: let
device = osConfig.modules.device;
# TODO: maybe not have a TUI file manager on desktops, when GUI does it better
acceptedTypes = ["laptop" "desktop" "hybrid" "server" "lite"];
inherit (lib.strings) optionalString;
in {
config = lib.mkIf (builtins.elem device.type acceptedTypes) {
home.packages = with pkgs; [
ranger
];
# TODO: more file preview methods
xdg.configFile."ranger/rc.conf".text = ''
set preview_images true
${(optionalString config.programs.kitty.enable "set preview_images_method kitty")}
'';
};
}

View file

@ -0,0 +1,68 @@
{
programs = {
ssh = {
enable = true;
hashKnownHosts = true;
compression = true;
matchBlocks = let
commonIdFile = "~/.ssh/id_ed25519";
in {
"aur" = {
hostname = "aur.archlinux.org";
identityFile = "~/.ssh/aur";
};
"builder" = {
hostname = "build.neushore.dev";
user = "builder";
identityFile = "~/.ssh/builder";
port = 30;
};
"helios" = {
port = 30;
};
"enyo" = {
port = 30;
};
"hermes" = {
port = 30;
};
"epimetheus" = {
port = 30;
};
"icarus" = {
port = 30;
};
"nix-builder" = {
hostname = "helios";
user = "nix-builder";
identityFile = "~/.ssh/builder";
};
"frozendev" = {
hostname = "frzn.dev";
user = "raf";
identityFile = "~/.ssh/id_rsa";
};
"github" = {
hostname = "github.com";
identityFile = "~/.ssh/github_rsa";
};
"neushore" = {
hostname = "ssh.neushore.dev";
user = "raf";
identityFile = "~/.ssh/neushore";
port = 30;
};
};
};
};
}

Some files were not shown because too many files have changed in this diff Show more