shell customization

This commit is contained in:
foglar 2024-12-26 13:44:36 +01:00
parent 1d2edfb87f
commit 4cf3e09d41
5 changed files with 107 additions and 40 deletions

View File

@ -17,11 +17,17 @@
desktop.gnome.enable = true; desktop.gnome.enable = true;
# Shell management # Shell management
sh.oh-my-posh.enable = false;
sh.bash = { sh.bash = {
enable = true; enable = true;
oh-my-posh.enable = false; oh-my-posh.enable = false;
}; };
sh.zsh = {
enable = false;
oh-my-posh.enable = false;
};
# Application lists # Application lists
app_list = { app_list = {
hacking.enable = false; hacking.enable = false;
@ -38,7 +44,7 @@
vscode.enable = false; vscode.enable = false;
git.enable = false; git.enable = false;
neovim.enable = false; neovim.enable = false;
firefox.enable = false; firefox.enable = true;
spotify.enable = false; spotify.enable = false;
}; };

View File

@ -26,10 +26,29 @@
]; ];
sh.bash = { sh.bash = {
enable = lib.mkDefault true; enable =
oh-my-posh.enable = lib.mkDefault true; if userSettings.shell == "bash"
then lib.mkDefault true
else lib.mkDefault false;
oh-my-posh.enable =
if userSettings.shell == "bash"
then lib.mkDefault true
else lib.mkDefault false;
}; };
sh.zsh = {
enable =
if userSettings.shell == "zsh"
then lib.mkDefault true
else lib.mkDefault false;
oh-my-posh.enable =
if userSettings.shell == "zsh"
then lib.mkDefault true
else lib.mkDefault false;
};
sh.oh-my-posh.enable = lib.mkDefault true;
program = { program = {
kitty.enable = kitty.enable =
if userSettings.terminal == "kitty" if userSettings.terminal == "kitty"

View File

@ -5,13 +5,24 @@
... ...
}: { }: {
options = { options = {
sh.bash.oh-my-posh.enable = lib.mkEnableOption "enable oh-my-posh"; sh.oh-my-posh.enable = lib.mkEnableOption "enable oh-my-posh";
sh.bash.oh-my-posh.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "enable oh-my-posh for bash";
};
sh.zsh.oh-my-posh.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "enable oh-my-posh for zsh";
};
}; };
config = lib.mkIf config.sh.bash.oh-my-posh.enable { config = lib.mkIf config.sh.oh-my-posh.enable {
programs.oh-my-posh = { programs.oh-my-posh = {
enable = true; enable = true;
enableBashIntegration = true; enableBashIntegration = if config.sh.bash.enable == true then true else false;
enableZshIntegration = if config.sh.zsh.enable == true then true else false;
settings = { settings = {
"$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json"; "$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json";
"blocks" = [ "blocks" = [

View File

@ -5,17 +5,17 @@
... ...
}: { }: {
options = { options = {
sh.bash.enable = sh.bash.enable = lib.mkEnableOption "enables shell bash";
lib.mkEnableOption "enables shell tools"; sh.zsh.enable = lib.mkEnableOption "enables shell zsh";
}; };
config = lib.mkIf config.sh.bash.enable { config = lib.mkMerge [
(lib.mkIf config.sh.bash.enable {
programs.bash = { programs.bash = {
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;
shellAliases = { shellAliases = {
#vim = "nvim";
ls = "${pkgs.eza}/bin/eza --icons"; ls = "${pkgs.eza}/bin/eza --icons";
ll = "${pkgs.eza}/bin/eza -alh --icons"; ll = "${pkgs.eza}/bin/eza -alh --icons";
l = "${pkgs.eza}/bin/eza -lh --icons=auto"; l = "${pkgs.eza}/bin/eza -lh --icons=auto";
@ -41,9 +41,31 @@
}; };
home.sessionVariables = { home.sessionVariables = {
FLAKE = "/home/foglar/dotfiles";
XDG_DATA_HOME = "$HOME/.local/share"; XDG_DATA_HOME = "$HOME/.local/share";
XDG_PICTURES_DIR = "$HOME/Pictures/Screenshots/"; XDG_PICTURES_DIR = "$HOME/Pictures/Screenshots/";
}; };
})
(lib.mkIf config.sh.zsh.enable {
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
shellAliases = {
ls = "${pkgs.eza}/bin/eza --icons";
ll = "${pkgs.eza}/bin/eza -alh --icons";
l = "${pkgs.eza}/bin/eza -lh --icons=auto";
tree = "${pkgs.eza}/bin/eza --tree --icons";
open = "rifle";
ip = "ip -c";
s = "kitten ssh";
diff = "diff --color";
respawn = "clear; ${pkgs.pfetch}/bin/pfetch";
mkdir = "mkdir -p";
cat = "${pkgs.bat}/bin/bat --style plain";
}; };
};
})
];
} }

View File

@ -46,5 +46,14 @@
"image/jpeg" = "org.gnome.Loupe.desktop"; "image/jpeg" = "org.gnome.Loupe.desktop";
"image/png" = "org.gnome.Loupe.desktop"; "image/png" = "org.gnome.Loupe.desktop";
}; };
programs.zsh.enable =
if userSettings.shell == "zsh"
then lib.mkDefault true
else lib.mkDefault false;
users.defaultUserShell =
if userSettings.shell == "zsh"
then pkgs.zsh
else pkgs.bash;
}; };
} }