flake/users/guanranwang/home-manager/common/home.nix

267 lines
7.6 KiB
Nix
Raw Normal View History

2023-10-14 07:53:25 +00:00
{ pkgs, config, lib, inputs, ... }:
2023-09-19 00:17:43 +00:00
{
home = {
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
stateVersion = "23.05";
shellAliases = {
2023-09-19 00:17:43 +00:00
# navigation
"l" = "${pkgs.eza}/bin/eza -Fhl --icons --git";
"ll" = "${pkgs.eza}/bin/eza -Fahl --icons --git";
"ls" = "${pkgs.eza}/bin/eza -F --icons --git";
"la" = "${pkgs.eza}/bin/eza -Fa --icons --git";
2023-09-27 06:47:07 +00:00
"tree" = "${pkgs.eza}/bin/eza --icons --git --tree";
2023-09-19 00:17:43 +00:00
".." = "cd ..";
# replacements
2023-09-20 21:20:38 +00:00
#"code" = "codium";
#"neofetch" = "fastfetch";
2023-09-19 00:17:43 +00:00
#"ranger" = "joshuto"; # rust
2023-09-20 21:20:38 +00:00
#"grep" = "rg";
2023-09-19 00:17:43 +00:00
#"top" = "btm -b";
#"htop" = "btm -b";
#"btop" = "btm";
2023-10-19 15:12:06 +00:00
"yd" = "ydict -c";
2023-09-19 00:17:43 +00:00
"farsee" = "curl -F 'c=@-' 'https://fars.ee/'"; # pb
"clock" = "tty-clock -5Ccs";
# proxy
"setproxy" = let proxy = "http://127.0.0.1:7890/";
in "export http_proxy=${proxy} https_proxy=${proxy} ftp_proxy=${proxy} rsync_proxy=${proxy}";
2023-09-19 00:17:43 +00:00
"unsetproxy" = "set -e http_proxy https_proxy all_proxy"; # fish syntax (?)
};
sessionVariables = {
# misc
"MANPAGER" = "sh -c 'col -bx | bat -l man -p'"; # man: use bat as man's pager
"MANROFFOPT" = "-c"; # man: fix formatting issue with bat
"SKIM_DEFAULT_COMMAND" = "fd --type f || git ls-tree -r --name-only head || rg --files || find ."; # skim: use fd by default
};
};
programs = {
# Let Home Manager install and manage itself.
home-manager.enable = true;
bash = {
enable = true;
historyFile = "${config.xdg.configHome}/bash/.bash_history";
};
zsh = {
enable = true;
2023-10-14 07:53:25 +00:00
### XDG
dotDir = ".config/zsh";
### Plugins
2023-09-19 00:17:43 +00:00
syntaxHighlighting.enable = true;
historySubstringSearch.enable = true;
enableAutosuggestions = true;
2023-10-14 07:53:25 +00:00
plugins = [
{
name = "fzf-tab";
2023-10-14 09:40:41 +00:00
src = "${pkgs.zsh-fzf-tab}/share/fzf-tab";
2023-10-14 07:53:25 +00:00
}
{
2023-10-14 09:39:45 +00:00
# should I use flake inputs / fetchurl?
2023-10-14 07:53:25 +00:00
name = "sudo";
2023-10-14 09:39:45 +00:00
src = (pkgs.fetchFromGitHub {
owner = "ohmyzsh";
repo = "ohmyzsh";
rev = "f8bf8f0029a475831ebfba0799975ede20e08742";
hash = "sha256-9cJQQycahO+vo/YcAHjF+PVhsWxu7pa4MsK8Dgr69k0=";
sparseCheckout = [
"plugins/sudo"
];
} + "/plugins/sudo");
2023-10-14 07:53:25 +00:00
}
];
initExtra = "zstyle ':fzf-tab:*' fzf-command sk";
### History
2023-09-19 00:17:43 +00:00
history = {
path = "${config.xdg.configHome}/zsh/.zsh_history";
save = 1000000;
size = 1000000;
};
};
fish = {
enable = true;
interactiveShellInit = ''
set fish_greeting
source ${config.xdg.configHome}/fish/tokyonight_night.fish
'';
};
tealdeer.enable = true;
zoxide.enable = true;
starship = {
enable = true;
settings = {
add_newline = false;
aws.disabled = true;
gcloud.disabled = true;
line_break.disabled = true;
};
};
#eza = {
# enable = true;
# git = true;
# icons = true;
#};
git = {
enable = true;
userName = "Guanran Wang";
userEmail = "guanran928@outlook.com";
delta.enable = true;
};
alacritty = {
enable = true;
settings = {
2023-10-14 07:53:25 +00:00
import = [ "${inputs.tokyonight}/extras/alacritty/tokyonight_night.yml" ];
2023-09-19 00:17:43 +00:00
cursor.style = "beam";
env.WINIT_X11_SCALE_FACTOR = "1";
window = {
#opacity = 0.9;
padding = {
x = 12;
y = 12;
};
};
font = {
size = 12;
normal = {
family = lib.mkDefault "monospace"; # macOS dont have fontconfig, so mkDefault is nessesary
style = "SemiBold";
};
bold = {
family = lib.mkDefault "monospace";
style = "Bold";
};
bold_italic = {
family = lib.mkDefault "monospace";
style = "Bold Itailc";
};
italic = {
family = lib.mkDefault "monospace";
style = "SemiBold Italic";
};
};
};
};
2023-10-14 07:53:25 +00:00
kitty = {
enable = true;
settings = {
include = "${inputs.tokyonight}/extras/kitty/tokyonight_night.conf";
font_size = 12;
confirm_os_window_close = 0;
window_padding_width = 6;
adjust_line_height = 0;
};
};
2023-10-07 04:11:28 +00:00
# Editors
### VSCode
2023-09-19 00:17:43 +00:00
vscode = {
enable = true;
package = pkgs.vscodium; # foss
enableExtensionUpdateCheck = false;
enableUpdateCheck = false;
userSettings = {
"diffEditor.ignoreTrimWhitespace" = false;
"editor.cursorBlinking" = "smooth";
2023-10-18 11:03:35 +00:00
"editor.cursorSmoothCaretAnimation" = "on";
"editor.fontFamily" = lib.mkDefault "Monospace";
2023-10-18 11:03:35 +00:00
"editor.fontWeight" = 600;
"editor.tabSize" = 2;
"explorer.confirmDragAndDrop" = false;
"explorer.confirmDelete" = false;
"files.autoSave" = "onFocusChange";
"files.trimTrailingWhitespace" = true;
"files.trimFinalNewlines" = true;
"security.workspace.trust.enabled" = false;
"telemetry.telemetryLevel" = "off";
"terminal.external.osxExec" = "Alacritty.app";
"terminal.integrated.cursorBlinking" = true;
"update.mode" = "none";
"window.menuBarVisibility" = "toggle";
"workbench.colorTheme" = "Tokyo Night";
2023-09-19 00:17:43 +00:00
# Extensions
### Nix IDE
"nix.enableLanguageServer" = true;
2023-10-18 11:03:35 +00:00
"nix.serverPath" = "${pkgs.nil}/bin/nil";
### GitLens
"gitlens.telemetry.enabled" = false;
2023-09-19 00:17:43 +00:00
};
extensions = with pkgs.vscode-extensions; [
2023-10-18 11:03:35 +00:00
### LSP
2023-09-19 00:17:43 +00:00
jnoortheen.nix-ide
2023-10-26 13:20:24 +00:00
#ms-python.python
2023-09-19 00:17:43 +00:00
rust-lang.rust-analyzer
tamasfe.even-better-toml
#bungcip.better-toml
2023-10-18 11:03:35 +00:00
### QoL
2023-09-19 00:17:43 +00:00
eamodio.gitlens
esbenp.prettier-vscode
ritwickdey.liveserver
vscodevim.vim
2023-10-18 11:03:35 +00:00
### Themes
2023-09-19 00:17:43 +00:00
enkia.tokyo-night
#catppuccin.catppuccin-vsc-icons
#catppuccin.catppuccin-vsc
];
};
2023-10-07 04:11:28 +00:00
### Neovim
neovim = {
enable = true;
#defaultEditor = true;
viAlias = true;
vimAlias = true;
};
### Helix
helix = {
enable = true;
defaultEditor = true;
settings = {
theme = "tokyonight";
editor = {
cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};
statusline = {
mode = {
normal = "--NORMAL--";
insert = "--INSERT--";
select = "--SELECT--";
};
2023-10-07 04:11:28 +00:00
};
indent-guides.render = true;
file-picker.hidden = false;
};
# i still use these keybinds somethimes, even its hard to reach
keys.insert = {
C-left = "move_prev_word_start";
C-right = "move_next_word_end";
};
keys.normal = {
C-left = "move_prev_word_start";
C-right = "move_next_word_end";
2023-10-07 04:11:28 +00:00
};
};
};
2023-09-19 00:17:43 +00:00
};
2023-10-18 11:03:35 +00:00
}