aboutsummaryrefslogtreecommitdiffstats
path: root/home/fish/default.nix
blob: 08bb295f81aaac11af6d0413a35205b345e3ef55 (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
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, ... }:

{
  programs.fish = {
    enable = true;
    shellAliases = {
      browser = "${pkgs.chawan}/bin/cha";
      cat = "${pkgs.gat}/bin/gat";
      gmail = "${pkgs.himalaya}/himalaya envelope list --account gmail --folder gmail/Inbox 'not flag Seen'";
      grep = "${pkgs.ripgrep}/bin/rg";
      http = "${pkgs.xh}/bin/xh";
      journalctl = "${pkgs.systemd}/bin/journalctl --output=short-iso";
      l = "${pkgs.eza}/bin/eza -l --icons --git -a";
      llm = "${pkgs.tenere}/bin/tenere";
      ls = "${pkgs.eza}/bin/eza -a --group-directories-first";
      lt = "${pkgs.eza}/bin/eza --tree --level=2 --long --icons --git";
      relesoft = "${pkgs.himalaya}/himalaya envelope list --account relesoft --folder relesoft/Inbox 'not flag Seen'";
      ssh = "TERM=xterm-256color ${pkgs.openssh}/bin/ssh";
      stocks = "${pkgs.ticker}/bin/ticker --config /home/petri/.config/ticker/config.yaml";
      weather = "${pkgs.wthrr}/bin/wthrr --forecast d";
      wifi = "${pkgs.impala}/bin/impala";
      youtube = "${pkgs.pipe-viewer}/bin/pipe-viewer";
    };
    functions = {
      doc = ''
        ${pkgs.asciidoctor}/bin/asciidoctor --backend xhtml5 --out-file - "$argv[1]"|${pkgs.chawan}/bin/cha -T application/xhtml+xml
      '';
      bookmark = ''
        set -l Shiori_URL "https://shiori.tammi.cc"
        set -l Username "petri"
        set -l token (${pkgs.curl}/bin/curl -s -X POST -H "Content-Type: application/json" -d '{"username": "'$Username'", "password": "'$SHIORI_PASSWORD'", "remember": true}' $Shiori_URL/api/v1/auth/login | string match -r '(?<="token":")[^"]*')
        ${pkgs.curl}/bin/curl -s -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d '{ "url": "'$argv[1]'", "createArchive": true, "public": 1 }' $Shiori_URL/api/bookmarks
      '';
      share = ''
        ${pkgs.curl}/bin/curl -X PUT --data-binary @$argv[1] https://bin.tammi.cc >&2
      '';
      import = ''
        ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" $argv
      '';
      readdoc = "${pkgs.reader}/bin/reader $argv --markdown-output | ${pkgs.moar}/bin/moar --wrap --lang markdown";
      extract = ''
        		function extract
        	    switch $argv[1]
        	        case "*.tar.bz2"
        	            tar xjf $argv[1]

        	        case "*.tar.gz"
        	            tar xzf $argv[1]

        	        case "*.tar.xz"
        	            tar xJf $argv[1]

        	        case "*.bz2"
        	            bunzip2 $argv[1]

        	        case "*.rar"
        	            unrar e $argv[1]

        	        case "*.gz"
        	            gunzip $argv[1]

        	        case "*.tar"
        	            tar xf $argv[1]

        	        case "*.tbz2"
        	            tar xjf $argv[1]

        	        case "*.tgz"
        	            tar xzf $argv[1]

        	        case "*.zip"
        	            unzip $argv[1]

        	        case "*.Z"
        	            uncompress $argv[1]

        	        case "*.7z"
        	            7z x $argv[1]

        	        case "*"
        	            echo "unknown extension: $argv[1]"
        	    end
        		end
        		'';
    };
    interactiveShellInit = ''
      set -g fish_key_bindings fish_vi_key_bindings

      set -g __fish_git_prompt_show_informative_status 1

      set -g __fish_git_prompt_color_branch magenta --bold
      set -g __fish_git_prompt_showupstream "informative"
      set -g __fish_git_prompt_char_upstream_ahead "↑ "
      set -g __fish_git_prompt_char_upstream_behind "↓ "
      set -g __fish_git_prompt_char_upstream_prefix ""

      set -g __fish_git_prompt_char_stagedstate "● "
      set -g __fish_git_prompt_char_dirtystate "✚"
      set -g __fish_git_prompt_char_untrackedfiles "…"
      set -g __fish_git_prompt_char_conflictedstate "✖"
      set -g __fish_git_prompt_char_cleanstate "✔"

      set -g __fish_git_prompt_color_dirtystate blue
      set -g __fish_git_prompt_color_stagedstate yellow
      set -g __fish_git_prompt_color_invalidstate red
      set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
      set -g __fish_git_prompt_color_cleanstate green --bold

      ${pkgs.fastfetch}/bin/fastfetch
    '';
  };
}