T2MTZSNFFO7KIBSYPAU3I2GWJWELFL4ZJKRI5LHDHPJSL4TL4XWQC
let
utils = [
"keyboardcleantool"
"orbstack"
"vial"
"maccy"
"qbittorrent"
"openvpn-connect"
];
dev = [
"postman"
"sf-symbols"
"iterm2"
"visual-studio-code"
"zed-preview"
"intellij-idea"
"clion"
"rustrover"
"sourcetree-beta"
];
media = [
"vlc"
"spotify"
"obs"
"netnewswire"
];
chat = [
"discord"
"telegram"
"zoom"
"element"
];
browser = [
"firefox"
"tor-browser"
"arc"
];
games = [
"multimc"
"prismlauncher"
];
other = [
# "protonvpn"
];
in
utils ++ dev ++ media ++ chat ++ browser ++ games ++ other
{ ... }:
{
programs.zoxide = {
enable = true;
enableNushellIntegration = true;
enableFishIntegration = true;
};
}
{ pkgs, ... }:
{
home.packages = [ pkgs.pijul ];
xdg.configFile.pijul.text = ''
[author]
name = "WeetHet"
full_name = "WeetHet"
email = "stas.ale66@gmail.com"
'';
}
{ pkgs, ... }:
{
programs.pandoc = {
enable = true;
};
}
{ config, ... }:
{
home.sessionVariables.NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc";
xdg.configFile."npm/npmrc" = {
text = ''
cache=${config.xdg.cacheHome}/npm
init-module=${config.xdg.configHome}/npm/init.js
'';
};
}
{ ... }:
{
programs.git = {
enable = true;
userEmail = "stas.ale66@gmail.com";
userName = "WeetHet";
extraConfig.init.defaultBranch = "main";
delta = {
enable = true;
options = {
side-by-side = true;
line-numbers = true;
};
};
};
}
{ pkgs, ... }:
{
programs.direnv = {
enable = true;
nix-direnv = {
enable = true;
# enableFlakes = true;
};
};
}
{ pkgs, ... }:
{
home.packages = with pkgs; [
sccache
nix-output-monitor
docker
nixfmt-rfc-style
meson
ninja
fh
];
}
{ ... }:
{
imports = [
./cli.nix
./git.nix
./npm.nix
./direnv.nix
# ./pandoc.nix
./pijul.nix
./zoxide.nix
./develop.nix
];
}
{ pkgs, ... }:
{
programs = {
eza = {
enable = true;
icons = true;
enableNushellIntegration = false;
};
starship = {
enable = true;
enableNushellIntegration = true;
enableFishIntegration = true;
};
# `less` with Colemak support
less = {
enable = true;
keys = ''
e forw-line
i back-line
k repeat-search
\ek repeat-search-all
K reverse-search
\eK reverse-search-all
'';
};
};
home.packages = with pkgs; [
darcs
fd
sd
# du-dust
ripgrep
hyperfine
bottom
fzf
darwin.trash
tealdeer
];
}
{ pkgs, config, ... }:
let
xdg_data = config.xdg.dataHome;
xdg_config = config.xdg.configHome;
xdg_cache = config.xdg.cacheHome;
xdg_state = config.xdg.stateHome;
in
rec {
xdg.enable = true;
home = {
sessionVariables = {
EDITOR = "nvim";
GHCUP_USE_XDG_DIRS = "true";
HISTFILE = "${xdg_state}/bash/history";
CABAL_CONFIG = "${xdg_config}/cabal/config";
CABAL_DIR = "${xdg_data}/cabal";
DOCKER_CONFIG = "${xdg_config}/docker";
IPYTHONDIR = "${xdg_config}/ipython";
JUPYTER_CONFIG_DIR = "${xdg_config}/jupyter";
LESSHISTFILE = "${xdg_cache}/less/history";
MPLCONFIGDIR = "${xdg_config}/matplotlib";
TERMINFO = "${xdg_data}/terminfo";
PSQL_HISTORY = "${xdg_data}/psql_history";
BUNDLE_USER_CONFIG = "${xdg_config}/bundle";
BUNDLE_USER_CACHE = "${xdg_cache}/bundle";
BUNDLE_USER_PLUGIN = "${xdg_data}/bundle";
GRADLE_USER_HOME = "${xdg_data}/gradle";
ANDROID_USER_HOME = "${xdg_data}/android";
XDG_CONFIG_HOME = "${xdg_config}";
GOPATH = "${xdg_data}/go";
MINT_PATH = "${xdg_data}/mint";
MINT_LINK_PATH = "${xdg_data}/mint/bin";
};
shellAliases = {
cat = "bat --plain";
fopen = "open (fzf)";
rebuild = "darwin-rebuild switch --flake ~/.config/darwin#weethet";
yarn = "yarn --use-yarnrc ~/.config/yarnrc";
brew = "/opt/homebrew/bin/brew";
mint = "/opt/homebrew/bin/mint";
};
};
programs.nushell = {
enable = true;
environmentVariables = {
EDITOR = "nvim";
CARGO_HOME = "${xdg_data}/cargo";
RUSTUP_HOME = "${xdg_data}/rustup";
};
shellAliases = home.shellAliases;
configFile = {
text = ''
$env.config = {
show_banner: false,
filesize: {
metric: true,
}
table: {
mode: rounded
}
rm: {
always_trash: true # always act as if -t was given. Can be overridden with -p
}
}
'';
};
envFile = {
text = ''
$env.NIX_SSL_CERT_FILE = '/etc/ssl/certs/ca-certificates.crt'
$env.PATH = ($env.PATH
| split row (char esep)
| prepend [
'/etc/profiles/per-user/weethet/bin',
'/nix/var/nix/profiles/default/bin',
'/run/current-system/sw/bin/'
]
| append [
'${xdg_data}/cargo/bin',
]
)
$env.NIX_PROFILES = [
'/nix/var/nix/profiles/default',
'/etc/profiles/per-user/weethet/bin'
]
'';
};
};
programs.fish = {
enable = true;
interactiveShellInit = ''
set fish_greeting
set tmp_paths $fish_user_paths
set -x fish_user_paths
for p in (string split ":" $PATH)
if string match -q '/nix/store/*/bin' $p
set -a fish_user_paths $p
end
end
# for p in (string split ":" $PATH)
# if string match -q '*/.devenv/*/bin' $p
# set -a fish_user_paths $p
# end
# end
for p in (string split " " $NIX_PROFILES)
set -a fish_user_paths $p/bin
end
set -a fish_user_paths $HOME/.local/bin
set -a fish_user_paths $HOME/Library/Python/3.9/bin
set -a fish_user_paths $HOME/.local/share/cargo/bin
set -a fish_user_paths ${xdg_data}/mint/bin
for p in $tmp_paths
if not contains $p $fish_user_paths
set -a fish_user_paths $p
end
end
'';
};
xdg.configFile."fish/themes" = {
source =
pkgs.fetchFromGitHub {
owner = "vitallium";
repo = "tokyonight-fish";
rev = "26a5f1d02ee6bdae1d7793a656d276de1402d315";
sha256 = "M2eP7qLhS+Iw/QaKtyoAFqgVgRIUkaSmoC6xe2mhhcM=";
}
+ "/themes";
};
}
{ pkgs, ... }:
{
launchd = {
enable = true;
agents = {
"com.weethet.capsremap" = {
enable = true;
config = {
RunAtLoad = true;
ProgramArguments = [
"/usr/bin/hidutil"
"property"
"--set"
''
{
"UserKeyMapping": [
{
"HIDKeyboardModifierMappingSrc": 0x700000039,
"HIDKeyboardModifierMappingDst": 0x70000002A
},
]
}''
];
};
};
};
};
}
{ pkgs, ... }:
{
home.packages = with pkgs; [ typst ];
programs.nixvim.plugins.lsp.servers.tinymist = {
enable = true;
rootDir = ''
require 'lspconfig.util'.root_pattern('.git', 'template.typ')
'';
};
}
{ pkgs, ... }:
{
home.packages = with pkgs; [
scala_3
mill
metals
ammonite
];
programs.nixvim.plugins.lsp.servers.metals = {
enable = true;
package = null;
};
}
{
pkgs,
config,
...
}:
let
nightly = true;
extensions = [
"rust-src"
"rust-analyzer"
];
targets = [
"aarch64-apple-darwin"
# "wasm32-wasi"
];
overrideToolchain = t: t.default.override { inherit extensions targets; };
in
{
home.sessionVariables.CARGO_HOME = "${config.xdg.dataHome}/cargo";
home.sessionVariables.RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
home.packages = with pkgs; [
(
if nightly then
(rust-bin.selectLatestNightlyWith overrideToolchain)
else
(overrideToolchain rust.bin.stable.latest)
)
];
programs.nixvim.plugins.lsp.servers.rust-analyzer = {
enable = true;
package = null;
installCargo = false;
installRustc = false;
extraOptions = {
settings = {
rust-analyzer = {
checkOnSave = {
command = "clippy";
};
};
};
};
};
}
{ config, pkgs, ... }:
{
home.sessionVariables.PYTHONSTARTUP = "${config.xdg.configHome}/python/pythonrc";
home.packages = with pkgs; [
uv
rye
ruff
];
xdg.configFile."python/pythonrc".text = ''
#!/usr/bin/env python3
# This entire thing is unnecessary post v3.13.0a3
# https://github.com/python/cpython/issues/73965
def is_vanilla() -> bool:
""" :return: whether running "vanilla" Python """
import sys
return not hasattr(__builtins__, '__IPYTHON__') and 'bpython' not in sys.argv[0]
def setup_history():
""" read and write history from state file """
import os
import atexit
import readline
from pathlib import Path
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
if state_home := os.environ.get('XDG_STATE_HOME'):
state_home = Path(state_home)
else:
state_home = Path.home() / '.local' / 'state'
if not state_home.is_dir():
print("Error: XDG_SATE_HOME does not exist at", state_home)
history: Path = state_home / 'python_history'
# https://github.com/python/cpython/issues/105694
if not history.is_file():
with open(history,"w") as f:
f.write("_HiStOrY_V2_" + "\
\
") # breaks on macos + python3 without this.
readline.read_history_file(history)
atexit.register(readline.write_history_file, history)
if is_vanilla():
setup_history()
'';
}
{ ... }:
{
programs.nixvim.plugins.lsp.servers.lua-ls = {
enable = true;
extraOptions = {
settings = {
Lua = {
runtime = {
version = "LuaJIT";
};
diagnostics = {
globals = [ "vim" ];
};
telemetry = {
enable = false;
};
};
};
};
};
}
{ pkgs, ... }:
{
home.packages = with pkgs; [ bun ];
home.shellAliases = {
bun = "bun --bun";
bunx = "bunx --bun";
};
}
{ pkgs, ... }:
{
home.packages = with pkgs; [
ghc
cabal-install
];
programs.nixvim.plugins.lsp.servers.hls = {
enable = true;
package = null;
extraOptions = {
filetypes = [
"haskell"
"lhaskell"
"cabal"
];
};
};
}
{ pkgs, ... }:
{
home.packages = with pkgs; [
go
delve
gopls
];
programs.nixvim.plugins.lsp.servers.gopls = {
enable = true;
rootDir = ''
require 'lspconfig.util'.root_pattern('.git', 'go.mod', 'go.work')
'';
extraOptions = {
settings = {
gopls = {
analyses = {
unusedparams = true;
};
staticcheck = true;
};
};
};
};
}
{ pkgs, ... }:
{
home.packages = with pkgs; [
gleam
erlang
];
programs.nixvim.plugins.lsp.servers.gleam = {
enable = true;
};
}
{ ... }:
{
imports = [
./lua.nix
./typst.nix
./python.nix
./rust.nix
./scala.nix
# ./go.nix
# ./haskell.nix
# ./gleam.nix
# ./js.nix
];
}
#!/usr/bin/env swift
import Foundation
class ScreenUnlockObserver {
var homeDirectory = FileManager.default.homeDirectoryForCurrentUser
init() {
let dnc = DistributedNotificationCenter.default()
let _ = dnc.addObserver(
forName: NSNotification.Name("com.apple.screenIsUnlocked"),
object: nil, queue: .main
) { _ in self.screenIsUnlocked() }
RunLoop.main.run()
}
func screenIsUnlocked() {
NSLog("Screen Unlocked")
let task = Process()
task.executableURL = URL(filePath: "/usr/bin/env")
task.arguments = ["python3", homeDirectory.appending(components: ".local", "share", "emergency", "emergency_msg_update.py").path()]
task.launch()
task.waitUntilExit()
}
}
let _ = ScreenUnlockObserver()
from telethon import TelegramClient, functions
from datetime import datetime, timedelta
import pathlib
config_path = pathlib.Path.home() / '.config' / 'emergency_fixup'
try:
with open(config_path / 'api', 'r') as f:
api_id = int(f.readline().strip())
api_hash = f.readline().strip()
emergency_chat = int(f.readline().strip())
except FileNotFoundError:
print(f'File not found: {config_path / "api"}')
exit(1)
client = TelegramClient(str(config_path / 'emergency.session'), api_id, api_hash)
async def main():
while True:
print("Trying to update emergency message...")
try:
chat = await client.get_input_entity(emergency_chat)
scheduled = await client(functions.messages.GetScheduledHistoryRequest(peer=chat, hash=0))
messages = scheduled.messages # type: ignore
for message in messages:
if message.message == "Test message":
print("Found test message, removing...")
await client(functions.messages.DeleteScheduledMessagesRequest(
peer=chat,
id=[message.id]
))
await client.send_message(chat, "Test message", schedule=datetime.utcnow() + timedelta(minutes=5))
break
except ValueError:
print('ValueError, retrying...')
await client.get_dialogs()
with client:
client.loop.run_until_complete(main())
{ ... }:
{
xdg.dataFile."emergency".source = ./scripts;
}
{ pkgs, ... }:
{
programs.vscode = {
enable = true;
package = (
pkgs.stdenvNoCC.mkDerivation {
pname = "vscode";
version = pkgs.vscode.version;
dontUnpack = true;
meta.mainProgram = "code";
installPhase = ''
mkdir -p $out/bin
touch $out/bin/code
chmod +x $out/bin/code
'';
}
);
enableUpdateCheck = false;
userSettings = {
"editor.fontFamily" = "FiraCode Nerd Font";
"editor.fontSize" = 14;
"editor.fontLigatures" = true;
"git.autofetch" = true;
"editor.minimap.renderCharacters" = false;
"editor.renderLineHighlight" = "gutter";
"files.associations" = {
".clangd" = "yaml";
};
"files.autoSave" = "onFocusChange";
"workbench.startupEditor" = "none";
"window.restoreFullscreen" = true;
"editor.smoothScrolling" = true;
"extensions.ignoreRecommendations" = true;
"jupyter.runStartupCommands" = [
"%load_ext autoreload"
"%autoreload 2"
];
"notebook.lineNumbers" = "on";
"editor.unicodeHighlight.nonBasicASCII" = false;
"editor.unicodeHighlight.ambiguousCharacters" = false;
"window.titleBarStyle" = "custom";
"debug.onTaskErrors" = "abort";
"explorer.confirmDelete" = false;
"[python]" = {
"editor.formatOnType" = true;
"editor.defaultFormatter" = "ms-python.black-formatter";
};
"terminal.integrated.fontSize" = 13;
"terminal.integrated.enableMultiLinePasteWarning" = "never";
"editor.inlayHints.enabled" = "offUnlessPressed";
};
extensions = with pkgs.vscode-extensions; [
llvm-vs-code-extensions.vscode-clangd
github.copilot
github.copilot-chat
github.github-vscode-theme
golang.go
haskell.haskell
nvarner.typst-lsp
mgt19937.typst-preview
(pkgs.vscode-utils.buildVscodeMarketplaceExtension {
mktplcRef = {
publisher = "OrangeX4";
name = "vscode-typst-sympy-calculator";
version = "0.5.1";
sha256 = "sha256-/IfqMkyWxqH5NfOB5zKV3O8XUjnP30bOi86BnA4Ygi8=";
};
})
ms-python.python
ms-python.black-formatter
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-toolsai.vscode-jupyter-slideshow
ms-toolsai.vscode-jupyter-cell-tags
ms-toolsai.jupyter-renderers
ms-toolsai.jupyter-keymap
tamasfe.even-better-toml
# vadimcn.vscode-lldb
ziglang.vscode-zig
];
};
}
{
enable = true;
ensureInstalled = [
"c"
"cpp"
"meson"
"cmake"
"rust"
"toml"
"haskell"
"yaml"
"lua"
"vim"
"vimdoc"
"query"
"typst"
];
incrementalSelection = {
enable = true;
};
indent = true;
folding = true;
}
let
status = [
"Alternate"
"Current"
"Inactive"
"Visible"
];
part = [
"ADDED"
"CHANGED"
"DELETED"
"ERROR"
"HINT"
"Icon"
"Index"
"INFO"
"Mod"
"Number"
"Sign"
"SignRight"
"Target"
"WARN"
];
groups_left = [
"BufferTabpageFill"
"BufferTabpages"
"TabLine"
"TabLineSel"
"TabLineFill"
"NormalFloat"
"FloatBorder"
];
# "Buffer" + status + part
buffer_status = builtins.foldl' (acc: elem: acc ++ elem) [ ] (
builtins.map (status: builtins.map (part: "Buffer" + status + part) part) status
);
in
{
enable = true;
settings.extra_groups = groups_left ++ buffer_status;
}
{
enable = true;
keymaps = {
"<leader>fb" = {
action = "buffers";
options.desc = "Telescope list buffers";
};
"<leader>ff" = {
action = "find_files";
options.desc = "Telescope find files";
};
"<leader>fg" = {
action = "live_grep";
options.desc = "Telescope live grep";
};
"<leader>fh" = {
action = "oldfiles";
options.desc = "Telescope oldfiles";
};
};
}
{
enable = true;
theme = "edge";
sections = {
lualine_a = [ "mode" ];
lualine_b = [
"branch"
"diff"
"diagnostics"
];
lualine_c = [ "filename" ];
lualine_x = [
"encoding"
"filetype"
];
lualine_y = [ "progress" ];
lualine_z = [ "location" ];
};
}
{
enable = true;
preConfig = ''
vim.diagnostic.config({
virtual_text = false,
severity_sort = true,
float = {
border = 'rounded',
source = 'always',
},
})
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover,
{border = 'rounded'}
)
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signature_help,
{border = 'rounded'}
)
'';
servers = {
sourcekit.enable = true;
pyright.enable = true;
html.enable = true;
nil_ls.enable = true;
};
keymaps = {
diagnostic = {
"<leader>e" = "open_float";
"[" = "goto_prev";
"]" = "goto_next";
"<leader>do" = "setloclist";
};
lspBuf = {
"gD" = "declaration";
"gd" = "definition";
"<leader>k" = "hover";
"gi" = "implementation";
"<C-k>" = "signature_help";
"<leader>wa" = "add_workspace_folder";
"<leader>wr" = "remove_workspace_folder";
"<leader>wl" = "list_workspace_folders";
"<leader>D" = "type_definition";
"<leader>rn" = "rename";
"<leader>ca" = "code_action";
"<leader>cf" = "format";
"<leader>gr" = "references";
};
};
postConfig = ''
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
'';
}
{
enable = true;
panel.layout.position = "right";
suggestion = {
autoTrigger = true;
keymap = {
next = "<M-n>";
prev = "<M-o>";
dismiss = "<C-x>";
};
};
filetypes = {
yaml = false;
markdown = false;
help = false;
gitcommit = false;
gitrebase = false;
hgcommit = false;
svn = false;
cvs = false;
};
}
let
selectOpts = "{behavior = cmp.SelectBehavior.Select}";
in
{
enable = true;
settings = {
autoEnableSources = true;
performance = {
debounce = 150;
};
sources = [
{ name = "path"; }
{
name = "nvim_lsp";
keywordLength = 1;
}
{
name = "buffer";
keywordLength = 3;
}
];
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
formatting = {
fields = [
"menu"
"abbr"
"kind"
];
format = ''
function(entry, item)
local menu_icon = {
nvim_lsp = '[LSP]',
luasnip = '[SNIP]',
buffer = '[BUF]',
path = '[PATH]',
}
item.menu = menu_icon[entry.source.name]
return item
end
'';
};
window = {
completion = {
border = "rounded";
winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None";
zindex = 1001;
scrolloff = 0;
colOffset = 0;
sidePadding = 1;
scrollbar = true;
};
documentation = {
border = "rounded";
winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None";
zindex = 1001;
maxHeight = 20;
};
};
};
settings.mapping = {
"<Up>" = "cmp.mapping.select_prev_item(${selectOpts})";
"<Down>" = "cmp.mapping.select_next_item(${selectOpts})";
"<C-p>" = "cmp.mapping.select_prev_item(${selectOpts})";
"<C-n>" = "cmp.mapping.select_next_item(${selectOpts})";
"<C-u>" = "cmp.mapping.scroll_docs(-4)";
"<C-d>" = "cmp.mapping.scroll_docs(4)";
"<C-e>" = "cmp.mapping.abort()";
"<C-y>" = "cmp.mapping.confirm({select = true})";
"<CR>" = "cmp.mapping.confirm({select = false})";
"<C-f>" = ''
cmp.mapping(
function(fallback)
if luasnip.jumpable(1) then
luasnip.jump(1)
else
fallback()
end
end,
{ "i", "s" }
)
'';
"<C-b>" = ''
cmp.mapping(
function(fallback)
if luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end,
{ "i", "s" }
)
'';
"<Tab>" = ''
cmp.mapping(
function(fallback)
local col = vim.fn.col('.') - 1
if cmp.visible() then
cmp.select_next_item(select_opts)
elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
fallback()
else
cmp.complete()
end
end,
{ "i", "s" }
)
'';
"<S-Tab>" = ''
cmp.mapping(
function(fallback)
if cmp.visible() then
cmp.select_prev_item(select_opts)
else
fallback()
end
end,
{ "i", "s" }
)
'';
};
}
{
enable = true;
keymaps =
{
next = "<Tab>";
previous = "<S-Tab>";
close = "<leader>ct";
pin = "<leader>cp";
moveNext = "<leader>co";
movePrevious = "<leader>cn";
}
// (builtins.listToAttrs (
builtins.map
(num: {
name = "goTo" + builtins.toString num;
value = "<leader>t" + builtins.toString num;
})
[
1
2
3
4
5
6
7
8
9
]
));
}
# TODO: Move rules out of lua file when the nixvim allows it
{ enable = true; }
{
enable = true;
theme = "dashboard";
}
{
tabstop = 4;
shiftwidth = 4;
softtabstop = 4;
expandtab = true;
number = true;
numberwidth = 2;
termguicolors = true;
foldmethod = "expr";
foldexpr = "nvim_treesitter#foldexpr()";
foldlevelstart = 99;
}
let
normalVisual =
builtins.map
(x: {
mode = [
"n"
"v"
];
key = x.key;
action = x.action;
options.desc = x.desc;
})
[
{
key = "n";
action = "h";
desc = "left";
}
{
key = "e";
action = "j";
desc = "down";
}
{
key = "i";
action = "k";
desc = "up";
}
{
key = "o";
action = "l";
desc = "right";
}
{
key = "I";
action = "K";
desc = "docs";
}
{
key = "l";
action = "^";
desc = "start of line";
}
{
key = "L";
action = "$";
desc = "end of line";
}
{
key = "N";
action = "H";
desc = "first (n-th) line";
}
{
key = "O";
action = "L";
desc = "last (n-th) line";
}
{
key = "<leader>p";
action = "\"+p";
desc = "paste from clipboard";
}
{
key = "<leader>y";
action = "\"+y";
desc = "yank to clipboard";
}
{
key = "<leader>d";
action = "\"+d";
desc = "delete to clipboard";
}
{
key = "f";
action = "e";
desc = "forward to end of word";
}
{
key = "F";
action = "E";
desc = "forward to end of WORD";
}
{
key = "m";
action = "f";
desc = "move to next character";
}
{
key = "M";
action = "F";
desc = "move to previous character";
}
{
key = "E";
action = "";
desc = "disabled";
}
];
visual =
builtins.map
(x: {
mode = [ "v" ];
key = x.key;
action = x.action;
options.desc = x.desc;
})
[
{
key = "h";
action = "";
desc = "disabled";
}
{
key = "j";
action = "";
desc = "disabled";
}
{
key = "k";
action = "i";
desc = "inside but k";
}
];
normal =
builtins.map
(x: {
mode = [ "n" ];
key = x.key;
action = x.action;
options.desc = x.desc;
})
[
{
key = "<ESC>";
action = "<cmd> noh <CR>";
desc = "clear search highlight";
}
{
key = "j";
action = "n";
desc = "next word search";
}
{
key = "J";
action = "N";
desc = "prev word search";
}
{
key = "k";
action = "i";
desc = "insert mode";
}
{
key = "h";
action = "o";
desc = "line before + insert";
}
{
key = "H";
action = "O";
desc = "line after + insert";
}
{
key = "<leader>h";
action = "<cmd> Alpha <CR>";
desc = "toggle case";
}
{
key = "<leader>qq";
action = "<cmd> qa <CR>";
desc = "quit all";
}
{
key = "<leader>q!";
action = "<cmd> q! <CR>";
desc = "quit without saving";
}
{
key = "<leader>wq";
action = "<cmd> wq <CR>";
desc = "write and quit";
}
{
key = "gch";
action = "gco";
desc = "Comment.nvim";
}
{
key = "gcH";
action = "gcO";
desc = "Comment.nvim";
}
{
key = "gcn";
action = "gch";
desc = "Comment.nvim";
}
{
key = "gcN";
action = "gcH";
desc = "Comment.nvim";
}
{
key = "gce";
action = "gcj";
desc = "Comment.nvim";
}
{
key = "gci";
action = "gck";
desc = "Comment.nvim";
}
{
key = "<C-w>n";
action = "<C-w>h";
desc = "move to left window";
}
{
key = "<C-w>e";
action = "<C-w>j";
desc = "move to down window";
}
{
key = "<C-w>i";
action = "<C-w>k";
desc = "move to up window";
}
{
key = "<C-w>o";
action = "<C-w>l";
desc = "move to right window";
}
{
key = "<C-w>w";
action = "<C-w>n";
desc = "move to next window";
}
];
in
normalVisual ++ visual ++ normal
{
edge_style = "neon";
# edge_better_performance = 1;
mapleader = " ";
}
{ pkgs, ... }:
pkgs.vimUtils.buildVimPlugin {
name = "typst-preview.nvim";
src = pkgs.fetchFromGitHub {
owner = "chomosuke";
repo = "typst-preview.nvim";
rev = "b0fed1d42733143bc8a0734a718c6944e606607b";
hash = "sha256-MAS3+4JDs0kgXxRvlLsbCtgRN0WSvxPwbtMVHdAsYlc=";
};
}
{ pkgs, ... }:
pkgs.vimUtils.buildVimPlugin {
name = "edge";
src = pkgs.fetchFromGitHub {
owner = "sainnhe";
repo = "edge";
rev = "7506891a93dd0954d59b556ae5bb4c85403150ed";
hash = "sha256-46p8Xnc6rLL5JIFPw6meiLOLZHNGVSccrPBt0Pn/SIg=";
};
}
local wos = {
wrap = true,
linebreak = true,
list = false
}
for wo, val in pairs(wos) do
vim.wo[wo] = val
end
vim.filetype.add { extension = { typ = 'typst' } }
require("nvim-autopairs").add_rules {
require('nvim-autopairs.rule')('$', '$', { 'typst' }),
}
require('typst-preview').setup {
open_cmd = "open -a 'Google Chrome' %s",
}
require('guess-indent').setup {
auto_cmd = true,
}
local status_ok, alpha = pcall(require, "alpha")
if not status_ok then
return
end
local function footer()
local datetime = os.date(" %m-%d-%Y %H:%M:%S")
local version = vim.version()
local nvim_version_info = " v" .. version.major .. "." .. version.minor .. "." .. version.patch
return datetime .. " Running NixVim " .. nvim_version_info
end
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
[[ ███╗ ██╗ ███████╗ ██████╗ ██╗ ██╗ ██╗ ███╗ ███╗]],
[[ ████╗ ██║ ██╔════╝██╔═══██╗ ██║ ██║ ██║ ████╗ ████║]],
[[ ██╔██╗ ██║ █████╗ ██║ ██║ ██║ ██║ ██║ ██╔████╔██║]],
[[ ██║╚██╗██║ ██╔══╝ ██║ ██║ ╚██╗ ██╔╝ ██║ ██║╚██╔╝██║]],
[[ ██║ ╚████║ ███████╗╚██████╔╝ ╚████╔╝ ██║ ██║ ╚═╝ ██║]],
[[ ╚═╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝]],
}
dashboard.section.buttons.val = {
dashboard.button("<leader> e n", " New File", ":ene <CR>"),
dashboard.button("<leader> f h", " Recently Files", ":Telescope oldfiles <CR>"),
dashboard.button("<leader> f t", " Find Text", ":Telescope live_grep <CR>"),
dashboard.button("<leader> c", " X Quit Neovim", ":qa<CR>"),
}
dashboard.section.footer.val = footer()
dashboard.opts.opts.noautocmd = true
{ pkgs, ... }:
{
programs.nixvim = {
enable = true;
opts = import ./opts.nix;
globals = import ./globals.nix;
plugins = {
treesitter = import ./setup/treesitter.nix;
telescope = import ./setup/telescope.nix;
alpha = import ./setup/alpha.nix;
barbar = import ./setup/barbar.nix;
nvim-autopairs = import ./setup/autopairs.nix;
copilot-lua = import ./setup/copilot.nix;
lualine = import ./setup/lualine.nix;
transparent = import ./setup/transparent.nix;
luasnip.enable = true;
cmp-nvim-lsp.enable = true;
lsp = import ./setup/lsp.nix;
cmp = import ./setup/cmp.nix;
indent-blankline.enable = true;
surround.enable = true;
which-key.enable = true;
comment.enable = true;
fidget.enable = true;
fidget.notification.window.winblend = 0;
};
keymaps = import ./keymaps.nix;
extraPlugins = [
(import ./extraPlugins/edge.nix { inherit pkgs; })
(import ./extraPlugins/typst-preview.nix { inherit pkgs; })
pkgs.vimPlugins.guess-indent-nvim
];
colorscheme = "edge";
extraConfigLua =
(builtins.readFile ./extraLua/alpha_theme.lua)
+ (builtins.readFile ./extraLua/wos.lua)
+ (builtins.readFile ./extraLua/typst.lua)
+ (builtins.readFile ./extraLua/guess-indent.lua)
+ (builtins.readFile ./extraLua/typst-preview.lua);
# + "require('transparent').clear_prefix('lualine')";
};
}
"type" = "yellow"
"constant" = "purple" # TODO
"constant.numeric" = "green"
"constant.character.escape" = "cyan"
"string" = "green"
"string.regexp" = "orange"
"comment" = "grey"
"variable" = "fg"
"variable.builtin" = "orange"
"variable.parameter" = "fg"
"variable.other.member" = "fg"
"label" = "orange"
"punctuation" = "grey"
"punctuation.delimiter" = "grey"
"punctuation.bracket" = "fg"
"keyword" = "purple"
"keyword.directive" = "cyan"
"operator" = "red"
"function" = "blue"
"function.builtin" = "blue"
"function.macro" = "cyan"
"tag" = "yellow"
"namespace" = "red"
"attribute" = "cyan"
"constructor" = "yellow"
"module" = "red"
"special" = "orange"
"markup.heading.marker" = "grey"
"markup.heading.1" = { fg = "purple", modifiers = ["bold"] }
"markup.heading.2" = { fg = "red", modifiers = ["bold"] }
"markup.heading.3" = { fg = "blue", modifiers = ["bold"] }
"markup.heading.4" = { fg = "yellow", modifiers = ["bold"] }
"markup.heading.5" = { fg = "green", modifiers = ["bold"] }
"markup.heading.6" = { fg = "fg", modifiers = ["bold"] }
"markup.list" = "red"
"markup.bold" = { modifiers = ["bold"] }
"markup.italic" = { modifiers = ["italic"] }
"markup.link.url" = { fg = "green", modifiers = ["underlined"] }
"markup.link.text" = "purple"
"markup.quote" = "grey"
"markup.raw" = "green"
"diff.plus" = "green"
"diff.delta" = "orange"
"diff.minus" = "red"
"ui.background" = { bg = "bg0" }
"ui.background.separator" = "grey"
"ui.cursor" = { fg = "bg0", bg = "fg" }
"ui.cursor.match" = { fg = "orange", bg = "diff_yellow" }
"ui.cursor.insert" = { fg = "black", bg = "grey" }
"ui.cursor.select" = { fg = "bg0", bg = "blue" }
"ui.cursorline.primary" = { bg = "bg1" }
"ui.cursorline.secondary" = { bg = "bg1" }
"ui.selection" = { bg = "bg4" }
"ui.linenr" = "grey"
"ui.linenr.selected" = "fg"
"ui.statusline" = { fg = "fg", bg = "bg3" }
"ui.statusline.inactive" = { fg = "grey", bg = "bg1" }
"ui.statusline.normal" = { fg = "bg0", bg = "fg", modifiers = ["bold"] }
"ui.statusline.insert" = { fg = "bg0", bg = "purple", modifiers = ["bold"] }
"ui.statusline.select" = { fg = "bg0", bg = "blue", modifiers = ["bold"] }
"ui.bufferline" = { fg = "grey", bg = "bg1" }
"ui.bufferline.active" = { fg = "fg", bg = "bg4", modifiers = ["bold"] }
"ui.popup" = { fg = "grey", bg = "bg2" }
"ui.window" = { fg = "grey", bg = "bg0" }
"ui.help" = { fg = "fg", bg = "bg2" }
"ui.text" = "fg"
"ui.text.focus" = "green"
"ui.menu" = { fg = "fg", bg = "bg3" }
"ui.menu.selected" = { fg = "bg0", bg = "blue" }
"ui.virtual.whitespace" = { fg = "bg4" }
"ui.virtual.indent-guide" = { fg = "bg4" }
"ui.virtual.ruler" = { bg = "bg2" }
"hint" = "blue"
"info" = "green"
"warning" = "yellow"
"error" = "red"
"diagnostic" = { underline = { style = "line" } }
"diagnostic.hint" = { underline = { color = "blue", style = "dotted" } }
"diagnostic.info" = { underline = { color = "green", style = "dotted" } }
"diagnostic.warning" = { underline = { color = "yellow", style = "curl" } }
"diagnostic.error" = { underline = { color = "red", style = "curl" } }
[palette]
black = "#202023"
bg0 = "#2b2d3a"
bg1 = "#333648"
bg2 = "#363a4e"
bg3 = "#393e53"
bg4 = "#3f445b"
bg_grey = "#7a819d"
bg_red = "#ec7279"
diff_red = "#55393d"
bg_green = "#a0c980"
diff_green = "#394634"
bg_blue = "#6cb6eb"
diff_blue = "#354157"
bg_purple = "#d38aea"
diff_yellow = "#4e432f"
fg = "#c5cdd9"
red = "#ec7279"
orange = "#e59b77" # added for compatibility with `sonokai` scheme
yellow = "#deb974"
green = "#a0c980"
cyan = "#5dbbc1"
blue = "#6cb6eb"
purple = "#d38aea"
grey = "#7e8294"
grey_dim = "#5c6071"
{ ... }:
let
normalz = {
e = "scroll_down";
i = "scroll_up";
j = "search_next";
J = "search_prev";
k = "no_op";
n = "no_op";
N = "no_op";
};
normalcw = {
n = "jump_view_left";
C-n = "jump_view_left";
e = "jump_view_down";
C-e = "jump_view_down";
i = "jump_view_up";
C-i = "jump_view_up";
o = "jump_view_right";
C-o = "jump_view_right";
N = "swap_view_left";
E = "swap_view_down";
I = "swap_view_up";
O = "swap_view_right";
c.C-s = "hsplit_new";
c.s = "hsplit_new";
c.C-v = "vsplit_new";
c.v = "vsplit_new";
C-l = "wonly";
l = "wonly";
h = "no_op";
C-h = "no_op";
j = "no_op";
C-j = "no_op";
k = "no_op";
C-k = "no_op";
H = "no_op";
J = "no_op";
K = "no_op";
L = "no_op";
};
selectz = {
e = "scroll_down";
i = "scroll_up";
j = "search_next";
J = "search_prev";
k = "no_op";
n = "no_op";
N = "no_op";
};
selectcw = {
n = "jump_view_left";
C-n = "jump_view_left";
e = "jump_view_down";
C-e = "jump_view_down";
i = "jump_view_up";
C-i = "jump_view_up";
o = "jump_view_right";
C-o = "jump_view_right";
N = "swap_view_left";
E = "swap_view_down";
I = "swap_view_up";
O = "swap_view_right";
c.C-s = "hsplit_new";
c.s = "hsplit_new";
c.C-v = "vsplit_new";
c.v = "vsplit_new";
C-l = "wonly";
l = "wonly";
h = "no_op";
C-h = "no_op";
j = "no_op";
C-j = "no_op";
k = "no_op";
C-k = "no_op";
H = "no_op";
J = "no_op";
K = "no_op";
L = "no_op";
};
in
{
xdg.configFile."helix/themes/edge_neon.toml".source = ./edge_neon.toml;
programs.helix = {
enable = true;
languages = {
use-grammars.except = [ "gemini" ];
language-server = {
rust-analyzer.config.check = {
command = "clippy";
};
typst-lsp = {
command = "typst-lsp";
};
};
language = [
{
name = "typst";
scope = "source.typst";
file-types = [
"typst"
"typ"
];
indent = {
tab-width = 2;
unit = " ";
};
comment-token = "//";
injection-regex = "typ(st)?";
language-servers = [ "typst-lsp" ];
roots = [ "template.typ" ];
auto-pairs = {
"(" = ")";
"{" = "}";
"[" = "]";
"$" = "$";
"\"" = "\"";
};
}
];
grammar = [
{
name = "typst";
source = {
git = "https://github.com/uben0/tree-sitter-typst";
rev = "master";
};
}
];
};
settings = {
theme = "edge_neon";
editor = {
indent-guides.render = true;
bufferline = "always";
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
color-modes = true;
auto-save = true;
lsp.display-messages = true;
};
keys = {
normal = {
n = "move_char_left";
e = "move_visual_line_down";
i = "move_visual_line_up";
o = "move_char_right";
k = "insert_mode";
K = "insert_at_line_start";
h = "open_below";
H = "open_above";
l = "goto_first_nonwhitespace";
L = "goto_line_end";
E = "keep_selections";
A-E = "remove_selections";
j = "search_next";
J = "search_prev";
"\\" = "join_selections";
"A-\\" = "join_selections_space";
"tab" = "goto_next_buffer";
"S-tab" = "goto_previous_buffer";
I = "no_op";
O = "no_op";
A-K = "no_op";
N = "no_op";
A-J = "no_op";
b = "no_op";
W = "no_op";
B = "no_op";
};
normal.w = {
n = "move_prev_word_start";
e = "move_prev_word_end";
i = "move_next_word_start";
o = "move_next_word_end";
N = "move_prev_long_word_start";
E = "move_prev_long_word_end";
I = "move_next_long_word_start";
O = "move_next_long_word_end";
};
normal.z = normalz;
normal.Z = normalz;
normal.g = {
n = "goto_line_start";
e = "move_line_down";
i = "move_line_up";
o = "goto_line_end";
I = "goto_implementation";
E = "goto_last_line";
h = "no_op";
j = "no_op";
k = "no_op";
l = "no_op";
p = "no_op";
};
normal.C-w = normalcw;
normal.space.w = normalcw;
select = {
n = "extend_char_left";
e = "extend_visual_line_down";
i = "extend_visual_line_up";
o = "extend_char_right";
j = "extend_search_next";
J = "extend_search_prev";
k = "insert_mode";
K = "insert_at_line_start";
h = "open_below";
H = "open_above";
l = "extend_to_first_nonwhitespace";
L = "extend_to_line_end";
E = "keep_selections";
A-E = "remove_selections";
"\\" = "join_selections";
"A-\\" = "join_selections_space";
"tab" = "goto_next_buffer";
"S-tab" = "goto_previous_buffer";
I = "no_op";
O = "no_op";
A-K = "no_op";
N = "no_op";
A-J = "no_op";
b = "no_op";
W = "no_op";
B = "no_op";
};
select.w = {
n = "extend_prev_word_start";
e = "extend_prev_word_end";
i = "extend_next_word_start";
o = "extend_next_word_end";
N = "extend_prev_long_word_start";
E = "extend_prev_long_word_end";
I = "extend_next_long_word_start";
O = "extend_next_long_word_end";
};
select.z = selectz;
select.Z = selectz;
select.g = {
e = "extend_line_down";
i = "extend_line_up";
j = "no_op";
k = "no_op";
};
select.C-w = selectcw;
select.space.w = selectcw;
insert.C-c = "normal_mode";
};
};
};
}
{ ... }:
{
imports = [
./bat.nix
./nixvim
./helix
./vscode.nix
];
}
{ pkgs, ... }:
{
programs.bat = {
enable = true;
config.theme = "TwoDark";
};
}
{ pkgs, ... }:
let
nixvim = import (builtins.fetchGit {
url = "https://github.com/nix-community/nixvim";
});
in
{
imports = [
nixvim.homeManagerModules.nixvim
./launchd.nix
./shell.nix
./tools
./editors
./languages
];
nixpkgs = {
config.allowUnfree = true;
overlays = [ (import <rust-overlay>) ];
};
home.stateVersion = "23.11";
}
{ pkgs, ... }:
{
nix.package = pkgs.nixVersions.unstable;
services.nix-daemon.enable = true;
nix.gc.automatic = true;
nix.settings.auto-optimise-store = true;
nix.settings.trusted-users = [
"root"
"weethet"
];
security.pam.enableSudoTouchIdAuth = true;
nixpkgs.config.allowUnfree = true;
environment.systemPackages = [ ];
programs.fish.enable = true;
imports = [
<home-manager/nix-darwin>
];
fonts = {
fontDir.enable = true;
fonts = with pkgs; [
fira-code-nerdfont
monaspace
open-sans
victor-mono
inter
];
};
users.users.weethet = {
name = "weethet";
home = "/Users/weethet";
};
home-manager.users.weethet = import ./home;
homebrew = {
enable = true;
onActivation = {
cleanup = "uninstall";
autoUpdate = true;
upgrade = true;
};
global.autoUpdate = false;
taps = [
"homebrew/cask-versions"
"homebrew/cask-fonts"
# "railwaycat/emacsmacport"
];
brews = [ "mint" ];
casks = import ./homebrew-casks.nix;
masApps = {
"Icon Set Creator" = 939343785;
"Wayback Machine" = 1472432422;
"HSE App X" = 1527320487;
"Consent-O-Matic" = 1606897889;
"AdGuard for Safari" = 1440147259;
Bitwarden = 1352778147;
CotEditor = 1024640650;
Boop = 1518425043;
Numbers = 409203825;
Pages = 409201541;
Keynote = 409183694;
Vimari = 1480933944;
Xcode = 497799835;
"Microsoft To Do" = 1274495053;
TestFlight = 899247664;
};
};
system.stateVersion = 4;
}
# My flakeless configuration for macOS
To install run
```sh
nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
nix-channel --add https://github.com/oxalica/rust-overlay/archive/master.tar.gz rust-overlay
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
darwin-rebuild switch
```
.git
.DS_Store