summaryrefslogtreecommitdiff
path: root/home.nix
blob: 9e0ebbd3bd79ffb163093117a19c3eae8fc72d63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{ config, pkgs, lib, ... }:
let
  dotfiles = "${config.home.homeDirectory}/dots/";
  create_symlink = path: config.lib.file.mkOutOfStoreSymlink path;
  programs.home-manager.enable = true;
  configs = {
    nvim = "nvim";
    niri = "niri";
    foot = "foot";
    spectrwm = "spectrwm";
    qutebrowser = "qutebrowser";
    dunst = "dunst";
    waybar = "waybar";
    hypr = "hypr";
    rmpc = "rmpc";
    fastfetch = "fastfetch";
    mutt = "mutt";
    wezterm = "wezterm";
    mango = "mango";
    tmux = "tmux";
    polybar = "polybar";
    flameshot = "flameshot";
  };
in
{
  programs.bash = {
    enable = true;
    enableCompletion = true;
    historyControl = [ "ignoreboth" ];
    historyFile = "${config.home.homeDirectory}/.bash_history";
    historyIgnore = [
      "ls"
      "eza"
      "z"
      "cd"
    ];
    initExtra = ''
      bind -m vi-insert '"\C-l": clear-screen'
      bind -m vi-command '"\C-l": clear-screen'
      set -o vi
      eval "$(fzf --bash)"
      eval "$(zoxide init bash)"
      if [ "$TERM" != "dumb" ] || [ -n "$INSIDE_EMACS" ]; then
        PROMPT_COLOR="1;31m"
        ((UID)) && PROMPT_COLOR="1;34m"
        if [ -n "$INSIDE_EMACS" ]; then
          # Emacs term mode doesn't support xterm title escape sequence (\e]0;)
          PS1="\n\[\033[$PROMPT_COLOR\][\u@\h:\w]\\$\[\033[0m\] "
        else
          PS1="\n\[\033[$PROMPT_COLOR\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\\$\[\033[0m\] "
        fi
        if test "$TERM" = "xterm"; then
          PS1="\[\033]2;\h:\u:\w\007\]$PS1"
        fi
      fi
    '';
    shellAliases = {
      ls = "eza --icons";
      grep = "grep --color=auto";
      cd = "z";
      cat = "bat";
      ll = "eza --icons -lha";
      la = "eza --icons -a";
      trash = "trashy";
    };
  };
  home.username = "anand";
  home.homeDirectory = "/home/anand";
  home.stateVersion = "25.11"; # NEVER CHANGE THIS
  home.packages = [
      pkgs.mpv
      pkgs.dunst
      pkgs.fzf
      pkgs.nb
      pkgs.eza
      pkgs.yt-dlp
      pkgs.mpv
      pkgs.cmake
      pkgs.copyq
      pkgs.fastfetch
      pkgs.scrcpy
      pkgs.watch
      pkgs.progress
      pkgs.dysk
      pkgs.glow
      pkgs.termdown
      pkgs.hugo
      pkgs.pfetch
      pkgs.flameshot
      pkgs.grim
      pkgs.slurp
      pkgs.dmenu-wayland
  ];

  home.activation.dotfiles = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
    ln -sf ${config.home.homeDirectory}/dots/shell/zshrc ${config.home.homeDirectory}/.zshrc
    ln -sf ${config.home.homeDirectory}/dots/shell/bashrc ${config.home.homeDirectory}/.bashrc
    ln -sf ${config.home.homeDirectory}/dots/shell/profile ${config.home.homeDirectory}/.profile
    ln -sf ${config.home.homeDirectory}/dots/shell/bash_profile ${config.home.homeDirectory}/.bash_profile
    ln -sf ${config.home.homeDirectory}/dots/shell/starship.toml ${config.home.homeDirectory}/.config/starship.toml
    ln -sf ${config.home.homeDirectory}/dots/shell/Xresources ${config.home.homeDirectory}/.Xresources
  '';

  xdg.configFile = builtins.mapAttrs (name: subpath: {
    source = create_symlink "${dotfiles}/${subpath}";
    recursive = true;
  }) configs;

  home.sessionVariables = {
    EDITOR = "nvim";
  };
}