#| file: modules/common/shell.nix
{
lib,
config,
pkgs,
...
}:
let
cfg = config.mjm.shell;
in
{
options.mjm.shell = {
<<options>>
};
config =
lib.mkIf cfg.enable
<| lib.mkMerge [
{
<<basic-config>>
}
(lib.mkIf cfg.full.enable {
<<full-config>>
})
];
}This module configures the shell across all of my machines. Since it's in the common directory, it's written to work with either NixOS or nix-darwin, despite me not having any nix-darwin machines at the moment.
enable = lib.mkEnableOption "basic shell configuration" // {
default = true;
};
full.enable = lib.mkEnableOption "full shell configuration" // {
default = true;
};There are two levels of configuration here. The basic configuration applies to all machines, while the full configuration will be disabled on microVMs to keep them minimal and less likely to change.
programs.fish.enable = true; catppuccin.fish.enable = true;
My preferred shell is fish, so I want it present and set up properly on all my machines.
environment.systemPackages = [ pkgs.fishPlugins.tide ];
I'm using the Tide prompt, which can be installed just by including the package in environment.systemPackages. I have logic on the NixOS side to configure the tide prompt in systemd services.
environment.systemPackages = lib.attrValues {
inherit (pkgs)
attic-client
fx
gh
jq
nix-output-monitor
nix-tree
nvd
pstree
ripgrep
serpl
skim
unzip
;
};These are utilities that I like to have handy on most systems.
programs.direnv.enable = true; programs.direnv.nix-direnv.enable = true;
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.
programs.direnv.settings.global.warn_timeout = "5m";
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.
text/gemini;lang=en-USThis content has been proxied by September (UNKNO).