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;
# Shell management
sh.oh-my-posh.enable = false;
sh.bash = {
enable = true;
oh-my-posh.enable = false;
};
sh.zsh = {
enable = false;
oh-my-posh.enable = false;
};
# Application lists
app_list = {
hacking.enable = false;
@ -38,7 +44,7 @@
vscode.enable = false;
git.enable = false;
neovim.enable = false;
firefox.enable = false;
firefox.enable = true;
spotify.enable = false;
};

View File

@ -26,10 +26,29 @@
];
sh.bash = {
enable = lib.mkDefault true;
oh-my-posh.enable = lib.mkDefault true;
enable =
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 = {
kitty.enable =
if userSettings.terminal == "kitty"

View File

@ -5,13 +5,24 @@
...
}: {
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 = {
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 = {
"$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json";
"blocks" = [

View File

@ -5,17 +5,17 @@
...
}: {
options = {
sh.bash.enable =
lib.mkEnableOption "enables shell tools";
sh.bash.enable = lib.mkEnableOption "enables shell bash";
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 = {
enable = true;
enableCompletion = true;
shellAliases = {
#vim = "nvim";
ls = "${pkgs.eza}/bin/eza --icons";
ll = "${pkgs.eza}/bin/eza -alh --icons";
l = "${pkgs.eza}/bin/eza -lh --icons=auto";
@ -41,9 +41,31 @@
};
home.sessionVariables = {
FLAKE = "/home/foglar/dotfiles";
XDG_DATA_HOME = "$HOME/.local/share";
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/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;
};
}