Shell customization

{
  lib,
  config,
  osConfig,
  pkgs,
  ...
}:
let
  cfg = config.mjm.shell;
in
{
  options.mjm.shell = {
    <<options>>
  };

  config = lib.mkIf cfg.enable {
    <<config>>
  };

  _class = "homeManager";
}

Options

enable = lib.mkOption {
  type = lib.types.bool;
  default = true;
};

Shell customizations are enabled by default in my home-manager configurations.

Config

programs.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.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.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.

Proxy Information
Original URL
gemini://midna.dev/homelab/modules/home-manager/shell/
Status Code
Success (20)
Meta
text/gemini;lang=en-US
Capsule Response Time
19.353306 milliseconds
Gemini-to-HTML Time
0.236798 milliseconds

This content has been proxied by September (UNKNO).