aboutsummaryrefslogtreecommitdiffstats
path: root/users/hanna/configs/zsh/environment.nix
blob: a5bf8b96ef8d2b3a6ab000a21dbb3222ef2d0c1d (plain) (blame)
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
{ config, profile, pkgs, lib, ... }:

let
  xdg = {
    state = config.xdg.state.directory;
    data = config.xdg.data.directory;
    cache = config.xdg.cache.directory;
    config = config.xdg.config.directory;
  };
in {
  xdg.config.files."zsh/environment" = {
    executable = true;

    text = ''
      export EDITOR="hx"
      export COLORTERM="truecolor"

      export XDG_DATA_HOME="${xdg.data}"
      export XDG_STATE_HOME="${xdg.state}"
      export XDG_CONFIG_HOME="${xdg.config}"
      export XDG_CACHE_HOME="${xdg.cache}"

      export PATH="$PATH:${xdg.state}/nix/profile/bin"

      ${lib.optionalString (profile == "darwin") ''
        PATH="$PATH:/run/current-system/sw/bin:/opt/homebrew/bin"
      ''}

      ${lib.optionalString (profile == "wsl") ''
        hash -d host=/mnt/c/Users/Hanna
      ''}

      export CLAUDE_CONFIG_DIR="${xdg.config}/claude"
      export _JAVA_OPTIONS="-Djava.util.prefs.userRoot=${xdg.config}/java"
      export NPM_CONFIG_USERCONFIG="${xdg.config}/npm/npmrc"
      export NODE_REPL_HISTORY="${xdg.state}/node_history"
      export SQLITE_HISTORY="${xdg.state}/sqlite_history"
      export LESSHISTFILE="${xdg.state}/less_history"
      export PI_CODING_AGENT_DIR="${xdg.data}/pi"
      export CUDA_CACHE_PATH="${xdg.cache}/cuda"
      export RUSTUP_HOME="${xdg.data}/rustup"
      export CARGO_HOME="${xdg.data}/cargo"
      export GNUPGHOME="${xdg.data}/gnupg"
      export GOPATH="${xdg.data}/go"

      ${if profile != "darwin" then ''
        alias ls="${pkgs.lsr}/bin/lsr --hyperlinks=never"
        alias ll="${pkgs.lsr}/bin/lsr -l --hyperlinks=never"
        alias lla="${pkgs.lsr}/bin/lsr -la --hyperlinks=never"
      '' else ''
        alias ls="${pkgs.lsd}/bin/lsd --hyperlink never"
        alias ll="${pkgs.lsd}/bin/lsd -l --hyperlink never"
        alias lla="${pkgs.lsd}/bin/lsd -la --hyperlink never"
      ''}

      alias cat="${pkgs.bat}/bin/bat"
      alias gri="${pkgs.git}/bin/git rebase --interactive"
      alias gcr="${pkgs.git}/bin/git clone --recursive"
      alias gpa="${pkgs.git}/bin/git push --atomic"
      alias gco="${pkgs.git}/bin/git commit"
      alias grt="${pkgs.git}/bin/git remote"
      alias grb="${pkgs.git}/bin/git rebase"
      alias gst="${pkgs.git}/bin/git stash"
      alias gcl="${pkgs.git}/bin/git clone"
      alias grs="${pkgs.git}/bin/git reset"
      alias gpu="${pkgs.git}/bin/git push"
      alias gpl="${pkgs.git}/bin/git pull"
      alias gin="${pkgs.git}/bin/git init"
      alias gtg="${pkgs.git}/bin/git tag"

      setopt SHARE_HISTORY
      mkdir -p "${xdg.state}/zsh"
      HISTFILE="${xdg.state}/zsh/history"
      HISTSIZE=10000
      SAVEHIST=1000
    '';
  };
}