Compare commits

...

2 Commits

Author SHA1 Message Date
0beab15f24 bash ~ zsh wip 2025-09-29 21:52:02 -06:00
ba8d491cf7 nixformat alias 2025-09-29 21:23:56 -06:00
7 changed files with 142 additions and 64 deletions

View File

@ -2,14 +2,46 @@
inputs, inputs,
config, config,
pkgs, pkgs,
lib,
osConfig,
... ...
}: }:
let
inherit (pkgs) fd fzf;
inherit (inputs.jawz-scripts.packages.x86_64-linux) pokemon-colorscripts;
shellType = osConfig.my.shell.type;
commonInit = ''
${pokemon-colorscripts}/bin/pokemon-colorscripts -r --no-title
export command_timeout=60
'';
commonAliases = {
cp = "cp -i";
mv = "mv -i";
mkdir = "mkdir -p";
mkcd = "(){ mkdir -p \"$1\" && cd \"$1\" }";
copy = "xclip -selection clipboard";
cdp = "pwd | copy";
cfp = "(){ readlink -f \"$1\" | copy }";
".." = "cd ..";
"..." = "cd ../..";
".3" = "cd ../../..";
".4" = "cd ../../../..";
".5" = "cd ../../../../..";
c = "cat";
sc = "systemctl --user";
jc = "journalctl --user -xefu";
open-gallery = ''
cd /srv/pool/scrapping/JawZ/gallery-dl &&
xdg-open "$(${fd}/bin/fd . ./ Husbands wikifeet -tdirectory -d 1 | ${fzf}/bin/fzf -i)"'';
};
in
{ {
home.stateVersion = "23.05"; home.stateVersion = "23.05";
programs = { programs = {
direnv = { direnv = {
enable = true; enable = true;
enableBashIntegration = true; enableBashIntegration = shellType == "bash";
enableZshIntegration = shellType == "zsh";
nix-direnv.enable = true; nix-direnv.enable = true;
}; };
git = { git = {
@ -17,45 +49,30 @@
userName = "Danilo Reyes"; userName = "Danilo Reyes";
userEmail = "CaptainJawZ@protonmail.com"; userEmail = "CaptainJawZ@protonmail.com";
}; };
bash = bash = lib.mkIf (shellType == "bash") {
let enable = true;
inherit (pkgs) fd fzf; historyFile = "\${XDG_STATE_HOME}/bash/history";
inherit (inputs.jawz-scripts.packages.x86_64-linux) pokemon-colorscripts; shellAliases = commonAliases;
in enableVteIntegration = true;
{ initExtra = commonInit;
enable = true; historyControl = [
historyFile = "\${XDG_STATE_HOME}/bash/history"; "erasedups"
historyControl = [ "ignorespace"
"erasedups" "ignoredups"
"ignorespace" ];
"ignoredups" };
]; zsh = lib.mkIf (shellType == "zsh") {
shellAliases = { enable = true;
cp = "cp -i"; dotDir = ".config/zsh";
mv = "mv -i"; shellAliases = commonAliases;
mkdir = "mkdir -p"; initContent = commonInit;
mkcd = "(){ mkdir -p \"$1\" && cd \"$1\" }"; history = {
copy = "xclip -selection clipboard"; path = "\${XDG_STATE_HOME}/zsh/history";
cdp = "pwd | copy"; expireDuplicatesFirst = true;
cfp = "(){ readlink -f \"$1\" | copy }"; ignoreSpace = true;
".." = "cd .."; ignoreAllDups = true;
"..." = "cd ../..";
".3" = "cd ../../..";
".4" = "cd ../../../..";
".5" = "cd ../../../../..";
c = "cat";
sc = "systemctl --user";
jc = "journalctl --user -xefu";
open-gallery = ''
cd /srv/pool/scrapping/JawZ/gallery-dl &&
xdg-open "$(${fd}/bin/fd . ./ Husbands wikifeet -tdirectory -d 1 | ${fzf}/bin/fzf -i)"'';
};
enableVteIntegration = true;
initExtra = ''
${pokemon-colorscripts}/bin/pokemon-colorscripts -r --no-title
export command_timeout=60
'';
}; };
};
}; };
xdg = { xdg = {
enable = true; enable = true;

View File

@ -1,8 +1,10 @@
{ {
pkgs, pkgs,
config,
... ...
}: }:
let let
shellType = config.my.shell.type;
krita-thumbnailer = pkgs.writeTextFile { krita-thumbnailer = pkgs.writeTextFile {
name = "krita-thumbnailer"; name = "krita-thumbnailer";
destination = "/share/thumbnailers/kra.thumbnailer"; destination = "/share/thumbnailers/kra.thumbnailer";
@ -38,7 +40,8 @@ in
ghostty = { ghostty = {
enable = true; enable = true;
package = pkgs.ghostty; package = pkgs.ghostty;
enableBashIntegration = true; enableBashIntegration = shellType == "bash";
enableZshIntegration = shellType == "zsh";
installBatSyntax = true; installBatSyntax = true;
installVimSyntax = true; installVimSyntax = true;
}; };

View File

@ -14,7 +14,7 @@
"doom/templates/programming.org".source = ../../dotfiles/doom/templates/programming.org; "doom/templates/programming.org".source = ../../dotfiles/doom/templates/programming.org;
}; };
services.lorri.enable = true; services.lorri.enable = true;
programs.bash.shellAliases = { programs.${config.my.shell.type}.shellAliases = {
edit = "emacsclient -t"; edit = "emacsclient -t";
e = "edit"; e = "edit";
}; };

View File

@ -5,6 +5,7 @@
... ...
}: }:
let let
shellType = config.my.shell.type;
packages = builtins.attrValues { packages = builtins.attrValues {
inherit (pkgs) inherit (pkgs)
nixfmt-rfc-style # formatting nixfmt-rfc-style # formatting
@ -31,5 +32,12 @@ in
}; };
config = lib.mkIf config.my.dev.nix.enable { config = lib.mkIf config.my.dev.nix.enable {
users.users.jawz = { inherit packages; }; users.users.jawz = { inherit packages; };
home-manager.users.jawz.programs.${shellType}.shellAliases = {
nixformat = ''
nix run unstable#deadnix -- -e && \
nix run unstable#nixfmt-tree && \
nix run unstable#statix fix
'';
};
}; };
} }

View File

@ -16,21 +16,33 @@
inherit (inputs.jawz-scripts.packages.x86_64-linux) download; inherit (inputs.jawz-scripts.packages.x86_64-linux) download;
in in
{ {
home-manager.users.jawz = { home-manager.users.jawz.programs.${config.my.shell.type} = {
programs.bash = { shellAliases = {
shellAliases = { dl = "${download}/bin/download -u jawz -i";
dl = "${download}/bin/download -u jawz -i"; comic = ''dl "$(cat "$LC" | fzf --multi --exact -i)"'';
comic = ''dl "$(cat "$LC" | fzf --multi --exact -i)"''; gallery = ''dl "$(cat "$LW" | fzf --multi --exact -i)"'';
gallery = ''dl "$(cat "$LW" | fzf --multi --exact -i)"'';
};
initExtra = ''
list_root=$XDG_CONFIG_HOME/jawz/lists/jawz
export LW=$list_root/watch.txt
export LI=$list_root/instant.txt
export LC=$list_root/comic.txt
'';
}; };
}; }
// (
if config.my.shell.type == "bash" then
{
initExtra = ''
list_root=$XDG_CONFIG_HOME/jawz/lists/jawz
export LW=$list_root/watch.txt
export LI=$list_root/instant.txt
export LC=$list_root/comic.txt
'';
}
else
{
initContent = ''
list_root=$XDG_CONFIG_HOME/jawz/lists/jawz
export LW=$list_root/watch.txt
export LI=$list_root/instant.txt
export LC=$list_root/comic.txt
'';
}
);
systemd.user = { systemd.user = {
services = services =
let let

20
modules/shell/config.nix Normal file
View File

@ -0,0 +1,20 @@
{
config,
lib,
pkgs,
...
}:
{
options.my.shell.type = lib.mkOption {
type = lib.types.enum [
"bash"
"zsh"
];
default = "bash";
description = "The shell to use system-wide (bash or zsh)";
};
config = {
users.users.jawz.shell = pkgs.${config.my.shell.type};
programs.zsh.enable = config.my.shell.type == "zsh";
};
}

View File

@ -5,6 +5,9 @@
inputs, inputs,
... ...
}: }:
let
shellType = config.my.shell.type;
in
{ {
options.my.shell.tools.enable = lib.mkEnableOption "shell tools and utilities"; options.my.shell.tools.enable = lib.mkEnableOption "shell tools and utilities";
config = lib.mkIf config.my.shell.tools.enable { config = lib.mkIf config.my.shell.tools.enable {
@ -16,15 +19,10 @@
}; };
zoxide = { zoxide = {
enable = true; enable = true;
enableBashIntegration = true; enableBashIntegration = shellType == "bash";
enableZshIntegration = shellType == "zsh";
}; };
bash = { ${shellType} = {
initExtra = ''
if command -v fzf-share >/dev/null; then
source "$(fzf-share)/key-bindings.bash"
source "$(fzf-share)/completion.bash"
fi
'';
shellAliases = { shellAliases = {
cd = "z"; cd = "z";
hh = "hstr"; hh = "hstr";
@ -37,7 +35,27 @@
tr '[:upper:]' '[:lower:]' | sort | tr '[:upper:]' '[:lower:]' | sort |
uniq --count | sort -rn''; uniq --count | sort -rn'';
}; };
}; }
// (
if shellType == "bash" then
{
initExtra = ''
if command -v fzf-share >/dev/null; then
source "$(fzf-share)/key-bindings.bash"
source "$(fzf-share)/completion.bash"
fi
'';
}
else
{
initContent = ''
if command -v fzf-share >/dev/null; then
source "$(fzf-share)/key-bindings.bash"
source "$(fzf-share)/completion.bash"
fi
'';
}
);
bat = { bat = {
enable = true; enable = true;
config.pager = "less -FR"; config.pager = "less -FR";