all repos — nixfiles @ c1957e2eaee8067358144214869e2b3d7ed660f1

System and user configuration, managed by nix and home-manager

user/settings/fish.nix (view raw)

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
{
  config,
  pkgs,
  lib,
  ...
}:
let
  inherit (builtins) map;
  inherit (lib) getAttrs removePrefix;

  nixfiles = config.home.homeDirectory + "/projects/alin.ovh/nixfiles";
  direct_symlink = path: config.lib.file.mkOutOfStoreSymlink "${nixfiles}/${removePrefix "/" path}";
in
{
  home.shell.enableFishIntegration = true;
  programs.fish = {
    enable = true;
    plugins =
      map
        (getAttrs [
          "name"
          "src"
        ])
        (
          with pkgs.fishPlugins;
          [
            done
            fzf-fish
            fifc
            autopair
            colored-man-pages
            fishbang
            (tide.overrideAttrs {
              version = "7.0.2";
              src = pkgs.fetchFromGitHub {
                owner = "plttn";
                repo = "tide";
                hash = "sha256-e51L0JNNsGc3E7gY6udstFaDWg1V1OVWl9lMHFC+2MU=";
                rev = "a419157ff1ca4833dba74c27914cd8bb2a3c064b";
              };
            })
            {
              name = "ghq";
              src = pkgs.fetchFromGitHub {
                owner = "decors";
                repo = "fish-ghq";
                sha256 = "0cv7jpvdfdha4hrnjr887jv1pc6vcrxv2ahy7z6x562y7fd77gg9";
                # date = "2021-07-16T13:17:09+09:00";
                rev = "cafaaabe63c124bf0714f89ec715cfe9ece87fa2";
              };
            }
          ]
        );
    shellAliases = {
      hist-freq-lines = lib.mkForce "history | sort | uniq -c | sort -gr | head -n100 | less";
      hist-freq-commands = lib.mkForce "history | cut -d' ' -f 1 | sort | uniq -c | sort -gr | head -n100 | less";
    };
  };
  xdg.configFile."fish/completions" = {
    recursive = true;
    source = direct_symlink "/user/settings/fish/completions";
  };
  xdg.configFile."fish/functions" = {
    recursive = true;
    source = direct_symlink "/user/settings/fish/functions";
  };
  xdg.configFile."fish/per-term" = {
    recursive = true;
    source = direct_symlink "/user/settings/fish/per-term";
  };
  xdg.configFile."fish/conf.d/user_config.fish" = {
    source = direct_symlink "/user/settings/fish/config.fish";
  };

  programs.nix-your-shell = {
    enable = true;
    nix-output-monitor.enable = true;
    enableFishIntegration = true;
  };

  programs.vivid = {
    enable = !pkgs.stdenv.isDarwin;
    enableFishIntegration = true;
  };

  home.activation.tide-configure = ''
    run ${lib.getExe config.programs.fish.package} -c '
      tide configure \
        --auto \
        --style=Lean \
        --prompt_colors="16 colors" \
        --show_time="24-hour format" \
        --lean_prompt_height="Two lines" \
        --prompt_connection=Disconnected \
        --prompt_spacing=Compact \
        --icons="Few icons"
      '
  '';
}