Files
nixdots/modules/home-manager/defaults.nix
T
2026-10-02 20:59:47 -05:00

24 lines
733 B
Nix

{ config, lib, ... }:
let
cfg = config.my.defaults;
mkCmdOption = description: lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
inherit description;
};
in
{
options.my.defaults = {
terminal = mkCmdOption "Command for the default terminal ($TERMINAL).";
browser = mkCmdOption "Command for the default browser ($BROWSER).";
editor = mkCmdOption "Command for the default editor ($EDITOR and $VISUAL).";
};
config.home.sessionVariables = lib.mkMerge [
(lib.mkIf (cfg.terminal != null) { TERMINAL = cfg.terminal; })
(lib.mkIf (cfg.browser != null) { BROWSER = cfg.browser; })
(lib.mkIf (cfg.editor != null) { EDITOR = cfg.editor; VISUAL = cfg.editor; })
];
}