nixos/home-manager/home.nix

603 lines
16 KiB
Nix
Raw Normal View History

2024-02-12 09:25:11 +01:00
{ config, pkgs, inputs, ... }:
{
2024-02-12 13:30:48 +01:00
# Basic user info
2024-02-12 09:25:11 +01:00
home.username = "crony";
home.homeDirectory = "/home/crony";
2024-02-12 13:30:48 +01:00
# DO NOT CHANGE
home.stateVersion = "23.11";
# Imports
2024-02-12 09:25:11 +01:00
imports =
[
inputs.nixvim.homeManagerModules.nixvim
];
2024-02-12 13:30:48 +01:00
# My packages
home.packages = with pkgs; [
librewolf # Nice privacy browser
thunderbird # Nice mail client
qutebrowser # Nice browser in general
discord # Fuck the fact I have to use it
keepassxc # Best password manager
buku # Nice bookmark manager
bukubrow # Nice bookmark manager browser support
rclone # Best sync client in the world
age # Simple file encryption
alacritty # Best terminal
nitch # Simple system info
libarchive # bsdtar
imagemagick # image tools
ffmpeg # video manupilation
glow # markdown viewer
piper # ratbagd mice config gui
krita # best drawing program
tutanota-desktop # fjdlkfjldjflkd
delfin # jellyfin client
nurl # nix tool
ripgrep # Neovim telescope dependency
lazygit # Amazing git tui
lm_sensors # Sensor monitoring tool
(nerdfonts.override { fonts = [ "CascadiaCode" ]; }) # Best font
2024-02-12 09:25:11 +01:00
# My custom dmenu build
(dmenu.overrideAttrs (oldAttrs: rec {
2024-02-12 09:25:11 +01:00
src = builtins.fetchGit {
url = "https://code.cronyakatsuki.xyz/crony/dmenu";
rev = "10dcddf14b38cfd965ab27f084139513baed70bf";
};
}))
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (writeShellScriptBin "my-hello" ''
2024-02-12 09:25:11 +01:00
# echo "Hello, ${config.home.username}!"
# '')
];
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy. ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
2024-02-12 13:30:48 +01:00
# Environmental variables I can't live without
2024-02-12 09:25:11 +01:00
home.sessionVariables = {
EDITOR = "nvim";
BROWSER = "qutebrowser";
TERMINAL = "alacritty";
};
# Fix environmental variables not loaded in plasma x11
xsession.enable = true;
2024-02-12 09:25:11 +01:00
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# gpg settings
programs.gpg = {
enable = true;
homedir = "${config.xdg.dataHome}/gnupg";
};
# Make it use kde for flkdsjlkfdlsjflkdsjflsdjklfjdsklf
services.gpg-agent = {
enable = true;
pinentryFlavor = "qt";
};
# Btop settings
programs.btop = {
enable = true;
settings = {
color_theme = "catppuccin_frappe";
vim_keys = true;
};
};
# Mpv settings
programs.mpv = {
enable = true;
config = {
ytdl-format="bestvideo[height<=?1080][fps<=?60][vcodec!=?vp9]+bestaudio/best";
ytdl-raw-options="extractor-args=youtube:player-client=android";
fs=true;
force-window="immediate";
screenshot-template="%F - [%P]v%#01n";
sub-file-paths="Subs;subs";
sub-auto="all";
slang="english,eng,en";
};
scripts = with pkgs.mpvScripts; [ mpris sponsorblock uosc thumbfast quality-menu ];
};
2024-02-12 14:34:27 +01:00
programs.tmux = {
enable = true;
disableConfirmationPrompt = true;
escapeTime = 0;
keyMode = "vi";
mouse = true;
plugins = with pkgs; [
tmuxPlugins.sensible
tmuxPlugins.yank
{
plugin = tmuxPlugins.catppuccin;
extraConfig = ''
set -g @catppuccin_flavour 'frappe'
set -g @catppuccin_window_right_separator " "
set -g @catppuccin_window_number_position "right"
set -g @catppuccin_window_middle_separator " | "
set -g @catppuccin_window_default_fill "none"
set -g @catppuccin_window_current_fill "all"
set -g @catppuccin_status_modules_right "application session date_time"
set -g @catppuccin_status_left_separator ""
set -g @catppuccin_status_right_separator ""
'';
}
];
prefix = "C-Space";
terminal = "alacritty";
extraConfig = ''
# Fix colors
set-option -sa terminal-overrides ",alacritty:Tc"
# start window and panes indexing at 1
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on
# Faster statusbar updates
set-option -g status-interval 1
# Easier movement
bind -n M-K previous-window
bind -n M-J next-window
# Better split bindings
bind "'" split-window -v -c "#{pane_current_path}"
bind '\' split-window -h -c "#{pane_current_path}"
# Vim keybindings for pane movement
setw -g mode-keys vi
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Status bar border
setw -g pane-border-status top
setw -g pane-border-format ''
# Bar to top
set-option -g status-position top
'';
};
2024-02-12 09:25:11 +01:00
# NNN Settings
programs.nnn = {
enable = true;
package = pkgs.nnn.override ({ withNerdIcons = true; });
bookmarks = { d = "~/Documents"; D = "~/Downloads"; p = "~/Pictures"; v = "~/Videos";};
2024-02-12 13:30:48 +01:00
extraPackages = with pkgs; [ pmount ffmpegthumbnailer mediainfo ueberzugpp poppler_utils gnome-epub-thumbnailer nsxiv ];
2024-02-12 09:25:11 +01:00
plugins.mappings = { u = "nmount"; c = "chksum"; r = "gitroot"; v = "imgview"; m = "mtpmount"; d = "xdgdefault"; x = "togglex"; p = "preview-tui"; };
plugins.src = (pkgs.fetchFromGitHub { owner = "jarun"; repo = "nnn"; rev = "v4.9"; sha256 = "sha256-g19uI36HyzTF2YUQKFP4DE2ZBsArGryVHhX79Y0XzhU=";}) + "/plugins";
};
# Mangohud settings
programs.mangohud = {
enable = true;
settings = {
# GPU SETTINGS
gpu_stats = true;
gpu_temp = true;
gpu_core_clock = true;
gpu_power = true;
gpu_text = "GPU";
gpu_load_change = true;
gpu_load_color = "39F900,FDFD09,B22222";
# CPU SETTINGS
cpu_stats = true;
cpu_temp = true;
cpu_text = "CPU";
cpu_mhz = true;
cpu_load_change = true;
cpu_load_value = "60,90";
cpu_load_color = "39F900,FDFD09,B22222";
# Vram/Ram/Swap
vram = true;
ram = true;
swap = true;
# Fps settings
fps = true;
fps_sampling_period = "1000";
fps_color_change = true;
fps_value = "30,60";
fps_color = "B22222,FDFD09,39F900";
frametime = true;
# Misc
gpu_name = true;
vulkan_driver = true;
show_fps_limit = true;
resolution = true;
round_corners = "5";
};
};
# But we all know I love zsh
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
history.path = "${config.xdg.dataHome}/zsh/history";
dotDir = ".config/zsh";
envExtra = ''
# NNN settings
export NNN_FIFO="/tmp/nnn.fifo"
export NNN_SSHFS="sshfs -o follow_symlinks"
export NNN_TERMINAL="alacritty --class preview,preview"
# Catppuccin colors nnn
BLK="03" CHR="03" DIR="04" EXE="02" REG="07" HARDLINK="05" SYMLINK="05" MISSING="08" ORPHAN="01" FIFO="06" SOCK="03" UNKNOWN="01"
export NNN_COLORS="#04020301;4231"
export NNN_FCOLORS="$BLK$CHR$DIR$EXE$REG$HARDLINK$SYMLINK$MISSING$ORPHAN$FIFO$SOCK$UNKNOWN"
'';
initExtra = ''
# VI Mode escape timeout fix
export KEYTIMEOUT=1
# Substring search settings
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="bg=blue,fg=black,bold"
export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=black,bold'
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
'';
initExtraFirst = ''
nitch
'';
zplug = {
enable = true;
plugins = [
{ name = "zap-zsh/supercharge"; }
{ name = "zap-zsh/completions"; }
{ name = "zap-zsh/vim"; }
{ name = "chivalryq/git-alias"; }
{ name = "zdharma-continuum/fast-syntax-highlighting"; }
{ name = "MichaelAquilina/zsh-you-should-use"; }
{ name = "zsh-users/zsh-history-substring-search"; }
];
};
};
# Eza settings
programs.eza = {
enable = true;
enableAliases = true;
git = true;
icons = true;
};
# Zoxide settings
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
# Starhip settings
programs.starship = {
enable = true;
enableZshIntegration = true;
};
# Fzf settings
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
# Nixvim
programs.nixvim = {
enable = true;
viAlias = true;
vimAlias = true;
options = {
hlsearch = false;
incsearch = true;
number = true;
relativenumber = true;
tabstop = 4;
softtabstop = 4;
shiftwidth = 4;
expandtab = true;
smartindent = true;
mouse = "";
breakindent = true;
undofile = true;
swapfile = true;
ignorecase = true;
smartcase = true;
signcolumn = "yes";
completeopt = "menuone,noselect";
updatetime = 50;
timeoutlen = 300;
colorcolumn = "80";
showmode = false;
laststatus = 3;
splitbelow = true;
splitright = true;
};
globals = {
mapleader = " ";
maplocalleader = ";";
};
extraConfigLuaPost = ''
vim.notify = require("mini.notify").make_notify()
'';
plugins = {
harpoon = {
enable = true;
keymaps = {
addFile = "<leader>a";
toggleQuickMenu = "<C-e>";
navFile = { "1" = "<C-j>"; "2" = "<C-k>"; "3" = "<C-l>"; "4" = "<C-;>"; };
};
};
oil = {
enable = true;
defaultFileExplorer = true;
extraOptions = { show_hidden = true; };
};
treesitter.enable = true;
gitsigns = {
enable = true;
signs = {
add.text = "";
change.text = "";
changedelete.text = "";
delete.text = "";
topdelete.text = "";
untracked.text = "";
};
onAttach.function = ''
function(buffer)
local gs = package.loaded.gitsigns
local function map(mode, l, r, desc)
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
end
-- stylua: ignore start
map("n", "]g", gs.next_hunk, "Next git hunk")
map("n", "[g", gs.prev_hunk, "Previous git hunk")
end
'';
};
mini = {
enable = true;
modules = {
statusline = {
set_vim_settings = false;
};
comment = {};
notify = {};
};
};
telescope = {
enable = true;
extensions = {
fzf-native = {
enable = true;
fuzzy = true;
overrideGenericSorter = true;
overrideFileSorter = true;
caseMode = "smart_case";
};
ui-select.enable = true;
};
keymaps = {
"<leader>pf" = "find_files";
"<C-p>" = "git_files";
"<leader>vh" = "help_tags";
"<leader>ps" = "grep_string";
};
};
lsp = {
enable = true;
servers = {
lua-ls.enable = true;
nil_ls.enable = true;
2024-02-13 08:59:12 +01:00
marksman.enable = true;
2024-02-12 09:25:11 +01:00
};
keymaps = {
diagnostic = {
"<leader>vd" = "open_float";
"[d" = "goto_next";
"]d" = "goto_prev";
};
lspBuf = {
K = "hover";
gd = "definition";
gD = "declaration";
gi = "implementation";
"<leader>lca" = "code_action";
"<leader>lrn" = "rename";
"<C-h>" = "signature_help";
};
};
preConfig = ''
local function sign_define(args)
vim.fn.sign_define(args.name, {
texthl = args.name,
text = args.text,
numhl = "",
})
end
sign_define({ name = "DiagnosticSignError", text = "E" })
sign_define({ name = "DiagnosticSignWarn", text = "W" })
sign_define({ name = "DiagnosticSignHint", text = "H" })
sign_define({ name = "DiagnosticSignInfo", text = "I" })
'';
};
nvim-cmp = {
enable = true;
autoEnableSources = true;
sources = [
{name = "nvim_lsp";}
{name = "path";}
{name = "snippy";}
];
snippet.expand = "snippy";
mapping = {
"<C-l>" = "cmp.mapping.confirm({ select = false })";
"<C-j>" = {
action = ''
function(fallback)
if cmp.visible then
cmp.select_next_item()
else
fallback()
end
end
'';
modes = [ "i" "s" ];
};
"<C-k>" = {
action = ''
function(fallback)
if cmp.visible then
cmp.select_prev_item()
else
fallback()
end
end
'';
modes = [ "i" "s" ];
};
};
};
};
colorschemes.catppuccin = {
enable = true;
flavour = "frappe";
styles = {
functions = [ "bold" ];
keywords = [ "bold" ];
};
};
extraPlugins = with pkgs.vimPlugins; [
vim-snippets
];
};
##-- Restic Timers And Services --##
# Restic backup
systemd.user.services = {
restic_backup = {
Unit.Description = "Restic backup service";
Service = {
Type = "oneshot";
ExecStart = toString (
pkgs.writeShellScript "restic-backup" ''
. /etc/restic/local
restic backup --files-from /home/crony/.config/restic/list --verbose && restic forget --keep-last 10 --keep-daily 7 --keep-weekly 5 --keep-monthly 12
. /etc/restic/online
restic backup --files-from /home/crony/.config/restic/list --verbose && restic forget --keep-last 10 --keep-daily 7 --keep-weekly 5 --keep-monthly 12
''
);
};
Install.WantedBy = [ "default.target" ];
};
};
systemd.user.timers = {
restic_backup = {
Unit.Description = "Restic backup timer";
Timer = {
OnBootSec = "5m";
OnUnitActiveSec = "6h";
};
Install.WantedBy = [ "timers.target" ];
};
};
# Restic check
systemd.user.services = {
restic_check = {
Unit.Description = "Restic check service";
Service = {
Type = "oneshot";
ExecStart = toString (
pkgs.writeShellScript "restic-check" ''
. /etc/restic/local
restic check --read-data-subset=10%
. /etc/restic/online
restic check --read-data-subset=10%
''
);
};
Install.WantedBy = [ "default.target" ];
};
};
systemd.user.timers = {
restic_check = {
Unit.Description = "Restic check timer";
Timer = {
OnCalendar="Thu *-*-* 18:00:00";
};
Install.WantedBy = [ "timers.target" ];
};
};
# Restic prune
systemd.user.services = {
restic_prune = {
Unit.Description = "Restic prune service";
Service = {
Type = "oneshot";
ExecStart = toString (
pkgs.writeShellScript "restic-prune" ''
. /etc/restic/local
restic prune
. /etc/restic/online
restic prune
''
);
};
Install.WantedBy = [ "default.target" ];
};
};
systemd.user.timers = {
restic_prune = {
Unit.Description = "Restic prune timer";
Timer = {
OnCalendar="Fri *-*-* 18:00:00";
};
Install.WantedBy = [ "timers.target" ];
};
};
}