bash ~ zsh wip
This commit is contained in:
parent
ba8d491cf7
commit
0beab15f24
@ -2,35 +2,19 @@
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
{
|
||||
home.stateVersion = "23.05";
|
||||
programs = {
|
||||
direnv = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
git = {
|
||||
enable = true;
|
||||
userName = "Danilo Reyes";
|
||||
userEmail = "CaptainJawZ@protonmail.com";
|
||||
};
|
||||
bash =
|
||||
let
|
||||
inherit (pkgs) fd fzf;
|
||||
inherit (inputs.jawz-scripts.packages.x86_64-linux) pokemon-colorscripts;
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
historyFile = "\${XDG_STATE_HOME}/bash/history";
|
||||
historyControl = [
|
||||
"erasedups"
|
||||
"ignorespace"
|
||||
"ignoredups"
|
||||
];
|
||||
shellAliases = {
|
||||
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";
|
||||
@ -50,11 +34,44 @@
|
||||
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";
|
||||
programs = {
|
||||
direnv = {
|
||||
enable = true;
|
||||
enableBashIntegration = shellType == "bash";
|
||||
enableZshIntegration = shellType == "zsh";
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
git = {
|
||||
enable = true;
|
||||
userName = "Danilo Reyes";
|
||||
userEmail = "CaptainJawZ@protonmail.com";
|
||||
};
|
||||
bash = lib.mkIf (shellType == "bash") {
|
||||
enable = true;
|
||||
historyFile = "\${XDG_STATE_HOME}/bash/history";
|
||||
shellAliases = commonAliases;
|
||||
enableVteIntegration = true;
|
||||
initExtra = ''
|
||||
${pokemon-colorscripts}/bin/pokemon-colorscripts -r --no-title
|
||||
export command_timeout=60
|
||||
'';
|
||||
initExtra = commonInit;
|
||||
historyControl = [
|
||||
"erasedups"
|
||||
"ignorespace"
|
||||
"ignoredups"
|
||||
];
|
||||
};
|
||||
zsh = lib.mkIf (shellType == "zsh") {
|
||||
enable = true;
|
||||
dotDir = ".config/zsh";
|
||||
shellAliases = commonAliases;
|
||||
initContent = commonInit;
|
||||
history = {
|
||||
path = "\${XDG_STATE_HOME}/zsh/history";
|
||||
expireDuplicatesFirst = true;
|
||||
ignoreSpace = true;
|
||||
ignoreAllDups = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
xdg = {
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
shellType = config.my.shell.type;
|
||||
krita-thumbnailer = pkgs.writeTextFile {
|
||||
name = "krita-thumbnailer";
|
||||
destination = "/share/thumbnailers/kra.thumbnailer";
|
||||
@ -38,7 +40,8 @@ in
|
||||
ghostty = {
|
||||
enable = true;
|
||||
package = pkgs.ghostty;
|
||||
enableBashIntegration = true;
|
||||
enableBashIntegration = shellType == "bash";
|
||||
enableZshIntegration = shellType == "zsh";
|
||||
installBatSyntax = true;
|
||||
installVimSyntax = true;
|
||||
};
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
"doom/templates/programming.org".source = ../../dotfiles/doom/templates/programming.org;
|
||||
};
|
||||
services.lorri.enable = true;
|
||||
programs.bash.shellAliases = {
|
||||
programs.${config.my.shell.type}.shellAliases = {
|
||||
edit = "emacsclient -t";
|
||||
e = "edit";
|
||||
};
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
shellType = config.my.shell.type;
|
||||
packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
nixfmt-rfc-style # formatting
|
||||
@ -31,7 +32,7 @@ in
|
||||
};
|
||||
config = lib.mkIf config.my.dev.nix.enable {
|
||||
users.users.jawz = { inherit packages; };
|
||||
home-manager.users.jawz.programs.bash.shellAliases = {
|
||||
home-manager.users.jawz.programs.${shellType}.shellAliases = {
|
||||
nixformat = ''
|
||||
nix run unstable#deadnix -- -e && \
|
||||
nix run unstable#nixfmt-tree && \
|
||||
|
||||
@ -16,21 +16,33 @@
|
||||
inherit (inputs.jawz-scripts.packages.x86_64-linux) download;
|
||||
in
|
||||
{
|
||||
home-manager.users.jawz = {
|
||||
programs.bash = {
|
||||
home-manager.users.jawz.programs.${config.my.shell.type} = {
|
||||
shellAliases = {
|
||||
dl = "${download}/bin/download -u jawz -i";
|
||||
comic = ''dl "$(cat "$LC" | fzf --multi --exact -i)"'';
|
||||
gallery = ''dl "$(cat "$LW" | fzf --multi --exact -i)"'';
|
||||
};
|
||||
}
|
||||
// (
|
||||
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 = {
|
||||
services =
|
||||
let
|
||||
|
||||
20
modules/shell/config.nix
Normal file
20
modules/shell/config.nix
Normal 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";
|
||||
};
|
||||
}
|
||||
@ -5,6 +5,9 @@
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
shellType = config.my.shell.type;
|
||||
in
|
||||
{
|
||||
options.my.shell.tools.enable = lib.mkEnableOption "shell tools and utilities";
|
||||
config = lib.mkIf config.my.shell.tools.enable {
|
||||
@ -16,15 +19,10 @@
|
||||
};
|
||||
zoxide = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
enableBashIntegration = shellType == "bash";
|
||||
enableZshIntegration = shellType == "zsh";
|
||||
};
|
||||
bash = {
|
||||
initExtra = ''
|
||||
if command -v fzf-share >/dev/null; then
|
||||
source "$(fzf-share)/key-bindings.bash"
|
||||
source "$(fzf-share)/completion.bash"
|
||||
fi
|
||||
'';
|
||||
${shellType} = {
|
||||
shellAliases = {
|
||||
cd = "z";
|
||||
hh = "hstr";
|
||||
@ -37,7 +35,27 @@
|
||||
tr '[:upper:]' '[:lower:]' | sort |
|
||||
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 = {
|
||||
enable = true;
|
||||
config.pager = "less -FR";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user