nixpkgs/nixos/modules/programs/nano.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
989 B
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
let
cfg = config.programs.nano;
LF = "\n";
in
{
###### interface
options = {
programs.nano = {
nanorc = lib.mkOption {
type = lib.types.lines;
default = "";
description = ''
The system-wide nano configuration.
See <citerefentry><refentrytitle>nanorc</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
'';
example = ''
set nowrap
set tabstospaces
set tabsize 2
'';
};
syntaxHighlight = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to enable syntax highlight for various languages.";
};
};
};
###### implementation
config = lib.mkIf (cfg.nanorc != "" || cfg.syntaxHighlight) {
2019-08-13 21:52:01 +00:00
environment.etc.nanorc.text = lib.concatStrings [ cfg.nanorc
(lib.optionalString cfg.syntaxHighlight ''${LF}include "${pkgs.nano}/share/nano/*.nanorc"'') ];
};
}