Move zsh configuration
All checks were successful
/ check (push) Successful in 1m38s

This commit is contained in:
Oliver Davies 2025-07-28 02:34:00 +01:00
parent cff83d9373
commit 556de5e482
23 changed files with 234 additions and 285 deletions

View file

@ -48,8 +48,6 @@
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
flake = {
homeManagerModules.default = import ./modules/home-manager;
nixosModules.default = import ./modules/nixos;
overlays = import ./overlays { inherit inputs; };

View file

@ -1,7 +0,0 @@
{ outputs, ... }:
{
imports = [
outputs.homeManagerModules.default
];
}

View file

@ -1,14 +1,6 @@
{ pkgs, ... }:
{
imports = [ ../common ];
features = {
cli = {
zsh.enable = true;
};
};
home.packages = with pkgs; [
count-tags
create-script

View file

@ -1,7 +1 @@
{
imports = [ ../common ];
features = {
cli.zsh.enable = true;
};
}
{ }

View file

@ -2,15 +2,9 @@
{
imports = [
../common
./nixedo/email-filters.nix
];
features.cli = {
zsh.enable = true;
};
home.packages = with pkgs; [
import-to-jellyfin
vix

View file

@ -2,16 +2,9 @@
{
imports = [
../common
./t480/gammastep.nix
];
features = {
cli = {
zsh.enable = true;
};
};
programs = {
zsh.shellAliases =
let

View file

@ -1,3 +1 @@
{
imports = [ ../common ];
}
{ }

View file

@ -27,10 +27,6 @@ let
;
in
{
imports = [
outputs.homeManagerModules.default
];
home.username = "opdavies";
home.homeDirectory = "/home/${config.home.username}";

View file

@ -1,5 +0,0 @@
{
imports = [
./zsh
];
}

View file

@ -1,165 +0,0 @@
{
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";
f = "find .";
fd = "find . -type d";
fdn = "find . -type d -name";
ff = "find . -type f";
ffn = "find . -type f -name";
g = "git";
ga = "git add";
gan = "git add -N";
gap = "git add -p";
gb = "git branch";
gba = "git branch --all";
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";
glg = "git log --grep";
glo = "git log --oneline";
glog = "git log --oneline --grep";
glos = "git log --oneline -S";
gls = "git log -S";
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";
gpf = "git push --force-with-lease";
gpfo = "git push --force-with-lease origin";
gpl = "git pull";
gplr = "git pull --rebase";
gpo = "git push origin";
gpom = "git push origin main";
gpt = "git push --tags";
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";
gt = "git tag";
j = "just";
jb = "just build";
jt = "just test";
js = "just switch";
# 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";
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";
ci = "composer install";
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";
sg = "vendor/bin/sculpin generate";
sge = "vendor/bin/sculpin generate --env";
sgs = "vendor/bin/sculpin generate --server";
sgsp = "vendor/bin/sculpin generate --server --port";
sgsw = "vendor/bin/sculpin generate --server --watch";
sgswp = "vendor/bin/sculpin generate --server --watch --port";
}

View file

@ -1,14 +0,0 @@
{ config, ... }:
{
"$" = "";
"-" = "cd -";
".." = "cd ..";
"..." = "cd ../..";
"...." = "cd ../../..";
"....." = "cd ../../../..";
run = "./run";
tag = "tag-release";
vss = "LC_ALL=C sort --unique ${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/nixos-config/modules/home-manager/cli/neovim/config/spell/en.utf-8.adddotfiles/nvim/spell/en.utf-8.add --output ${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/nixos-config/modules/home-manager/cli/neovim/config/spell/en.utf-8.add";
wt = "git worktree";
}

View file

@ -1,14 +0,0 @@
{
A1 = "| awk '{print $1}'";
C = "| xclip -sel clip";
Fj = "| jq .";
Fy = "| yq .";
G = "| grep";
GH = "| grep HTTP";
Gi = "| grep -i";
H2 = "| head -n 20";
H = "| head";
L = "| less";
V = "| nvim -";
X = "| xargs -I1";
}

View file

@ -0,0 +1,167 @@
{
flake.modules.homeManager.base.programs.zsh.zsh-abbr.abbreviations = {
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";
f = "find .";
fd = "find . -type d";
fdn = "find . -type d -name";
ff = "find . -type f";
ffn = "find . -type f -name";
g = "git";
ga = "git add";
gan = "git add -N";
gap = "git add -p";
gb = "git branch";
gba = "git branch --all";
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";
glg = "git log --grep";
glo = "git log --oneline";
glog = "git log --oneline --grep";
glos = "git log --oneline -S";
gls = "git log -S";
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";
gpf = "git push --force-with-lease";
gpfo = "git push --force-with-lease origin";
gpl = "git pull";
gplr = "git pull --rebase";
gpo = "git push origin";
gpom = "git push origin main";
gpt = "git push --tags";
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";
gt = "git tag";
j = "just";
jb = "just build";
jt = "just test";
js = "just switch";
# 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";
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";
ci = "composer install";
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";
sg = "vendor/bin/sculpin generate";
sge = "vendor/bin/sculpin generate --env";
sgs = "vendor/bin/sculpin generate --server";
sgsp = "vendor/bin/sculpin generate --server --port";
sgsw = "vendor/bin/sculpin generate --server --watch";
sgswp = "vendor/bin/sculpin generate --server --watch --port";
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.base.programs.zsh.zsh-abbr.enable = true;
}

View file

@ -0,0 +1,16 @@
{
flake.modules.homeManager.base.programs.zsh.zsh-abbr.globalAbbreviations = {
A1 = "| awk '{print $1}'";
C = "| xclip -sel clip";
Fj = "| jq .";
Fy = "| yq .";
G = "| grep";
GH = "| grep HTTP";
Gi = "| grep -i";
H2 = "| head -n 20";
H = "| head";
L = "| less";
V = "| nvim -";
X = "| xargs -I1";
};
}

18
modules2/zsh/aliases.nix Normal file
View file

@ -0,0 +1,18 @@
{
flake.modules.homeManager.base =
{ config, ... }:
{
programs.zsh.shellAliases = {
"$" = "";
"-" = "cd -";
".." = "cd ..";
"..." = "cd ../..";
"...." = "cd ../../..";
"....." = "cd ../../../..";
run = "./run";
tag = "tag-release";
vss = "LC_ALL=C sort --unique ${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/nixos-config/modules/home-manager/cli/neovim/config/spell/en.utf-8.adddotfiles/nvim/spell/en.utf-8.add --output ${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/nixos-config/modules/home-manager/cli/neovim/config/spell/en.utf-8.add";
wt = "git worktree";
};
};
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.base.programs.zsh.enableCompletion = true;
}

3
modules2/zsh/dot-dir.nix Normal file
View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.base.programs.zsh.dotDir = ".config/zsh";
}

3
modules2/zsh/enable.nix Normal file
View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.base.programs.zsh.enable = true;
}

View file

@ -1,46 +1,8 @@
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.features.cli.zsh;
in
{
options.features.cli.zsh.enable = mkEnableOption "Enable zsh";
config = mkIf cfg.enable {
programs.zsh = {
enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
zsh-abbr = {
enable = true;
abbreviations = import ./abbreviations.nix;
globalAbbreviations = import ./global-abbreviations.nix;
};
dotDir = ".config/zsh";
shellAliases = (import ./aliases.nix { inherit config; });
localVariables = {
ABBR_SET_EXPANSION_CURSOR = 1;
};
profileExtra = ''
if [[ -z "$DISPLAY" ]] && [[ "$(tty)" == "/dev/tty1" ]]; then
exec startx &>/dev/null
fi
'';
initContent = ''
flake.modules.homeManager.base =
{ config, pkgs, ... }:
{
programs.zsh.initContent = ''
background() {
for ((i=2;i<=$#;i++)); do
''${@[1]} ''${@[$i]} &> /dev/null &
@ -115,5 +77,4 @@ in
setopt pushdminus
'';
};
};
}

7
modules2/zsh/profile.nix Normal file
View file

@ -0,0 +1,7 @@
{
flake.modules.homeManager.base.programs.zsh.profileExtra = ''
if [[ -z "$DISPLAY" ]] && [[ "$(tty)" == "/dev/tty1" ]]; then
exec startx &>/dev/null
fi
'';
}

View file

@ -0,0 +1,3 @@
{
flake.modules.homeManager.base.programs.zsh.syntaxHighlighting.enable = true;
}

View file

@ -0,0 +1,5 @@
{
flake.modules.homeManager.base.programs.zsh.localVariables = {
ABBR_SET_EXPANSION_CURSOR = 1;
};
}