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