dotfiles

.config/home-manager/home.nix [raw] [blame]
  1{ config, pkgs, ... }:
  2
  3let
  4  packages = with pkgs; [
  5    # core
  6    aspell
  7    aspellDicts.en
  8    catgirl
  9    dig
 10    git
 11    graphviz
 12    htop
 13    ipcalc
 14    iperf
 15    jq
 16    lsof
 17    magic-wormhole
 18    mosh
 19    oci-cli
 20    openssl
 21    pdsh
 22    ranger
 23    rfc
 24    ripgrep
 25    silver-searcher
 26    sshfs
 27    tmux
 28    tree
 29    unzip
 30    watch
 31    wget
 32    whois
 33    wol
 34    zip
 35
 36    bash-language-server
 37    openscad-lsp
 38
 39    # python
 40    black
 41    isort
 42    poetry
 43    pyright
 44    python3
 45
 46    # golang
 47    go
 48    gopls
 49  ];
 50  guiPackages = with pkgs; [
 51    # core
 52    brightnessctl
 53    dunst
 54    feh
 55    font-awesome
 56    maim
 57    pulsemixer
 58    rofi
 59    source-code-pro
 60    xclip
 61    xdotool
 62    xsecurelock
 63
 64    # applications
 65    calibre
 66    ghostty
 67    ledger
 68    openscad-unstable
 69    vlc
 70    wireshark
 71  ];
 72
 73in
 74{
 75  home.username = "kyle";
 76  home.homeDirectory = (if pkgs.stdenv.isDarwin then "/Users/" else "/home/") + "kyle";
 77  home.stateVersion = "23.05";
 78  home.packages = packages ++ (pkgs.lib.lists.optionals pkgs.stdenv.isLinux guiPackages);
 79  home.sessionVariables = {
 80    MANPAGER = "nvim -n +Man!";
 81    PATH = "$HOME/.local/bin:$PATH";
 82    PYTHONSTARTUP = "$HOME/.pystartup";
 83  };
 84
 85  programs.fish = {
 86    enable = true;
 87    shellInit = if pkgs.stdenv.isDarwin then ''
 88      source /nix/var/nix/profiles/default/etc/profile.d/nix.fish
 89      source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.fish
 90    '' else "";
 91    interactiveShellInit = ''
 92      set fish_greeting
 93    '';
 94    shellAliases = {
 95      pbcopy = "xclip -selection clipboard";
 96      pbpaste = "xclip -selection clipboard -out";
 97      pbkey = "ssh-add -L | pbcopy";
 98      home = "env GIT_WORK_TREE=$HOME GIT_DIR=$HOME/.files.git";
 99    };
100    shellAbbrs = {
101      o = "open";
102      h = "home";
103
104      v = "nvim";
105      vim = "nvim";
106
107      g = "git";
108      gc = "git checkout";
109      gl = "git l";
110      gp = "git push";
111      gs = "git status";
112    };
113  };
114
115  programs.neovim = {
116    enable = true;
117    defaultEditor = true;
118    plugins = with pkgs.vimPlugins; [
119      # theme
120      jellybeans-vim
121
122      vim-sensible
123      plenary-nvim
124
125      # project
126      ack-vim
127      fzf-vim
128      nerdcommenter
129      nerdtree
130      telescope-nvim
131      vim-test
132      vimux
133
134      # git
135      vim-fubitive  # fugitive + bitbucket
136      vim-fugitive
137      vim-gitgutter
138      vim-rhubarb  # fugitive + github
139
140      # languages
141      nvim-jdtls
142      swift-vim
143      typescript-vim
144      vim-fish
145      vim-flake8
146      vim-gnupg
147      vim-ledger
148      vim-nix
149      vim-terraform
150      vim-toml
151
152      # lsp
153      nvim-lspconfig
154      nvim-cmp
155      cmp-buffer
156      cmp-nvim-lsp
157      vim-vsnip
158      cmp-vsnip
159
160      # treesitter
161      nvim-treesitter
162      nvim-treesitter-textobjects
163      nvim-treesitter-parsers.bash
164      nvim-treesitter-parsers.dockerfile
165      nvim-treesitter-parsers.go
166      nvim-treesitter-parsers.java
167      nvim-treesitter-parsers.lua
168      nvim-treesitter-parsers.make
169      nvim-treesitter-parsers.markdown
170      nvim-treesitter-parsers.markdown_inline
171      nvim-treesitter-parsers.python
172      nvim-treesitter-parsers.terraform
173      nvim-treesitter-parsers.toml
174    ];
175  };
176  programs.direnv.enable = true;
177  programs.direnv.nix-direnv.enable = true;
178  programs.home-manager.enable = true;
179
180  programs.firefox = {
181    enable = true;
182    profiles = {
183      default = {
184        settings = {
185          "browser.startup.homepage" = "https://start.duckduckgo.com";
186          "browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
187          "browser.newtabpage.activity-stream.feeds.topsites" = false;
188          "browser.newtabpage.activity-stream.feeds.section.topstories" = false;
189          "dom.security.https_only_mode" = true;
190          "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
191        };
192        search.default = "ddg";
193      };
194    };
195  };
196
197  programs.fzf = {
198    enable = true;
199    defaultCommand = "${pkgs.silver-searcher}/bin/ag -g \\\"\\\"";
200  };
201
202  services.sxhkd.enable = pkgs.stdenv.isLinux;
203  services.sxhkd.keybindings = {
204    "super + Return" = "${pkgs.ghostty}/bin/ghostty";
205    "super + b" = "${pkgs.firefox}/bin/firefox";
206    "super + shift + b" = "${pkgs.firefox}/bin/firefox --private-window";
207    "super + space" = "${pkgs.rofi}/bin/rofi -show combi";
208    "super + BackSpace" = "${pkgs.xsecurelock}/bin/xsecurelock";
209    "super + shift + @BackSpace" = "${pkgs.xsecurelock}/bin/xsecurelock -- systemctl suspend";
210    "super + s" = "${pkgs.maim}/bin/maim -s ~/Screenshots/$(date +%Y-%m-%d_%H-%M-%S).png";
211
212    "super + q" = "bspc node -c";
213
214    "super + {_, shift +} {1-9,0}" = "bspc {desktop -f,node -d} '^{1-9,10}'";
215    "super + {_,shift +} {Left,Down,Up,Right}" = "bspc node -{f,s} {west,south,north,east}";
216    "super + alt + {Left,Down,Up,Right}" = "bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}";
217    "super + Tab" = "bspc desktop -f last";
218
219    "super + grave" = "~/.local/bin/bspc-toggle --class scratch --run \"ghostty --x11-instance-name=scratch\"";
220    "super + Escape" = "~/.local/bin/bspc-toggle --class Toolkit";
221
222    "XF86MonBrightness{Down,Up}" = "${pkgs.brightnessctl}/bin/brightnessctl set {10%-,+10%}";
223    "XF86Audio{Lower,Raise}Volume" = "${pkgs.pamixer}/bin/pamixer -{d,i} 5";
224    "XF86AudioMute" = "${pkgs.pamixer}/bin/pamixer -t";
225    "XF86ScreenSaver" = "${pkgs.xsecurelock}/bin/xsecurelock";
226  };
227
228  services.polybar.enable = pkgs.stdenv.isLinux;
229  services.polybar.package = pkgs.polybar.override { pulseSupport = true; };
230  services.polybar.script = "polybar top &";
231
232  services.redshift = {
233    enable = pkgs.stdenv.isLinux;
234    provider = "manual";
235    latitude = "51.6";
236    longitude = "-0.1";
237  };
238}