summaryrefslogtreecommitdiff
path: root/home-manager/common.nix
diff options
context:
space:
mode:
authorJasper Ras <jaspert.ras@gmail.com>2024-11-09 14:26:34 +0100
committerJasper Ras <jaspert.ras@gmail.com>2024-11-09 14:26:34 +0100
commit3fce1b5d9350c116270111e92f2d993e1b518d4d (patch)
treedaada43eb23df53d6a0df3622d4bfe913851d1f3 /home-manager/common.nix
parent4211ed3b82be9af26460a0a8d88dce9ce319bb47 (diff)
Inline home-manager
Diffstat (limited to 'home-manager/common.nix')
-rw-r--r--home-manager/common.nix373
1 files changed, 373 insertions, 0 deletions
diff --git a/home-manager/common.nix b/home-manager/common.nix
new file mode 100644
index 0000000..9fa996d
--- /dev/null
+++ b/home-manager/common.nix
@@ -0,0 +1,373 @@
+{ lib, pkgs, inputs, ... }: {
+ # # 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.packages = [
+ pkgs.gnumake
+ inputs.zen-browser.packages.${pkgs.system}.specific
+ pkgs.git-crypt
+ pkgs.maim
+ pkgs.xkcdpass
+ pkgs.speedtest-cli
+ pkgs.bitwarden-cli
+ # Language servers
+ pkgs.nixfmt-rfc-style
+ pkgs.nixd
+ pkgs.pyright
+ pkgs.gopls
+ pkgs.lua-language-server
+ pkgs.ansible-language-server
+ pkgs.ansible-lint
+ # ---
+ pkgs.fd
+ pkgs.glow
+ pkgs.eza
+ pkgs.openssh
+
+ pkgs.cobra-cli
+ pkgs.yq-go
+
+ # Programming languages
+ pkgs.gleam
+ pkgs.erlang_26
+ pkgs.elixir_1_15
+ pkgs.elixir_ls
+
+ # Python formatted and linter
+ pkgs.python313
+ pkgs.black
+ pkgs.ruff
+ ];
+
+ # # 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
+ # '';
+ home.file = { };
+
+ # You can also manage environment variables but you will have to manually
+ # source
+ #
+ # ~/.nix-profile/etc/profile.d/hm-session-vars.sh
+ #
+ # or
+ #
+ # /etc/profiles/per-user/jras/etc/profile.d/hm-session-vars.sh
+ #
+ # if you don't want to manage your shell through Home Manager.
+ home.sessionVariables = { EDITOR = "hx"; };
+ home.sessionPath = [ "$GOBIN" ];
+
+ # Let Home Manager install and manage itself.
+ programs.home-manager.enable = true;
+ programs.ripgrep.enable = true;
+ programs.bat.enable = true;
+ programs.btop.enable = true;
+ programs.go = {
+ enable = true;
+ goPath = "go";
+ goBin = "go/bin";
+ };
+
+ programs.zoxide = {
+ enable = true;
+ options = [ "--cmd cd" ];
+ };
+ programs.fzf.enable = true;
+
+ programs.direnv = {
+ enable = true;
+ nix-direnv.enable = true;
+ };
+
+ programs.zsh = {
+ enable = true;
+ defaultKeymap = "emacs";
+ envExtra = ''
+ export ZVM_VI_INSERT_ESCAPE_BINDKEY="jk"
+ '';
+ initExtra = ''
+ # https://github.com/jeffreytse/zsh-vi-mode
+ source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
+ '';
+ shellAliases = {
+ g = "git";
+ };
+ };
+
+ programs.git = {
+ enable = true;
+ aliases = {
+ f = "fetch";
+ p = "pull";
+ s = "status";
+ co = "checkout";
+ pu = "push";
+ lg =
+ "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
+ praise = "blame";
+ bump = "!git bump";
+ ae = "!git add -A && git commit --amend";
+ ac = "!git add -A && git commit";
+ rmbs =
+ "!git branch | grep -wv master | grep -wv main | xargs git branch -D";
+ nb = "!git checkout -b";
+ };
+ extraConfig = {
+ pull.rebase = false;
+ init.defaultBranch = "main";
+ };
+ };
+
+ programs.tmux = {
+ enable = true;
+ shortcut = "a";
+ newSession = true;
+ terminal = "tmux-256color";
+ extraConfig = ''
+ # Recommended by NeoVim's checkhealth
+ set-option -sg escape-time 10
+ set-option -g default-shell ${pkgs.zsh}/bin/zsh
+
+ # # Set vim keymode
+ set-window-option -g mode-keys vi
+ bind-key -T copy-mode-vi v send -X begin-selection
+ bind-key -T copy-mode-vi V send -X select-line
+ bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
+ '';
+ plugins = with pkgs.tmuxPlugins; [
+ vim-tmux-navigator
+
+ {
+ plugin = catppuccin;
+ extraConfig = ''
+ set -g @catppuccin_flavour 'frappe'
+ set -g @catppuccin_powerline_theme_enabled 'on'
+ set -g @catppuccin_l_left_separator ''
+ set -g @catppuccin_l_right_separator ''
+ set -g @catppuccin_r_left_separator ''
+ set -g @catppuccin_r_right_separator ''
+ '';
+ }
+ ];
+ };
+
+ programs.neovim = {
+ enable = true;
+ vimAlias = true;
+ plugins = with pkgs.vimPlugins; [
+ gleam-vim
+ plenary-nvim
+ telescope-file-browser-nvim
+ vim-tmux-navigator
+ nui-nvim
+ # Colors
+ catppuccin-nvim
+ # LSP
+ nvim-lspconfig
+ trouble-nvim
+ # Completion
+ luasnip
+ nvim-cmp
+ cmp-nvim-lsp
+ cmp-nvim-lua
+ cmp-buffer
+ cmp-path
+ cmp_luasnip
+
+ {
+ plugin = lsp-zero-nvim;
+ type = "lua";
+ config = builtins.readFile (./neovim/lsp-zero-nvim.lua);
+ }
+ {
+ plugin = nvim-web-devicons;
+ type = "lua";
+ config = builtins.readFile (./neovim/nvim-web-devicons.lua);
+ }
+ {
+ plugin = nvim-treesitter.withAllGrammars;
+ type = "lua";
+ config = builtins.readFile (./neovim/nvim-treesitter.lua);
+ }
+ {
+ plugin = telescope-nvim;
+ type = "lua";
+ config = builtins.readFile (./neovim/telescope-nvim.lua);
+ }
+ {
+ plugin = harpoon;
+ type = "lua";
+ config = builtins.readFile (./neovim/harpoon.lua);
+ }
+ #{
+ # plugin = copilot-vim;
+ # type = "lua";
+ # config = builtins.readFile (./neovim/copilot-vim.lua);
+ #}
+ ];
+ extraLuaConfig = builtins.readFile (./neovim/init.lua);
+ extraConfig = ''
+ set shiftwidth=4 smarttab
+ set expandtab
+ set tabstop=4 softtabstop=0
+
+ inoremap jk <ESC>
+ let mapleader=" " " remap the mapleader
+
+ syntax on " syntax highlighting
+ set number " show line numbers
+ set relativenumber " relative line numbers
+ set noswapfile " disable the swap file
+ set hlsearch " highlight all results
+ set ignorecase " ignore case in search
+ set incsearch " show search results as you type
+
+ " disable mouse
+ set mouse=
+
+ autocmd BufWritePost *.nix !nixfmt %
+ autocmd BufWritePost *.go !gofmt -w %
+ '';
+ };
+
+ programs.starship = {
+ enable = true;
+ settings = {
+ directory.style = "blue";
+
+ format = lib.concatStrings [
+ "$username"
+ "$hostname"
+ "$directory"
+ "$git_branch"
+ "$git_state"
+ "$git_status"
+ "$cmd_duration"
+ "$line_break"
+ "$python"
+ "$openstack"
+ "$character"
+ ];
+
+ character = {
+ success_symbol = "[❯](purple)";
+ error_symbol = "[❯](red)";
+ vimcmd_symbol = "[❮](green)";
+ };
+
+ git_branch = {
+ format = "[$branch]($style)";
+ style = "bright-black";
+ };
+
+ git_status = {
+ format =
+ "[[(*$conflicted$untracked$modified$staged$renamed$deleted)](218) ($ahead_behind$stashed)]($style)";
+ style = "cyan";
+ conflicted = "​";
+ untracked = "​";
+ modified = "​";
+ staged = "​";
+ renamed = "​";
+ deleted = "​";
+ stashed = "≡";
+ };
+
+ git_state = {
+ format = "'([$state( $progress_current/$progress_total)]($style))' ";
+ style = "bright-black";
+ };
+
+ cmd_duration = {
+ format = "[$duration]($style) ";
+ style = "yellow";
+ };
+
+ python = {
+ format = "[$virtualenv]($style) ";
+ style = "bright-black";
+ };
+ };
+ };
+
+ programs.helix = {
+ enable = true;
+ package = inputs.helix.packages."${pkgs.system}".helix;
+ defaultEditor = true;
+ languages = {
+ language = [
+ {
+ name = "python";
+ language-servers = [ "pyright" "ruff" ];
+ formatter = { command = "black"; args = ["--line-length" "88" "--quiet" "-"]; };
+ auto-format = true;
+ }
+ {
+ name = "elixir";
+ language-servers = [ "elixir-ls" ];
+ formatter = { command = "mix format"; };
+ auto-format = true;
+ }
+ ];
+ language-server.pyright.config.python.analysis = { typeCheckingMode = "basic"; };
+ language-server.ruff = { command = "ruff"; };
+ language-server.ruff.config.setting = { args = ["--ignore" "E501" ]; };
+ language-server.intelephense = with pkgs.nodePackages; {
+ command = "${intelephense}/bin/intelephense";
+ };
+ };
+ settings = {
+ keys.normal = {
+ space.F = "file_picker_in_current_buffer_directory";
+ };
+ editor = {
+ line-number = "relative";
+ bufferline = "always";
+ lsp = {
+ enable = true;
+ display-messages = true;
+ };
+ indent-guides = {
+ render = true;
+ skip-levels = 1;
+ };
+ auto-save = false;
+ };
+ };
+ };
+
+ services.ssh-agent.enable = true;
+ programs.ssh = {
+ enable = true;
+ package = "${pkgs.openssh}";
+ addKeysToAgent = "yes";
+ };
+
+ programs.alacritty = {
+ settings = {
+ window = {
+ padding = { x = 5; y = 5; };
+ };
+ env = { TERM = "alacritty-direct"; };
+ shell = {
+ program = "${pkgs.zsh}/bin/zsh";
+ args = [ "-l" ];
+ };
+ } // builtins.fromJSON (builtins.readFile ./alacritty/catppuccin-frappe.json);
+ };
+
+ programs.taskwarrior = {
+ enable = true;
+ package = "${pkgs.taskwarrior3}";
+ };
+}