Remove the features directory
This commit is contained in:
parent
6585022138
commit
0f31678c52
57 changed files with 6 additions and 8 deletions
9
nix/modules/home-manager/cli/bin.nix
Normal file
9
nix/modules/home-manager/cli/bin.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ self, ... }:
|
||||
{
|
||||
home.sessionPath = [ "$HOME/bin" ];
|
||||
|
||||
home.file."bin" = {
|
||||
source = "${self}/bin";
|
||||
recursive = true;
|
||||
};
|
||||
}
|
36
nix/modules/home-manager/cli/bluetuith.nix
Normal file
36
nix/modules/home-manager/cli/bluetuith.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.homeManagerModules.bluetuith.enable = mkEnableOption "Enable bluetuith";
|
||||
|
||||
config = mkIf config.homeManagerModules.bluetuith.enable {
|
||||
home.packages = with pkgs; [
|
||||
bluetuith
|
||||
];
|
||||
|
||||
xdg.configFile."bluetuith/bluetuith.conf" = {
|
||||
text = ''
|
||||
{
|
||||
adapter: ""
|
||||
adapter-states: ""
|
||||
connect-bdaddr: ""
|
||||
gsm-apn: ""
|
||||
gsm-number: ""
|
||||
keybindings: {
|
||||
NavigateDown: j
|
||||
NavigateUp: k
|
||||
}
|
||||
receive-dir: ""
|
||||
theme: {}
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
19
nix/modules/home-manager/cli/default.nix
Normal file
19
nix/modules/home-manager/cli/default.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./bin.nix
|
||||
./bluetuith.nix
|
||||
./direnv.nix
|
||||
./fzf.nix
|
||||
./git.nix
|
||||
./neovim.nix
|
||||
./notes.nix
|
||||
./phpactor.nix
|
||||
./starship.nix
|
||||
./syncthing.nix
|
||||
./tmux.nix
|
||||
./tmux-sessionizer.nix
|
||||
./zsh.nix
|
||||
];
|
||||
}
|
18
nix/modules/home-manager/cli/direnv.nix
Normal file
18
nix/modules/home-manager/cli/direnv.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.homeManagerModules.direnv.enable = mkEnableOption "Enable direnv";
|
||||
|
||||
config = mkIf config.homeManagerModules.direnv.enable {
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
nix-direnv.enable = true;
|
||||
|
||||
silent = true;
|
||||
};
|
||||
};
|
||||
}
|
10
nix/modules/home-manager/cli/fzf.nix
Normal file
10
nix/modules/home-manager/cli/fzf.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
home.sessionVariables = {
|
||||
FZF_DEFAULT_OPTS = "--reverse";
|
||||
};
|
||||
}
|
152
nix/modules/home-manager/cli/git.nix
Normal file
152
nix/modules/home-manager/cli/git.nix
Normal file
|
@ -0,0 +1,152 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
home.file.".gitmessage".text = ''
|
||||
|
||||
|
||||
# Description
|
||||
#
|
||||
# - Why is this change necessary?
|
||||
# - How does it address the issue?
|
||||
# - What side effects does this change have?
|
||||
#
|
||||
# For breaking changes, uncomment the following line and describe the change:
|
||||
#
|
||||
# BREAKING CHANGE:
|
||||
#
|
||||
#
|
||||
# Add any issue IDs or commit SHAs that this commit references:
|
||||
#
|
||||
# Refs:
|
||||
|
||||
'';
|
||||
|
||||
programs = {
|
||||
git = {
|
||||
enable = true;
|
||||
userName = "Oliver Davies";
|
||||
userEmail = "oliver@oliverdavies.dev";
|
||||
|
||||
includes = [
|
||||
{
|
||||
condition = "gitdir:~/Code/tfw";
|
||||
contents.user.email = "oliver.davies@tfw.wales";
|
||||
}
|
||||
];
|
||||
|
||||
aliases = {
|
||||
aa = "add --all";
|
||||
assume = "update-index --assume-unchanged";
|
||||
assumed = "!git ls-files -v | grep '^[hsmrck?]' | cut -c 3-";
|
||||
b = "branch";
|
||||
blame = "blame -w -C -C -C";
|
||||
browse = "!gh repo view --web";
|
||||
ca = "commit --amend --verbose";
|
||||
car = "commit --amend --no-edit";
|
||||
cl = "!hub clone";
|
||||
co = "checkout";
|
||||
compare = "!hub compare";
|
||||
current-branch = "rev-parse --abbrev-ref HEAD";
|
||||
dc = "diff --color --word-diff --cached";
|
||||
df = "diff --color --word-diff";
|
||||
dup = "!git checkout develop && git fetch origin && echo && git sl develop..origin/develop && echo && git pull --quiet && git checkout -";
|
||||
fixup = "commit --fixup";
|
||||
issues = "!gh issue list --web";
|
||||
mup = "!git master-to-main-wrapper checkout %BRANCH% && git fetch origin && echo && git sl %BRANCH%..origin/%BRANCH% && echo && git pull --quiet && git checkout -";
|
||||
no-ff = "merge --no-ff";
|
||||
pl = "pull";
|
||||
prune = "remote prune origin";
|
||||
ps = "push";
|
||||
pulls = "!gh pr list --web";
|
||||
rbc = "rebase --continue";
|
||||
rdup = "!git dup && git rebase develop";
|
||||
remotes = "remote -v";
|
||||
repush = "!git pull --rebase && git push";
|
||||
ri = "rebase --interactive";
|
||||
rid = "!git rebase -i $(git merge-base develop HEAD)";
|
||||
rim = "!git rebase -i $(git master-to-main-wrapper merge-base %BRANCH% HEAD)";
|
||||
rip = "!git rebase -i $(git merge-base production HEAD)";
|
||||
ris = "!git rebase -i $(git merge-base staging HEAD)";
|
||||
riu = "!git rebase -i $(git rev-parse --abbrev-ref --symbolic-full-name @{u})";
|
||||
rmup = "!git mup && git master-to-main-wrapper rebase %BRANCH%";
|
||||
sl = "log --oneline --decorate -20";
|
||||
sla = "log --oneline --decorate --graph --all -20";
|
||||
slap = "log --oneline --decorate --graph --all";
|
||||
slp = "log --oneline --decorate";
|
||||
stash = "stash --included-untracked";
|
||||
unassume = "update-index --no-assume-unchanged";
|
||||
uncommit = "reset --soft HEAD^";
|
||||
unstage = "reset";
|
||||
update = "!git fetch --all --jobs=4 --prune --progress && git rebase --autostash --stat";
|
||||
upstream = "rev-parse --abbrev-ref --symbolic-full-name @{u}";
|
||||
ureset = "!git reset --hard $(git upstream)";
|
||||
worktrees = "worktree list";
|
||||
};
|
||||
|
||||
ignores = [
|
||||
"/.ddev/providers/"
|
||||
"/.direnv/"
|
||||
"/.ignored/"
|
||||
"/.issue-id"
|
||||
"/.phpactor.json"
|
||||
"/notes"
|
||||
"/todo"
|
||||
];
|
||||
|
||||
extraConfig = {
|
||||
branch = {
|
||||
autosetupmerge = true;
|
||||
autosetuprebase = "always";
|
||||
sort = "-committerdate";
|
||||
};
|
||||
|
||||
checkout.defaultRemote = "origin";
|
||||
color.ui = true;
|
||||
column.ui = "auto";
|
||||
commit.template = "~/.gitmessage";
|
||||
|
||||
core = {
|
||||
editor = "nvim";
|
||||
excludesFile = "~/.config/git/ignore";
|
||||
};
|
||||
|
||||
diff.tool = "vimdiff";
|
||||
fetch.prune = true;
|
||||
gpg.format = "ssh";
|
||||
grep.lineNumber = true;
|
||||
help.autocorrect = "1";
|
||||
init.defaultBranch = "main";
|
||||
|
||||
maintenance = {
|
||||
auto = false;
|
||||
strategy = "incremental";
|
||||
};
|
||||
|
||||
merge.ff = "only";
|
||||
|
||||
push = {
|
||||
autoSetupRemote = true;
|
||||
default = "upstream";
|
||||
};
|
||||
|
||||
pull = {
|
||||
ff = "only";
|
||||
rebase = true;
|
||||
};
|
||||
|
||||
rebase = {
|
||||
autosquash = true;
|
||||
autostash = true;
|
||||
};
|
||||
|
||||
user.signingkey = "~/.ssh/id_rsa.pub";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [ nixpkgs-2411.git-instafix ];
|
||||
|
||||
home.sessionVariables = {
|
||||
GIT_INSTAFIX_UPSTREAM = "origin/main";
|
||||
};
|
||||
}
|
193
nix/modules/home-manager/cli/neovim.nix
Normal file
193
nix/modules/home-manager/cli/neovim.nix
Normal file
|
@ -0,0 +1,193 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
php = pkgs.php82;
|
||||
phpPackages = pkgs.php82Packages;
|
||||
in
|
||||
{
|
||||
options.homeManagerModules.neovim.enable = mkEnableOption "Enable neovim";
|
||||
|
||||
config = mkIf config.homeManagerModules.neovim.enable {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
comment-nvim
|
||||
conf-vim
|
||||
edit-alternate-vim
|
||||
gitsigns-nvim
|
||||
harpoon2
|
||||
mini-nvim
|
||||
nvim-web-devicons
|
||||
oil-nvim
|
||||
phpactor
|
||||
refactoring-nvim
|
||||
standard-vim
|
||||
undotree
|
||||
vim-caser
|
||||
vim-nix
|
||||
vim-pasta
|
||||
vim-repeat
|
||||
vim-sleuth
|
||||
vim-textobj-indent
|
||||
vim-textobj-user
|
||||
vim-textobj-xmlattr
|
||||
vim-unimpaired
|
||||
|
||||
# Testing
|
||||
vim-test
|
||||
vimux
|
||||
|
||||
# Git
|
||||
vim-fugitive
|
||||
|
||||
# Debugging
|
||||
nvim-dap
|
||||
nvim-dap-ui
|
||||
nvim-dap-virtual-text
|
||||
|
||||
# Treesitter
|
||||
(pkgs.vimPlugins.nvim-treesitter.withPlugins (
|
||||
plugins: with plugins; [
|
||||
bash
|
||||
comment
|
||||
css
|
||||
csv
|
||||
dockerfile
|
||||
gitattributes
|
||||
gitignore
|
||||
go
|
||||
html
|
||||
javascript
|
||||
json
|
||||
kdl
|
||||
lua
|
||||
luadoc
|
||||
make
|
||||
markdown
|
||||
markdown_inline
|
||||
nix
|
||||
php
|
||||
phpdoc
|
||||
query
|
||||
rst
|
||||
scss
|
||||
sql
|
||||
terraform
|
||||
twig
|
||||
typescript
|
||||
vim
|
||||
vimdoc
|
||||
vue
|
||||
xml
|
||||
yaml
|
||||
]
|
||||
))
|
||||
nvim-treesitter-textobjects
|
||||
|
||||
# LSP, linting and formatting
|
||||
conform-nvim
|
||||
lsp-status-nvim
|
||||
nvim-lint
|
||||
nvim-lspconfig
|
||||
|
||||
# Completion
|
||||
cmp-buffer
|
||||
cmp-calc
|
||||
cmp-cmdline
|
||||
cmp-nvim-lsp
|
||||
cmp-path
|
||||
cmp-treesitter
|
||||
cmp_luasnip
|
||||
lspkind-nvim
|
||||
nvim-cmp
|
||||
|
||||
# Snippets
|
||||
friendly-snippets
|
||||
luasnip
|
||||
|
||||
# Telescope
|
||||
plenary-nvim
|
||||
popup-nvim
|
||||
telescope-frecency-nvim
|
||||
telescope-fzf-native-nvim
|
||||
telescope-live-grep-args-nvim
|
||||
telescope-nvim
|
||||
telescope-ui-select-nvim
|
||||
|
||||
# Databases
|
||||
vim-dadbod
|
||||
vim-dadbod-ui
|
||||
vim-dadbod-completion
|
||||
|
||||
# Themes
|
||||
catppuccin-nvim
|
||||
];
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
# Languages
|
||||
nodePackages.typescript
|
||||
nodejs-slim
|
||||
php
|
||||
|
||||
# Language servers
|
||||
gopls
|
||||
lua-language-server
|
||||
lua54Packages.luacheck
|
||||
marksman
|
||||
nixd
|
||||
nodePackages."@tailwindcss/language-server"
|
||||
nodePackages.bash-language-server
|
||||
nodePackages.dockerfile-language-server-nodejs
|
||||
nodePackages.typescript-language-server
|
||||
nodePackages.vscode-langservers-extracted
|
||||
nodePackages.yaml-language-server
|
||||
phpactor
|
||||
terraform-ls
|
||||
vue-language-server
|
||||
|
||||
# Formatters
|
||||
black
|
||||
eslint_d
|
||||
nixfmt-rfc-style
|
||||
nodePackages.prettier
|
||||
stylua
|
||||
yamlfmt
|
||||
|
||||
# Tools
|
||||
hadolint
|
||||
html-tidy
|
||||
nodePackages.jsonlint
|
||||
nodePackages.markdownlint-cli
|
||||
phpPackages.php-codesniffer
|
||||
phpPackages.phpstan
|
||||
proselint
|
||||
ripgrep
|
||||
shellcheck
|
||||
yamllint
|
||||
];
|
||||
};
|
||||
|
||||
xdg.configFile.nvim = {
|
||||
source = "${self}/nvim";
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
home.file.".markdownlint.yaml".text = ''
|
||||
default: true
|
||||
|
||||
line-length: false
|
||||
|
||||
no-duplicate-heading:
|
||||
siblings_only: true
|
||||
'';
|
||||
};
|
||||
}
|
32
nix/modules/home-manager/cli/notes.nix
Normal file
32
nix/modules/home-manager/cli/notes.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.homeManagerModules.notes;
|
||||
in
|
||||
{
|
||||
options.homeManagerModules.notes = {
|
||||
enable = mkEnableOption "Enable notes";
|
||||
|
||||
directory = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home = {
|
||||
packages = with pkgs; [ notes ];
|
||||
|
||||
sessionVariables = {
|
||||
NOTES_DIRECTORY = "${cfg.directory}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
7
nix/modules/home-manager/cli/phpactor.nix
Normal file
7
nix/modules/home-manager/cli/phpactor.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ self, ... }:
|
||||
{
|
||||
xdg.configFile.phpactor = {
|
||||
source = "${self}/phpactor";
|
||||
recursive = true;
|
||||
};
|
||||
}
|
175
nix/modules/home-manager/cli/starship.nix
Normal file
175
nix/modules/home-manager/cli/starship.nix
Normal file
|
@ -0,0 +1,175 @@
|
|||
let
|
||||
inherit (builtins) concatStringsSep;
|
||||
in
|
||||
{
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
|
||||
settings = {
|
||||
add_newline = false;
|
||||
|
||||
# https://starship.rs/config/#prompt
|
||||
format = concatStringsSep "" [
|
||||
"\n"
|
||||
"$username"
|
||||
"$hostname"
|
||||
"$directory"
|
||||
"$vcsh"
|
||||
"$git_branch"
|
||||
"$git_status"
|
||||
"$git_metrics"
|
||||
"$docker_context"
|
||||
"$nodejs"
|
||||
"$php"
|
||||
"$terraform"
|
||||
"$nix_shell"
|
||||
"$direnv"
|
||||
"\${custom.mob}"
|
||||
"$memory_usage"
|
||||
"$cmd_duration"
|
||||
"$lua"
|
||||
"$status"
|
||||
"$character"
|
||||
];
|
||||
|
||||
cmd_duration.disabled = true;
|
||||
direnv.disabled = false;
|
||||
directory.format = "[$path]($style) ";
|
||||
git_status.disabled = true;
|
||||
nix_shell.disabled = true;
|
||||
nodejs.disabled = true;
|
||||
php.disabled = true;
|
||||
username.disabled = true;
|
||||
|
||||
custom = {
|
||||
mob = {
|
||||
command = "echo $MOB_TIMER_ROOM";
|
||||
format = "[($output)]($style) ";
|
||||
when = "[[ -v MOB_TIMER_ROOM ]]";
|
||||
};
|
||||
};
|
||||
|
||||
# https://starship.rs/presets/plain-text
|
||||
aws.symbol = "aws ";
|
||||
azure.symbol = "az ";
|
||||
bun.symbol = "bun ";
|
||||
c.symbol = "C ";
|
||||
character = {
|
||||
success_symbol = "[>](bold green)";
|
||||
error_symbol = "[x](bold red)";
|
||||
vimcmd_symbol = "[<](bold green)";
|
||||
};
|
||||
cobol.symbol = "cobol ";
|
||||
conda.symbol = "conda ";
|
||||
crystal.symbol = "cr ";
|
||||
cmake.symbol = "cmake ";
|
||||
daml.symbol = "daml ";
|
||||
dart.symbol = "dart ";
|
||||
deno.symbol = "deno ";
|
||||
dotnet.symbol = ".NET ";
|
||||
directory.read_only = " ro";
|
||||
docker_context.symbol = "docker ";
|
||||
elixir.symbol = "exs ";
|
||||
elm.symbol = "elm ";
|
||||
fennel.symbol = "fnl ";
|
||||
fossil_branch.symbol = "fossil ";
|
||||
gcloud.symbol = "gcp ";
|
||||
git_branch.symbol = "git ";
|
||||
git_commit.tag_symbol = " tag ";
|
||||
git_status = {
|
||||
ahead = ">";
|
||||
behind = "<";
|
||||
diverged = "<>";
|
||||
renamed = "r";
|
||||
deleted = "x";
|
||||
};
|
||||
gleam.symbol = "gleam ";
|
||||
golang.symbol = "go ";
|
||||
gradle.symbol = "gradle ";
|
||||
guix_shell.symbol = "guix ";
|
||||
hg_branch.symbol = "hg ";
|
||||
java.symbol = "java ";
|
||||
julia.symbol = "jl ";
|
||||
kotlin.symbol = "kt ";
|
||||
lua.symbol = "lua ";
|
||||
nodejs.symbol = "nodejs ";
|
||||
memory_usage.symbol = "memory ";
|
||||
meson.symbol = "meson ";
|
||||
nats.symbol = "nats ";
|
||||
nim.symbol = "nim ";
|
||||
nix_shell.symbol = "nix ";
|
||||
ocaml.symbol = "ml ";
|
||||
opa.symbol = "opa ";
|
||||
os.symbols = {
|
||||
AIX = "aix ";
|
||||
Alpaquita = "alq ";
|
||||
AlmaLinux = "alma ";
|
||||
Alpine = "alp ";
|
||||
Amazon = "amz ";
|
||||
Android = "andr ";
|
||||
Arch = "rch ";
|
||||
Artix = "atx ";
|
||||
CentOS = "cent ";
|
||||
Debian = "deb ";
|
||||
DragonFly = "dfbsd ";
|
||||
Emscripten = "emsc ";
|
||||
EndeavourOS = "ndev ";
|
||||
Fedora = "fed ";
|
||||
FreeBSD = "fbsd ";
|
||||
Garuda = "garu ";
|
||||
Gentoo = "gent ";
|
||||
HardenedBSD = "hbsd ";
|
||||
Illumos = "lum ";
|
||||
Kali = "kali ";
|
||||
Linux = "lnx ";
|
||||
Mabox = "mbox ";
|
||||
Macos = "mac ";
|
||||
Manjaro = "mjo ";
|
||||
Mariner = "mrn ";
|
||||
MidnightBSD = "mid ";
|
||||
Mint = "mint ";
|
||||
NetBSD = "nbsd ";
|
||||
NixOS = "nix ";
|
||||
OpenBSD = "obsd ";
|
||||
OpenCloudOS = "ocos ";
|
||||
openEuler = "oeul ";
|
||||
openSUSE = "osuse ";
|
||||
OracleLinux = "orac ";
|
||||
Pop = "pop ";
|
||||
Raspbian = "rasp ";
|
||||
Redhat = "rhl ";
|
||||
RedHatEnterprise = "rhel ";
|
||||
RockyLinux = "rky ";
|
||||
Redox = "redox ";
|
||||
Solus = "sol ";
|
||||
SUSE = "suse ";
|
||||
Ubuntu = "ubnt ";
|
||||
Ultramarine = "ultm ";
|
||||
Unknown = "unk ";
|
||||
Void = "void ";
|
||||
Windows = "win ";
|
||||
};
|
||||
package.symbol = "pkg ";
|
||||
perl.symbol = "pl ";
|
||||
php.symbol = "php ";
|
||||
pijul_channel.symbol = "pijul ";
|
||||
pulumi.symbol = "pulumi ";
|
||||
purescript.symbol = "purs ";
|
||||
python.symbol = "py ";
|
||||
quarto.symbol = "quarto ";
|
||||
raku.symbol = "raku ";
|
||||
ruby.symbol = "rb ";
|
||||
rust.symbol = "rs ";
|
||||
scala.symbol = "scala ";
|
||||
spack.symbol = "spack ";
|
||||
solidity.symbol = "solidity ";
|
||||
status.symbol = "[x](bold red) ";
|
||||
sudo.symbol = "sudo ";
|
||||
swift.symbol = "swift ";
|
||||
typst.symbol = "typst ";
|
||||
terraform.symbol = "terraform ";
|
||||
zig.symbol = "zig ";
|
||||
};
|
||||
};
|
||||
}
|
14
nix/modules/home-manager/cli/syncthing.nix
Normal file
14
nix/modules/home-manager/cli/syncthing.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.homeManagerModules.syncthing;
|
||||
in
|
||||
{
|
||||
options.homeManagerModules.syncthing.enable = mkEnableOption "Enable syncthing";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.syncthing.enable = true;
|
||||
};
|
||||
}
|
41
nix/modules/home-manager/cli/tmux-sessionizer.nix
Normal file
41
nix/modules/home-manager/cli/tmux-sessionizer.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.homeManagerModules.tmux-sessionizer.enable = mkEnableOption "Enable tmux-sessionizer";
|
||||
|
||||
config = mkIf config.homeManagerModules.tmux-sessionizer.enable {
|
||||
home.packages = with pkgs; [ tmux-sessionizer ];
|
||||
|
||||
home.file.".tmux-sessionizer".source = "${
|
||||
pkgs.writeShellApplication {
|
||||
name = ".tmux-sessionizer";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
tmux
|
||||
];
|
||||
|
||||
text = ''
|
||||
set +o errexit
|
||||
set +o nounset
|
||||
|
||||
if [[ "$PWD" == "$REPOS/os" || "$PWD" == "$REPOS/personal" ]]; then
|
||||
clear
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
tmux new-window -d -n shell
|
||||
nvim
|
||||
clear
|
||||
'';
|
||||
}
|
||||
}/bin/.tmux-sessionizer";
|
||||
};
|
||||
}
|
90
nix/modules/home-manager/cli/tmux.nix
Normal file
90
nix/modules/home-manager/cli/tmux.nix
Normal file
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
inherit (pkgs) tmuxPlugins;
|
||||
in
|
||||
{
|
||||
options.homeManagerModules.tmux.enable = mkEnableOption "Enable tmux";
|
||||
|
||||
config = mkIf config.homeManagerModules.tmux.enable {
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
|
||||
terminal = "tmux-256color";
|
||||
|
||||
extraConfig = ''
|
||||
set-option -g status-keys "vi"
|
||||
set-option -sa terminal-features "''${TERM}:RGB"
|
||||
|
||||
bind -n S-Left resize-pane -L 2
|
||||
bind -n S-Right resize-pane -R 2
|
||||
bind -n S-Down resize-pane -D 1
|
||||
bind -n S-Up resize-pane -U 1
|
||||
|
||||
bind -n C-Left resize-pane -L 10
|
||||
bind -n C-Right resize-pane -R 10
|
||||
bind -n C-Down resize-pane -D 5
|
||||
bind -n C-Up resize-pane -U 5
|
||||
|
||||
# Status line customisation
|
||||
set-option -g status-left ""
|
||||
set-option -g status-right " #{session_name}"
|
||||
set-option -g status-right-length 100
|
||||
set-option -g status-style "fg=#7C7D83 bg=default"
|
||||
set-option -g window-status-activity-style none
|
||||
set-option -g window-status-current-style "fg=#E9E9EA"
|
||||
|
||||
bind c new-window -c "#{pane_current_path}"
|
||||
|
||||
set -g base-index 1
|
||||
set -g pane-base-index 1
|
||||
set -g renumber-windows on
|
||||
|
||||
# Break a pane into a new window.
|
||||
bind-key b break-pane -d
|
||||
bind-key J command-prompt -p "join pane from: " "join-pane -h -s '%%'"
|
||||
|
||||
bind-key C-j choose-tree
|
||||
|
||||
set-window-option -g mode-keys vi
|
||||
bind -T copy-mode-vi v send-keys -X begin-selection
|
||||
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
|
||||
|
||||
bind C-j split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v \"^$(tmux display-message -p '#S')\$\" | fzf --reverse | xargs tmux switch-client -t"
|
||||
|
||||
bind-key K run-shell 'tmux switch-client -n \; kill-session -t "$(tmux display-message -p "#S")" || tmux kill-session'
|
||||
|
||||
# Allow clearing screen with ctrl-l by using <prefix> C-l
|
||||
bind C-l send-keys "C-l"
|
||||
bind C-k send-keys "C-k"
|
||||
|
||||
# Enable mouse support.
|
||||
setw -g mouse on
|
||||
|
||||
# Remove delay when switching Vim modes.
|
||||
set -sg escape-time 0
|
||||
|
||||
set-option -g pane-active-border-style "fg=#1f2335"
|
||||
set-option -g pane-border-style "fg=#1f2335"
|
||||
|
||||
bind-key -r f run-shell "tmux new-window tmux-sessionizer"
|
||||
|
||||
bind-key -r N split-window -h "notes"
|
||||
bind-key -r T split-window -h -c ~/Documents/wiki "nvim todo.txt"
|
||||
bind-key -r W split-window -h -c ~/Documents/wiki "nvim '+Telescope find_files'"
|
||||
'';
|
||||
|
||||
plugins = [
|
||||
tmuxPlugins.vim-tmux-navigator
|
||||
tmuxPlugins.yank
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
89
nix/modules/home-manager/cli/zsh.nix
Normal file
89
nix/modules/home-manager/cli/zsh.nix
Normal file
|
@ -0,0 +1,89 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
zsh-abbr = {
|
||||
enable = true;
|
||||
|
||||
abbreviations = import ./zsh/abbreviations.nix;
|
||||
};
|
||||
|
||||
cdpath = [ "~/Code" ];
|
||||
dotDir = ".config/zsh";
|
||||
|
||||
shellAliases = (import ./zsh/aliases.nix);
|
||||
|
||||
localVariables = {
|
||||
ABBR_SET_EXPANSION_CURSOR = 1;
|
||||
};
|
||||
|
||||
initExtra = ''
|
||||
if [[ -z "$DISPLAY" ]] && [[ "$(tty)" == "/dev/tty1" ]]; then
|
||||
exec startx &>/dev/null
|
||||
fi
|
||||
|
||||
# suffix
|
||||
alias -s gz="tar -tf"
|
||||
alias -s {html,HTML}="background firefox"
|
||||
alias -s {jpg,JPG,png,PNG}="background okular"
|
||||
alias -s {pdf,PDF}="background okular"
|
||||
alias -s {zip,ZIP}="unzip -l"
|
||||
|
||||
git() {
|
||||
case "$1" in
|
||||
clone)
|
||||
shift
|
||||
|
||||
local repo_url="$1"
|
||||
local repo_path="''${2:-}"
|
||||
|
||||
if [ -n "$TARGET_DIR" ]; then
|
||||
command git clone "$repo_url" "$repo_path"
|
||||
else
|
||||
command git clone "$repo_url"
|
||||
repo_path=$(basename "$repo_url" .git)
|
||||
fi
|
||||
|
||||
${pkgs.tmux-sessionizer}/bin/tmux-sessionizer "$repo_path"
|
||||
;;
|
||||
|
||||
root)
|
||||
shift
|
||||
|
||||
local ROOT="$(${pkgs.git}/bin/git rev-parse --show-toplevel 2> /dev/null || echo -n .)"
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
cd "''${ROOT}"
|
||||
else
|
||||
(cd "''${ROOT}" && eval "''${@}")
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
${pkgs.git}/bin/git "''${@}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
ttyper() {
|
||||
command ${pkgs.ttyper}/bin/ttyper --language english1000 --words 50 "''${@}"
|
||||
}
|
||||
|
||||
yt-dlp() {
|
||||
command yt-dlp --paths ~/Videos "$@"
|
||||
}
|
||||
|
||||
bindkey -s ^f "tmux-sessionizer\n"
|
||||
bindkey -s ^v "nvim\n"
|
||||
|
||||
setopt auto_cd
|
||||
setopt auto_pushd
|
||||
setopt pushd_ignore_dups
|
||||
setopt pushdminus
|
||||
'';
|
||||
};
|
||||
}
|
151
nix/modules/home-manager/cli/zsh/abbreviations.nix
Normal file
151
nix/modules/home-manager/cli/zsh/abbreviations.nix
Normal file
|
@ -0,0 +1,151 @@
|
|||
{
|
||||
cl = "clear";
|
||||
cs = "create-script";
|
||||
daily = "run create-daily next";
|
||||
rst = "rst2pdf";
|
||||
st = "source .tmux";
|
||||
sz = "source ~/.config/zsh/.zshrc";
|
||||
ti = "timer";
|
||||
uagr = "update-all-git-repos";
|
||||
v = "nvim";
|
||||
yt = "yt-dlp";
|
||||
|
||||
evl = "export-video-list";
|
||||
vv = "cat ~/Documents/videos.json";
|
||||
|
||||
g = "git";
|
||||
ga = "git add";
|
||||
gan = "git add -N";
|
||||
gap = "git add -p";
|
||||
gb = "git branch";
|
||||
gbl = "git blame";
|
||||
gc = "git commit";
|
||||
gca = "git commit --amend";
|
||||
gcan = "git commit --amend --no-edit";
|
||||
gcl = "git clone";
|
||||
gcm = "git commit -m";
|
||||
gco = "git checkout";
|
||||
gcob = "git checkout -b";
|
||||
gd = "git diff";
|
||||
gds = "git diff --staged";
|
||||
gf = "git fetch";
|
||||
gfa = "git fetch --all";
|
||||
gl = "git log";
|
||||
glo = "git log --oneline";
|
||||
gls = "git log --stat";
|
||||
gm = "git merge";
|
||||
gmf = "git merge --ff";
|
||||
gmnf = "git merge --no-ff";
|
||||
gp = "git push";
|
||||
gpa = "git push acquia";
|
||||
gpam = "git push acquia main";
|
||||
gpap = "git push acquia HEAD:production";
|
||||
gpl = "git pull";
|
||||
gplr = "git pull --rebase";
|
||||
gpo = "git push origin";
|
||||
gpom = "git push origin main";
|
||||
gr = "git rebase";
|
||||
gra = "git rebase --abort";
|
||||
grc = "git rebase --continue";
|
||||
gri = "git rebase -i";
|
||||
gs = "git status";
|
||||
gsh = "git show";
|
||||
gst = "git stash";
|
||||
gstp = "git stash pop";
|
||||
|
||||
# tmux
|
||||
ta = "tmux attach";
|
||||
tl = "tmux list-sessions";
|
||||
tk = "tmux kill-session";
|
||||
|
||||
# Docker and Docker Compose.
|
||||
dk = "docker";
|
||||
dkp = "docker ps";
|
||||
dkpa = "docker ps -a";
|
||||
dkpaq = "docker ps -a -q";
|
||||
dkb = "docker build -t";
|
||||
dks = "docker start";
|
||||
dkt = "docker stop";
|
||||
dkrm = "docker rm";
|
||||
dkri = "docker rmi";
|
||||
dke = "docker exec -ti";
|
||||
dkl = "docker logs -f";
|
||||
dki = "docker images";
|
||||
dkpu = "docker pull";
|
||||
dkph = "docker push";
|
||||
dkbnc = "docker build --no-cache -t";
|
||||
dkr = "docker run --rm";
|
||||
dkrti = "docker run --rm -ti";
|
||||
dkc = "docker compose";
|
||||
dkcb = "docker compose build";
|
||||
dkcu = "docker compose up";
|
||||
dkclean = "docker ps -q -a -f status=exited | xargs -r docker rm && docker images -q -f dangling=true | xargs -r docker rmi";
|
||||
|
||||
# Nix and direnv.
|
||||
dea = "direnv allow";
|
||||
dee = "direnv edit";
|
||||
nxf = "nix flake";
|
||||
nxfc = "nix flake check";
|
||||
nxfs = "nix flake show";
|
||||
nxfu = "nix flake update";
|
||||
nxr = "nix run nixpkgs#%";
|
||||
nxs = "nix shell nixpkgs#%";
|
||||
|
||||
# run scripts.
|
||||
r = "run";
|
||||
rc = "run composer";
|
||||
rcda = "run composer dump-autoload";
|
||||
rci = "run composer install";
|
||||
rcr = "run composer require";
|
||||
rcu = "run composer update";
|
||||
rd = "run drush";
|
||||
rdce = "run drush config:export -y";
|
||||
rdci = "run drush config:import -y";
|
||||
rdcr = "run drush cache:rebuild";
|
||||
rdscr = "run drush php:script";
|
||||
rduli = "run drush uli";
|
||||
rdup = "run drush updatedb -y";
|
||||
rpub = "run publish";
|
||||
rt = "run test";
|
||||
|
||||
"-g A1" = "| awk '{print $1}'";
|
||||
"-g C" = "| xclip -sel clip";
|
||||
"-g Fj" = "| jq .";
|
||||
"-g Fy" = "| yq .";
|
||||
"-g G" = "| grep";
|
||||
"-g GH" = "| grep HTTP";
|
||||
"-g Gi" = "| grep -i";
|
||||
"-g H2" = "| head -n 20";
|
||||
"-g H" = "| head";
|
||||
"-g L" = "| less";
|
||||
"-g V" = "| nvim -";
|
||||
"-g X" = "| xargs -I1";
|
||||
|
||||
nah = "git reset --hard; git clean -fd";
|
||||
wip = "git commit -m wip";
|
||||
|
||||
dv = "devenv";
|
||||
dvi = "devenv info";
|
||||
dvp = "devenv processes";
|
||||
dvs = "devenv shell";
|
||||
dvt = "devenv tasks";
|
||||
dvu = "devenv up";
|
||||
|
||||
c = "composer";
|
||||
cr = "composer require";
|
||||
crd = "composer require drupal/%";
|
||||
cu = "composer update";
|
||||
cul = "composer update --lock";
|
||||
cw = "composer why";
|
||||
cwn = "composer why-not";
|
||||
|
||||
d = "drush";
|
||||
dce = "drush config:export -y";
|
||||
dci = "drush config:import -y";
|
||||
dcr = "drush cache:rebuild";
|
||||
den = "drush pm:enable -y";
|
||||
deu = "drush pm:uninstall";
|
||||
dscr = "drush php:script";
|
||||
duli = "drush uli";
|
||||
dup = "drush updatedb -y";
|
||||
}
|
13
nix/modules/home-manager/cli/zsh/aliases.nix
Normal file
13
nix/modules/home-manager/cli/zsh/aliases.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"$" = "";
|
||||
"-" = "cd -";
|
||||
".." = "cd ..";
|
||||
"..." = "cd ../..";
|
||||
"...." = "cd ../../..";
|
||||
"....." = "cd ../../../..";
|
||||
s = "secrets";
|
||||
secrets = ''doppler --project "$(whoami)" run'';
|
||||
tag = "tag-release";
|
||||
vss = "LC_ALL=C sort --unique $REPOS/dotfiles/nvim/spell/en.utf-8.add --output $REPOS/dotfiles/nvim/spell/en.utf-8.add";
|
||||
wt = "git worktree";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue