summaryrefslogtreecommitdiff
path: root/home.nix
blob: 75a96e229ffbb87f60f23d8a6d4e51de49824de4 (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
{
  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";
    rmpc = "rmpc";
    fastfetch = "fastfetch";
    mutt = "mutt";
    wezterm = "wezterm";
    mango = "mango";
    tmux = "tmux";
    polybar = "polybar";
    flameshot = "flameshot";
  };
in
{
  programs.swaylock = {
    package = pkgs.swaylock-effects;
    enable = true;
    settings = {
      font-size = 24;
      indicator-idle-visible = false;
      show-failed-attempts = true;
    };
  };
  services.swayidle =
    let
      # Lock command
      lock = "${pkgs.swaylock}/bin/swaylock --daemonize --image /home/anand/dots/walls/lock.jpeg --clock";
      suspend = "systemctl suspend";
    in
    {
      enable = true;
      timeouts = [
        {
          timeout = 290; # in seconds
          command = "${pkgs.libnotify}/bin/notify-send 'Locking in 10 seconds' -t 10000";
        }
        {
          timeout = 300;
          command = lock;
        }
        {
          timeout = 800;
          command = "${pkgs.systemd}/bin/systemctl suspend";
        }
      ];
      events = [
        {
          event = "before-sleep";
          command = lock;
        }
      ];
    };
  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";
    };
  };
  home.username = "anand";
  home.homeDirectory = "/home/anand";
  home.stateVersion = "25.11"; # NEVER CHANGE THIS
  home.packages = with pkgs; [
    mpv
    dunst
    fzf
    nb
    eza
    yt-dlp
    mpv
    copyq
    fastfetch
    watch
    progress
    dysk
    glow
    termdown
    pfetch
    flameshot
    grim
    slurp
    dmenu-wayland
    lazysql
    lazygit
    ripgrep
    fd
    imv
    libreoffice
    godot
    mgba
    unrar
    chromium
    nil
    lua-language-server
  ];

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

  xdg.terminal-exec = {
    enable = true;
    settings = {
      default = [
        "org.wezfurlong.wezterm.desktop"
      ];
    };
  };

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

  gtk = {
    enable = true;
    iconTheme = {
      name = "Papirus-Dark";
      package = pkgs.papirus-icon-theme;
    };
    theme = lib.mkForce {
      name = "Nightfox-Dark";
      package = pkgs.nightfox-gtk-theme;
    };
  };

}