Redo tide configuration
This commit is contained in:
parent
237e6afa33
commit
93d9e820db
|
@ -1,9 +1,9 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, options, pkgs, lib, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./tide/nix-shell.nix
|
./tide
|
||||||
];
|
];
|
||||||
|
|
||||||
options.programs.fish.everywhereAbbrs = mkOption {
|
options.programs.fish.everywhereAbbrs = mkOption {
|
||||||
|
@ -86,7 +86,9 @@ with lib;
|
||||||
|
|
||||||
|
|
||||||
tide = {
|
tide = {
|
||||||
nix-shell.enable = true;
|
enable = true;
|
||||||
|
leftItems = options.programs.fish.tide.leftItems.default;
|
||||||
|
rightItems = options.programs.fish.tide.rightItems.default;
|
||||||
};
|
};
|
||||||
|
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
|
@ -183,16 +185,6 @@ with lib;
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
plugins = [
|
plugins = [
|
||||||
{
|
|
||||||
name = "tide";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "IlanCosman";
|
|
||||||
repo = "tide";
|
|
||||||
rev = "v6.0.1";
|
|
||||||
# sha256 = lib.fakeSha256;
|
|
||||||
sha256 = "sha256-oLD7gYFCIeIzBeAW1j62z5FnzWAp3xSfxxe7kBtTLgA=";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
name = "fzf";
|
name = "fzf";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
|
|
82
home/fish/tide/default.nix
Normal file
82
home/fish/tide/default.nix
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.programs.fish.tide;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.programs.fish.tide = {
|
||||||
|
enable = mkEnableOption "Enable tide integrations for fish";
|
||||||
|
items = mkOption {
|
||||||
|
type = types.attrsOf types.str;
|
||||||
|
description = "Additional item definitions to create";
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
rightItems = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
description = "The list of right-items, note that `time` is not included here and will always appear last";
|
||||||
|
default = [
|
||||||
|
"status"
|
||||||
|
"cmd_duration"
|
||||||
|
"jobs"
|
||||||
|
"direnv"
|
||||||
|
"node"
|
||||||
|
"python"
|
||||||
|
"rustc"
|
||||||
|
"java"
|
||||||
|
"php"
|
||||||
|
"pulumi"
|
||||||
|
"ruby"
|
||||||
|
"go"
|
||||||
|
"gcloud"
|
||||||
|
"kubectl"
|
||||||
|
"distrobox"
|
||||||
|
"toolbox"
|
||||||
|
"terraform"
|
||||||
|
"aws"
|
||||||
|
"crystal"
|
||||||
|
"elixir"
|
||||||
|
"nix_shell"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
leftItems = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
description = "The list of left-items. Note that `newline` and `character` is not included here and will always appear last";
|
||||||
|
default = [ "os" "context" "pwd" "git" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config.programs.fish =
|
||||||
|
let
|
||||||
|
tideItems = attrsets.mapAttrs' (name: def: { name = "_tide_item_${name}"; value = def; });
|
||||||
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
|
functions = tideItems ({
|
||||||
|
nix_shell = ''
|
||||||
|
# In a Nix Shell
|
||||||
|
if test -f $DIRENV_FILE && rg -q "^use flake" $DIRENV_FILE
|
||||||
|
set -U tide_nix_shell_color "FFA500"
|
||||||
|
set -U tide_nix_shell_bg_color normal
|
||||||
|
_tide_print_item nix_shell "❄"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
} // cfg.items);
|
||||||
|
shellInit = ''
|
||||||
|
# Configure tide items
|
||||||
|
set -U tide_left_prompt_items ${concatMapStringsSep " " escapeShellArg cfg.leftItems} newline character
|
||||||
|
set -U tide_right_prompt_items ${concatMapStringsSep " " escapeShellArg cfg.rightItems} time
|
||||||
|
'';
|
||||||
|
plugins = [
|
||||||
|
{
|
||||||
|
name = "tide";
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "IlanCosman";
|
||||||
|
repo = "tide";
|
||||||
|
rev = "v6.0.1";
|
||||||
|
# sha256 = lib.fakeSha256;
|
||||||
|
sha256 = "sha256-oLD7gYFCIeIzBeAW1j62z5FnzWAp3xSfxxe7kBtTLgA=";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,22 +0,0 @@
|
||||||
{ config, pkgs, lib, ... }:
|
|
||||||
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.programs.fish.tide.nix-shell;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.programs.fish.tide.nix-shell = {
|
|
||||||
enable = mkEnableOption "An indicator of having a `nix shell` environment";
|
|
||||||
};
|
|
||||||
|
|
||||||
config.programs.fish = mkIf cfg.enable {
|
|
||||||
functions._tide_item_nix_shell = ''
|
|
||||||
# In a Nix Shell
|
|
||||||
if string match -q "/nix/store/*" $PATH
|
|
||||||
set -U tide_nix_shell_color (set -q DIRENV_DIR && echo "FFA500" || echo "blue")
|
|
||||||
set -U tide_nix_shell_bg_color normal
|
|
||||||
_tide_print_item nix_shell "❄"
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -44,14 +44,16 @@ in
|
||||||
set -gx EDITOR "kak"
|
set -gx EDITOR "kak"
|
||||||
alias e="kak"
|
alias e="kak"
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
_tide_item_kakoune = ''
|
programs.fish.tide = {
|
||||||
|
items.kakoune = ''
|
||||||
if set -q kak_session
|
if set -q kak_session
|
||||||
set -U tide_kakoune_color FFA500
|
set -U tide_kakoune_color FFA500
|
||||||
set -U tide_kakoune_bg_color normal
|
set -U tide_kakoune_bg_color normal
|
||||||
_tide_print_item kakoune " " "e[$kak_session]"
|
_tide_print_item kakoune " " "e[$kak_session]"
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
rightItems = mkAfter [ "kakoune" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue