2017-01-18 12:05:30 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2014-08-01 13:08:13 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.nano;
|
2019-01-14 23:01:06 +01:00
|
|
|
LF = "\n";
|
2014-08-01 13:08:13 +02:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
programs.nano = {
|
|
|
|
|
|
|
|
nanorc = lib.mkOption {
|
|
|
|
type = lib.types.lines;
|
|
|
|
default = "";
|
2022-07-20 12:32:04 +02:00
|
|
|
description = lib.mdDoc ''
|
2014-08-01 13:08:13 +02:00
|
|
|
The system-wide nano configuration.
|
2022-07-20 12:32:04 +02:00
|
|
|
See {manpage}`nanorc(5)`.
|
2014-08-01 13:08:13 +02:00
|
|
|
'';
|
|
|
|
example = ''
|
|
|
|
set nowrap
|
|
|
|
set tabstospaces
|
2017-01-18 12:05:30 +01:00
|
|
|
set tabsize 2
|
2014-08-01 13:08:13 +02:00
|
|
|
'';
|
|
|
|
};
|
2017-01-18 12:05:30 +01:00
|
|
|
syntaxHighlight = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = true;
|
2022-07-20 12:32:04 +02:00
|
|
|
description = lib.mdDoc "Whether to enable syntax highlight for various languages.";
|
2017-01-18 12:05:30 +01:00
|
|
|
};
|
2014-08-01 13:08:13 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
2019-01-14 23:01:06 +01:00
|
|
|
config = lib.mkIf (cfg.nanorc != "" || cfg.syntaxHighlight) {
|
2019-08-13 23:52:01 +02:00
|
|
|
environment.etc.nanorc.text = lib.concatStrings [ cfg.nanorc
|
2019-01-14 23:01:06 +01:00
|
|
|
(lib.optionalString cfg.syntaxHighlight ''${LF}include "${pkgs.nano}/share/nano/*.nanorc"'') ];
|
2014-08-01 13:08:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|