Skip to content

Commit

Permalink
Move cli's to their own dir
Browse files Browse the repository at this point in the history
  • Loading branch information
arunoruto committed Nov 7, 2024
1 parent b107773 commit 61ca521
Show file tree
Hide file tree
Showing 87 changed files with 3,778 additions and 0 deletions.
49 changes: 49 additions & 0 deletions modules/home-manager/server/cli/bat.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
config,
lib,
pkgs,
...
}:
let

shellAliases = {
cat = "bat -pp";
less = "bat --paging=always";
};
in
{
options.bat.enable = lib.mkEnableOption "Enable cat rust alternative";

config = lib.mkIf config.bat.enable {
programs = {
bat = {
enable = true;
config = {
#paging = "never";
#style = "plain";
# theme = "Monokai Extended";
#themes = "${catppuccin_bat}/Catppuccin-macchiato.tmTheme";
};
extraPackages = with pkgs.bat-extras; [
batdiff
batman
batgrep
batwatch
];
};

bash = lib.mkIf config.programs.bash.enable {
inherit shellAliases;
};
fish = lib.mkIf config.programs.fish.enable {
inherit shellAliases;
};
nushell = lib.mkIf config.programs.nushell.enable {
inherit shellAliases;
};
zsh = lib.mkIf config.programs.zsh.enable {
inherit shellAliases;
};
};
};
}
13 changes: 13 additions & 0 deletions modules/home-manager/server/cli/btop.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ pkgs, ... }:
{
programs.btop = {
enable = true;
};

home.file.".config/btop/themes/catppuccin".source = pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "btop";
rev = "1.0.0";
sha256 = "sha256-J3UezOQMDdxpflGax0rGBF/XMiKqdqZXuX4KMVGTxFk=";
};
}
30 changes: 30 additions & 0 deletions modules/home-manager/server/cli/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
lib,
...
}:
{
imports = [
# ./dprint
# ./nvim
./helix
./tmux
./bat.nix
# ./btop.nix
./editorconfig.nix
./fzf.nix
./misc.nix
./serpl.nix
./skim.nix
./yazi.nix
./zellij.nix
];

config = {
bat.enable = lib.mkDefault true;
helix.enable = lib.mkDefault true;
serpl.enable = lib.mkDefault true;
skim.enable = lib.mkDefault true;
yazi.enable = lib.mkDefault true;
zellij.enable = lib.mkDefault true;
};
}
20 changes: 20 additions & 0 deletions modules/home-manager/server/cli/editorconfig.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
editorconfig = {
enable = true;
settings = {
"*" = {
charset = "utf-8";
end_of_line = "lf";
trim_trailing_whitespace = true;
insert_final_newline = true;
#max_line_width = 78;
#indent_style = "space";
#indent_size = 4;
};
"*.nix" = {
indent_style = "space";
indent_size = 2;
};
};
};
}
46 changes: 46 additions & 0 deletions modules/home-manager/server/cli/fzf.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Some nice tips:
# https://pragmaticpineapple.com/four-useful-fzf-tricks-for-your-terminal/
{ config, ... }:
{
programs = {
fzf = {
enable = true;
enableBashIntegration = config.programs.bash.enable;
enableFishIntegration = config.programs.fish.enable;
enableZshIntegration = config.programs.zsh.enable;
};

zsh = {
sessionVariables = {
#FZF_DEFAULT_COMMAND = "fd --hidden --strip-cwd-prefix --exclude .git";
#FZF_CTRL_T_COMMAND = "$FZF_DEFAULT_COMMAND";
#FZF_ALT_C_COMMAND = "fd --type=d --hidden --strip-cwd-prefix --exclude .git";

# FZF_DEFAULT_OPTS = ''
# --color=bg+:#363a4f,bg:#24273a,spinner:#f4dbd6,hl:#ed8796 \
# --color=fg:#cad3f5,header:#ed8796,info:#c6a0f6,pointer:#f4dbd6 \
# --color=marker:#f4dbd6,fg+:#cad3f5,prompt:#c6a0f6,hl+:#ed8796
# '';

FZF_CTRL_T_OPTIONS = "--prview 'bat -n --color=always --line-range :500 {}'";
FZF_ALT_C_OPTIONS = "--prview 'lsd --tree --color=always {} | head -200'";
# FZF_ALT_C_OPTIONS = "--prview 'eza --tree --color=always {} | head -200'";
};

initExtra = ''
_fzf_comprun() {
local command=$1
shift
case "$command" in
# cd) fzf --preview 'eza --tree --level=2 --color=always {} | head -200' "$@" ;;
cd) fzf --preview "lsd --tree --depth=2 --color=always {} | head -200" "$@" ;;
export|unset) fzf --preview "'eval 'echo \$' {}" "$@" ;;
ssh) fzf --preview "dig {}" "$@" ;;
*) fzf --preview "bat -n --color=always --line-range :500 {}" "$@" ;;
esac
}
'';
};
};
}
26 changes: 26 additions & 0 deletions modules/home-manager/server/cli/helix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# poetry + pyright setup

When running `poetry shell`, pyright doesn't know where the venv is, which is currently in use.
To solve this problem, we need to configure poetry to create the venv in the current folder.
This is done by creating a `poetry.toml` file in the project with the following content:

```toml
[virtualenvs]
in-project = true
```

Now we need to tell pyright where the venv is.
With the settings above, poetry will create the venv in `.venv`.
So we need to add the following lines to the `pyproject.toml` file:

```toml
[tool.pyright]
venvPath = "."
venv = ".venv"
```

Now helix should have no problem finding the correct dependencies in your project!

Sources:

- [Pyright can't see Poetry dependencies](https://stackoverflow.com/questions/74510279/pyright-cant-see-poetry-dependencies)
54 changes: 54 additions & 0 deletions modules/home-manager/server/cli/helix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# https://github.com/helix-editor/helix/wiki/Migrating-from-Vim
{
config,
lib,
pkgs,
...
}:
{
imports = [
./keys.nix
./languages
];

options.helix.enable = lib.mkEnableOption "Enable the Helix editor";

config = lib.mkIf config.helix.enable {
programs = {
helix = {
enable = true;
package = pkgs.unstable.helix;
# package = pkgs.unstable.evil-helix;
settings = {
# theme = "catppuccin_macchiato";
# theme = "base16_transparent";
editor = {
true-color = true;
bufferline = "always";
line-number = "relative";
cursorline = true;
color-modes = true;
popup-border = "all";
indent-guides = {
render = true;
};
cursor-shape = {
normal = "block";
insert = "bar";
select = "underline";
};
# inline-diagnostics = {
# cursor-line = "hint";
# other-lines = "error";
# };
lsp.display-messages = true;
};
};
ignores = [
".build/"
];
};
# zsh.shellAliases.vim = "hx";
};
};
}
20 changes: 20 additions & 0 deletions modules/home-manager/server/cli/helix/keys.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
programs = {
helix.settings.keys = {
normal = {
space.W = [ ":toggle soft-wrap.enable" ];
space.X = [ ":buffer-close" ];
# space.b = {
# p = "buffer_picker";
# h = "goto_previous_buffer";
# l = "goto_next_buffer";
# x = ":buffer-close";
# };
};
};

tmux.extraConfig = ''
set -sg escape-time 10
'';
};
}
27 changes: 27 additions & 0 deletions modules/home-manager/server/cli/helix/languages/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# setup for multiple languages:
# https://freedium.cfd/https://alpha2phi.medium.com/helix-languages-7cf3263ed7c5
{
config,
lib,
...
}:
{
imports = [
./gpt.nix
./julia.nix
./matlab.nix
./markdown.nix
./markup.nix
./nix.nix
./python.nix
];

helix = {
julia.enable = lib.mkDefault (!config.tinypc.enable);
matlab.enable = lib.mkDefault (!config.tinypc.enable);
markdown.enable = lib.mkDefault (!config.tinypc.enable);
markup.enable = lib.mkDefault (!config.tinypc.enable);
nix.enable = lib.mkDefault true;
python.enable = lib.mkDefault (!config.tinypc.enable);
};
}
26 changes: 26 additions & 0 deletions modules/home-manager/server/cli/helix/languages/gpt.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ pkgs, ... }:
{
programs.helix = {
languages = {
# language = [
# {
# name = "python";
# language-servers = ["gpt"];
# }
# ];
language-server = {
gpt = {
command = "helix-gpt";
args = [
"--handler"
"copilot"
];
# args = ["--handler" "openai" "--openaiKey"];
};
};
};
extraPackages = with pkgs; [
helix-gpt
];
};
}
Loading

0 comments on commit 61ca521

Please sign in to comment.