sneeuwvlok/modules/home/editor/default.nix
2025-07-28 16:52:48 +02:00

24 lines
571 B
Nix

{ config, options, lib, pkgs, namespace, ... }:
let
inherit (lib) attrValues mkIf mkMerge mkOption;
inherit (lib.types) nullOr enum;
cfg = config.${namespace}.editors;
in {
options.${namespace}.editors = {
default = mkOption {
type = nullOr (enum [ "nano" "nvim" "zed" "kate" "vscodium" ]);
default = "nano";
description = "Default editor for text manipulation";
example = "nvim";
};
};
config = mkMerge [
(mkIf (cfg.default != null) {
home.sessionVariables = {
EDITOR = cfg.default;
};
})
];
}