Skip to content

Commit

Permalink
refactor(shell): move direnv and starship config to own modules
Browse files Browse the repository at this point in the history
  • Loading branch information
zakuciael committed May 31, 2024
1 parent 0cef599 commit 217e22f
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 92 deletions.
2 changes: 2 additions & 0 deletions configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
hardware.grub.enable = true;
shell = {
tmux.enable = true;
direnv.enable = true;
starship.enable = true;
fish = {
enable = true;
direnv.enable = true;
Expand Down
34 changes: 34 additions & 0 deletions modules/shell/direnv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
config,
lib,
username,
...
}:
with lib;
with lib.my; let
cfg = config.modules.shell.direnv;
in {
options.modules.shell.direnv = {
enable = mkEnableOption "direnv shell integration";
};

config = mkIf (cfg.enable) {
environment.variables = {
DIRENV_LOG_FORMAT = "";
};

home-manager.users.${username} = {
programs.direnv = {
enable = true;
nix-direnv.enable = true;
config = {
global = {
load_dotenv = true;
disable_stdin = true;
};
whitelist.prefix = ["$HOME/dev"];
};
};
};
};
}
92 changes: 0 additions & 92 deletions modules/shell/fish.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ with lib; let
in {
options.modules.shell.fish = {
enable = mkEnableOption "fish shell";
direnv.enable = mkEnableOption "direnv integration";
default = mkOption {
description = "Whether to set fish as a default shell for the user";
example = true;
Expand All @@ -26,98 +25,7 @@ in {
programs.fish.enable = true;

home-manager.users.${username} = {
home.sessionVariables = {
DIRENV_LOG_FORMAT = "";
};

programs = {
direnv = {
enable = cfg.direnv.enable;
nix-direnv.enable = cfg.direnv.enable;
config = {
global = {
load_dotenv = true;
disable_stdin = true;
};
whitelist.prefix = ["/home/${username}/dev"];
};
};

starship = {
enable = true;
catppuccin.enable = true;
settings = {
add_newline = true;

directory.read_only = " 󰌾";
docker_context.symbol = " ";
nix_shell.symbol = " ";
git_branch.symbol = " ";
hostname.ssh_symbol = "󰖟 ";
kubernetes = {
symbol = "󱃾 ";
disabled = false;
};

package.symbol = "󰏗 ";
c.symbol = " ";
cmake.symbol = " ";
golang.symbol = " ";
java.symbol = " ";
kotlin.symbol = " ";
lua.symbol = " ";
nodejs.symbol = "󰎙 ";
python.symbol = " ";
php.symbol = " ";
ruby.symbol = " ";
rust.symbol = " ";
dotnet.symbol = "󰪮 ";
gradle.symbol = " ";

os.symbols = {
Alpaquita = " ";
Alpine = " ";
Amazon = " ";
Android = " ";
Arch = " ";
Artix = " ";
CentOS = " ";
Debian = " ";
DragonFly = " ";
Emscripten = " ";
EndeavourOS = " ";
Fedora = " ";
FreeBSD = " ";
Garuda = "󰛓 ";
Gentoo = " ";
HardenedBSD = "󰞌 ";
Illumos = "󰈸 ";
Linux = " ";
Mabox = " ";
Macos = " ";
Manjaro = " ";
Mariner = " ";
MidnightBSD = " ";
Mint = " ";
NetBSD = " ";
NixOS = " ";
OpenBSD = "󰈺 ";
openSUSE = " ";
OracleLinux = "󰌷 ";
Pop = " ";
Raspbian = " ";
Redhat = " ";
RedHatEnterprise = " ";
Redox = "󰀘 ";
Solus = "󰠳 ";
SUSE = " ";
Ubuntu = " ";
Unknown = " ";
Windows = "󰍲 ";
};
};
};

fish = {
enable = true;
catppuccin.enable = true;
Expand Down
93 changes: 93 additions & 0 deletions modules/shell/starship.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
config,
lib,
username,
...
}:
with lib;
with lib.my; let
cfg = config.modules.shell.starship;
in {
options.modules.shell.starship = {
enable = mkEnableOption "starship shell prompt";
};

config = mkIf (cfg.enable) {
home-manager.users.${username} = {
programs.starship = {
enable = true;
catppuccin.enable = true;
settings = {
add_newline = true;

directory.read_only = " 󰌾";
docker_context.symbol = " ";
nix_shell.symbol = " ";
git_branch.symbol = " ";
hostname.ssh_symbol = "󰖟 ";
kubernetes = {
symbol = "󱃾 ";
disabled = false;
};

package.symbol = "󰏗 ";
c.symbol = " ";
cmake.symbol = " ";
golang.symbol = " ";
java.symbol = " ";
kotlin.symbol = " ";
lua.symbol = " ";
nodejs.symbol = "󰎙 ";
python.symbol = " ";
php.symbol = " ";
ruby.symbol = " ";
rust.symbol = " ";
dotnet.symbol = "󰪮 ";
gradle.symbol = " ";

os.symbols = {
Alpaquita = " ";
Alpine = " ";
Amazon = " ";
Android = " ";
Arch = " ";
Artix = " ";
CentOS = " ";
Debian = " ";
DragonFly = " ";
Emscripten = " ";
EndeavourOS = " ";
Fedora = " ";
FreeBSD = " ";
Garuda = "󰛓 ";
Gentoo = " ";
HardenedBSD = "󰞌 ";
Illumos = "󰈸 ";
Linux = " ";
Mabox = " ";
Macos = " ";
Manjaro = " ";
Mariner = " ";
MidnightBSD = " ";
Mint = " ";
NetBSD = " ";
NixOS = " ";
OpenBSD = "󰈺 ";
openSUSE = " ";
OracleLinux = "󰌷 ";
Pop = " ";
Raspbian = " ";
Redhat = " ";
RedHatEnterprise = " ";
Redox = "󰀘 ";
Solus = "󰠳 ";
SUSE = " ";
Ubuntu = " ";
Unknown = " ";
Windows = "󰍲 ";
};
};
};
};
};
}

0 comments on commit 217e22f

Please sign in to comment.