2017-01-18 14:05:30 +03:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2014-08-01 13:08:13 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.nano;
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
programs.nano = {
|
2023-10-18 14:08:30 +02:00
|
|
|
enable = lib.mkEnableOption "nano, a small user-friendly console text editor" // {
|
2023-07-19 13:07:29 +02:00
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
|
2023-11-30 19:03:14 +01:00
|
|
|
package = lib.mkPackageOption pkgs "nano" { };
|
2014-08-01 13:08:13 +02:00
|
|
|
|
|
|
|
nanorc = lib.mkOption {
|
|
|
|
type = lib.types.lines;
|
|
|
|
default = "";
|
2022-07-20 12:32:04 +02:00
|
|
|
description = ''
|
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 14:05:30 +03:00
|
|
|
set tabsize 2
|
2014-08-01 13:08:13 +02:00
|
|
|
'';
|
|
|
|
};
|
2023-07-19 13:07:29 +02:00
|
|
|
|
2017-01-18 14:05:30 +03:00
|
|
|
syntaxHighlight = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
2023-10-05 00:15:32 +02:00
|
|
|
default = true;
|
2022-07-20 12:32:04 +02:00
|
|
|
description = "Whether to enable syntax highlight for various languages.";
|
2017-01-18 14:05:30 +03:00
|
|
|
};
|
2014-08-01 13:08:13 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-07-19 13:07:29 +02:00
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
environment = {
|
|
|
|
etc.nanorc.text =
|
|
|
|
(lib.optionalString cfg.syntaxHighlight ''
|
|
|
|
# load syntax highlighting files
|
|
|
|
include "${cfg.package}/share/nano/*.nanorc"
|
2023-10-05 00:12:42 +02:00
|
|
|
include "${cfg.package}/share/nano/extra/*.nanorc"
|
2023-07-19 13:07:29 +02:00
|
|
|
'')
|
|
|
|
+ cfg.nanorc;
|
|
|
|
systemPackages = [ cfg.package ];
|
2024-07-10 20:29:50 +02:00
|
|
|
pathsToLink = [ "/share/nano" ];
|
2023-07-19 13:07:29 +02:00
|
|
|
};
|
2014-08-01 13:08:13 +02:00
|
|
|
};
|
|
|
|
}
|