all repos — nixfiles @ cdde72d8d808692b74d5ba9c12879dec001f9471

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

user/settings/fish.nix (view raw)

{
  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;
  home.packages = [ pkgs.fish-lsp ];
  programs.fish = {
    enable = true;
    plugins =
      map
        (getAttrs [
          "name"
          "src"
        ])
        (
          with pkgs.fishPlugins;
          [
            fzf-fish
            autopair
            fishbang
            hydro
            {
              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/conf.d/user_config.fish" = {
    source = direct_symlink "/user/settings/fish/config.fish";
  };

  programs.zed-editor.userSettings = {
    languages.Fish = {
      tab_size = 4;
      language_servers = [ "fish-lsp" ];
    };
    lsp.fish-lsp = {
      binary = {
        path = "fish-lsp";
        arguments = [ "start" ];
      };
    };
  };

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