nixcfg/homes/x86_64-linux/harald@nix.fedora.fritz.box/default.nix
2024-01-11 08:18:07 +00:00

358 lines
8.9 KiB
Nix

{ lib
, pkgs
, config
, nixpkgs
, osConfig ? { }
, format ? "unknown"
, ...
}:
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "harald";
home.homeDirectory = "/home/harald/nix";
home.stateVersion = "23.11"; # Please read the comment before changing.
home.sessionPath = [
"$HOME/.local/share/JetBrains/Toolbox/scripts"
"$HOME/bin"
];
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = with pkgs; [
bashInteractive
cachix
jetbrains-toolbox
delta
git
vim
tmux
(pkgs.nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" "JetBrainsMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
home.sessionVariables = {
EDITOR = "vim";
};
home.shellAliases = {
cat = "${pkgs.bat}/bin/bat --decorations never";
less = ''${pkgs.bat}/bin/bat --decorations never --paging=always --pager "${pkgs.less}/bin/less -RF"'';
man = "${pkgs.bat-extras.batman}/bin/batman";
};
fonts.fontconfig.enable = true;
programs = {
bash = {
enable = true;
};
bat = {
enable = true;
config.theme = "ansi";
extraPackages = with pkgs.bat-extras; [ batdiff batman batgrep batwatch ];
};
git = {
enable = true;
userName = "Harald Hoyer";
userEmail = "harald@hoyer.xyz";
extraConfig = {
init.defaultBranch = "main";
"credential \"https://github.com\"" = {
helper = "!gh auth git-credential";
};
alias = {
co = "checkout";
ci = "commit";
};
pull.ff = "only";
core.pager = "delta";
delta = {
features = "side-by-side line-numbers decorations";
syntax-theme = "Dracula";
};
interactive.diffFilter = "delta --color-only";
merge.conflictStyle = "diff3";
diff.colorMoved = "default";
};
};
direnv = {
enable = true;
nix-direnv.enable = true;
};
fish.enable = true;
fish.interactiveShellInit = ''
function msh --wraps mosh --description 'mosh with tmux'
if not set -q argv[1]
echo 'Usage: msh [user@]host [command]'
else
${pkgs.mosh}/bin/mosh $argv -- tmux new-session -A -s 0
end
end
'';
fish.plugins = [{
name = "foreign-env";
src = pkgs.fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-foreign-env";
rev = "dddd9213272a0ab848d474d0cbde12ad034e65bc";
sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs";
};
}];
fish.shellInit =
''
# nix
if test -e /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
end
# home-manager
if test -e $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
fenv source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
end
'';
# programs.bash.enable = true;
bash.initExtra = ''
function msh() { mosh "$@" -- bash -c 'if type -f tmux; then tmux new-session -A -s 0; else screen -R; fi;' ; };
'';
# Let Home Manager install and manage itself.
home-manager.enable = true;
starship.enable = true;
starship.settings =
{
container.format = "[\\[$name\\]]($style) ";
git_status = {
ahead = "$\{count}";
diverged = "$\{ahead_count}$\{behind_count}";
behind = "$\{count}";
};
};
neovim-flake = {
enable = true;
# your settings need to go into the settings attrset
settings = {
vim = {
viAlias = false;
vimAlias = false;
debugMode = {
enable = false;
level = 20;
logFile = "/tmp/nvim.log";
};
};
vim.lsp = {
formatOnSave = true;
lspkind.enable = false;
lightbulb.enable = true;
lspsaga.enable = false;
nvimCodeActionMenu.enable = true;
trouble.enable = true;
lspSignature.enable = true;
lsplines.enable = true;
};
vim.debugger = {
nvim-dap = {
enable = true;
ui.enable = true;
};
};
vim.languages = {
enableLSP = true;
enableFormat = true;
enableTreesitter = true;
enableExtraDiagnostics = true;
nix = {
enable = true;
format.type = "nixpkgs-fmt";
};
html.enable = true;
clang = {
enable = true;
lsp.server = "clangd";
};
sql.enable = false;
rust = {
enable = true;
crates.enable = true;
};
java.enable = true;
ts.enable = true;
svelte.enable = true;
go.enable = true;
zig.enable = true;
python.enable = true;
dart.enable = true;
elixir.enable = false;
};
vim.visuals = {
enable = true;
nvimWebDevicons.enable = true;
scrollBar.enable = true;
smoothScroll.enable = true;
cellularAutomaton.enable = true;
fidget-nvim.enable = true;
indentBlankline = {
enable = true;
fillChar = null;
eolChar = null;
showCurrContext = true;
};
cursorline = {
enable = true;
lineTimeout = 0;
};
};
vim.statusline = {
lualine = {
enable = true;
theme = "catppuccin";
};
};
vim.theme = {
enable = true;
name = "catppuccin";
style = "mocha";
transparent = false;
};
vim.autopairs.enable = true;
vim.autocomplete = {
enable = true;
type = "nvim-cmp";
};
vim.filetree = {
nvimTree = {
enable = true;
};
};
vim.tabline = {
nvimBufferline.enable = true;
};
vim.treesitter.context.enable = true;
vim.binds = {
whichKey.enable = true;
cheatsheet.enable = true;
};
vim.telescope.enable = true;
vim.git = {
enable = true;
gitsigns.enable = true;
gitsigns.codeActions = false; # throws an annoying debug message
};
vim.minimap = {
minimap-vim.enable = false;
codewindow.enable = true; # lighter, faster, and uses lua for configuration
};
vim.dashboard = {
dashboard-nvim.enable = false;
alpha.enable = true;
};
vim.notify = {
nvim-notify.enable = true;
};
vim.projects = {
project-nvim.enable = true;
};
vim.utility = {
ccc.enable = true;
vim-wakatime.enable = false;
icon-picker.enable = true;
surround.enable = true;
diffview-nvim.enable = true;
motion = {
hop.enable = true;
leap.enable = true;
};
};
vim.notes = {
obsidian.enable = false; # FIXME neovim fails to build if obsidian is enabled
orgmode.enable = false;
mind-nvim.enable = true;
todo-comments.enable = true;
};
vim.terminal = {
toggleterm = {
enable = true;
lazygit.enable = true;
};
};
vim.ui = {
borders.enable = true;
noice.enable = true;
colorizer.enable = true;
modes-nvim.enable = false; # the theme looks terrible with catppuccin
illuminate.enable = true;
breadcrumbs = {
enable = true;
navbuddy.enable = true;
};
smartcolumn = {
enable = true;
columnAt.languages = {
# this is a freeform module, it's `buftype = int;` for configuring column position
nix = 110;
ruby = 120;
java = 130;
go = [ 90 130 ];
};
};
};
vim.assistant = {
copilot = {
enable = true;
cmp.enable = true;
};
};
vim.session = {
nvim-session-manager.enable = false;
};
vim.gestures = {
gesture-nvim.enable = false;
};
vim.comments = {
comment-nvim.enable = true;
};
vim.spellChecking.languages = [ "en" "de" ];
};
};
};
}