default.nix (427B)
1 { config, lib, ... }: 2 let 3 inherit (lib) mkIf mkOption mkOverride types; 4 cfg = config.modules.editors; 5 in 6 { 7 imports = [ ./vim.nix ./emacs.nix ]; 8 options.modules.editors = { 9 default = mkOption { 10 description = "default editor"; 11 type = types.str; 12 default = "vim"; 13 }; 14 }; 15 config = mkIf (cfg.default != null) { 16 environment.variables = { 17 EDITOR = mkOverride 0 cfg.default; 18 }; 19 }; 20 }