mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 05:03:09 +00:00
36a53d9f26
This process was automated by [my fork of `nix-doc-munge`]. All conversions were automatically checked to produce the same DocBook result when converted back, modulo minor typographical/formatting differences on the acceptable-to-desirable spectrum. To reproduce this commit, run: $ NIX_PATH=nixpkgs=flake:nixpkgs/e7e69199f0372364a6106a1e735f68604f4c5a25 \ nix shell nixpkgs#coreutils \ -c find . -name '*.nix' \ -exec nix run -- github:emilazy/nix-doc-munge/98dadf1f77351c2ba5dcb709a2a171d655f15099 \ {} + $ ./format [my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge/tree/home-manager
95 lines
2.2 KiB
Nix
95 lines
2.2 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.programs.ne;
|
|
|
|
autoPrefFiles = let
|
|
autoprefs = cfg.automaticPreferences
|
|
// optionalAttrs (cfg.defaultPreferences != "") {
|
|
".default" = cfg.defaultPreferences;
|
|
};
|
|
|
|
gen = fileExtension: configText:
|
|
nameValuePair ".ne/${fileExtension}#ap" {
|
|
text = configText;
|
|
}; # Generates [path].text format expected by home.file.
|
|
in mapAttrs' gen autoprefs;
|
|
|
|
in {
|
|
meta.maintainers = [ hm.maintainers.cwyc ];
|
|
|
|
options.programs.ne = {
|
|
enable = mkEnableOption (lib.mdDoc "ne");
|
|
|
|
keybindings = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
example = ''
|
|
KEY 7f BS
|
|
SEQ "\x1b[1;5D" 7f
|
|
'';
|
|
description = lib.mdDoc ''
|
|
Keybinding file for ne.
|
|
'';
|
|
};
|
|
|
|
defaultPreferences = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
description = lib.mdDoc ''
|
|
Default preferences for ne.
|
|
|
|
Equivalent to `programs.ne.automaticPreferences.".default"`.
|
|
'';
|
|
};
|
|
|
|
automaticPreferences = mkOption {
|
|
type = types.attrsOf types.lines;
|
|
default = { };
|
|
example = literalExpression ''
|
|
{
|
|
nix = '''
|
|
TAB 0
|
|
TS 2
|
|
''';
|
|
js = '''
|
|
TS 4
|
|
''';
|
|
}
|
|
'';
|
|
description = lib.mdDoc ''
|
|
Automatic preferences files for ne.
|
|
'';
|
|
};
|
|
|
|
menus = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
description = lib.mdDoc "Menu configuration file for ne.";
|
|
};
|
|
|
|
virtualExtensions = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
example = ''
|
|
sh 1 ^#!\s*/.*\b(bash|sh|ksh|zsh)\s*
|
|
csh 1 ^#!\s*/.*\b(csh|tcsh)\s*
|
|
'';
|
|
description = lib.mdDoc "Virtual extensions configuration file for ne.";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
home.packages = [ pkgs.ne ];
|
|
|
|
home.file = {
|
|
".ne/.keys" = mkIf (cfg.keybindings != "") { text = cfg.keybindings; };
|
|
".ne/.extensions" =
|
|
mkIf (cfg.virtualExtensions != "") { text = cfg.virtualExtensions; };
|
|
".ne/.menus" = mkIf (cfg.menus != "") { text = cfg.menus; };
|
|
} // autoPrefFiles;
|
|
};
|
|
}
|