{
lib,
inputs,
config,
osConfig,
pkgs,
...
}:
let
cfg = config.mjm.shell;
in
{
options.mjm.shell = {
<<options>>
};
config = lib.mkIf cfg.enable {
<<config>>
};
_class = "homeManager";
}enable = lib.mkEnableOption "shell config";
Shell customizations are enabled by default in my home-manager base module.
programs.fish.enable = true; catppuccin.fish.enable = true;
I use fish as my shell. It's the most mature of the newish non-POSIX shells and generally seems to just work.
programs.fish.binds."alt-s".command = "fish_commandline_prepend run0";
programs.fish.shellAliases = {
"r" = "run0";
};I have some extra conveniences for using run0 in fish. The Alt-S shortcut normally prepends the command with "sudo", but I've altered it to prepend "run0" instead. I've also added a shorter "r" alias for "run0", although usually I just write the full thing because my microVMs don't have this alias.
programs.btop.enable = true; catppuccin.btop.enable = true;
btop is a very nice process monitor for the terminal.
programs.carapace.enable = true;
carapace adds additional smart completions to the shell.
programs.zoxide.enable = true;
zoxide provides a nice "z" shell command to jump to recent directories based on a fuzzy match of the path. For instance, I usually run "z conf" to cd to my nix-config checkout, or "z pkgs" to cd to my nixpkgs checkout.
programs.direnv = {
enable = true;
nix-direnv.enable = true;
config = {
global.warn_timeout = "5m";
whitelist.prefix = [ "${config.home.homeDirectory}/src/nix-config/" ];
};
};I'm a big user of direnv for setting up project-specific environments. Usually this is done through the Nix integration in direnv, and nix-direnv makes this faster by doing some smart caching.
I configure direnv to have a longer timeout before it warns about the command taking too long. The nature of using a Nix shell with direnv is that sometimes an update to packages will mean that some time must be spent downloading or compiling things. I know and expect this, so I don't need a warning after five seconds.
I also whitelist my nix-config repo. Since I'm the only one who can commit to it, I'm not worried about a malicious .envrc being used.
programs.eza = {
enable = true;
git = true;
icons = "auto";
extraOptions = [
"--group-directories-first"
"--header"
"--smart-group"
"--group"
"--short-nix"
];
};
catppuccin.eza.enable = true;I use eza as a nicer ls replacement. I've configured the display options to suit my preferences.
programs.atuin = {
enable = true;
daemon.enable = pkgs.stdenv.hostPlatform.isLinux;
settings =
let
persistDir = osConfig.mjm.state.persistDir;
atuinShareDir = "${
lib.optionalString (persistDir != null) persistDir
}${config.home.homeDirectory}/.local/share/atuin";
in
{
sync_address = "https://atuin.midna.dev";
db_path = "${atuinShareDir}/history.db";
key_path = "${atuinShareDir}/key";
session_path = "${atuinShareDir}/session";
record_store_path = "${atuinShareDir}/records.db";
kv.db_path = "${atuinShareDir}/kv.db";
meta.db_path = "${atuinShareDir}/meta.db";
scripts.db_path = "${atuinShareDir}/scripts.db";
daemon.pidfile_path = "${atuinShareDir}/atuin-daemon.pid";
};
};
catppuccin.atuin.enable = true;I use atuin to sync and search shell history across all of my machines. The sync server is running locally in the homelab.
Most of the settings here are to workaround the fact that /home is not persistent on several of my servers. My state module doesn't have options for persisting files or directories for users, because this is the only thing I would end up using it for. Instead, I configure atuin to store all of its persistent data under the persistDir if there is one.
It's possible this could be done more simply by wrapping the atuin package so that it has XDG_DATA_DIR overridden. I might try that at some point.
programs.yazi = {
enable = true;
shellWrapperName = "y";
};
catppuccin.yazi.enable = true;yazi is a pretty nice TUI file manager. I'll use it sometimes to move a bunch of files around or explore the built contents of a Nix derivation.
xdg.configFile."process-compose/theme.yaml".source =
"${inputs.catppuccin-process-compose}/themes/catppuccin-${config.catppuccin.flavor}.yaml";catppuccin-nix doesn't have a module for theming process-compose, so I link the theme file into place manually.
text/gemini;lang=en-USThis content has been proxied by September (UNKNO).