1{ config, lib, pkgs, ... }:
2
3let
4 cfg = config.programs.nano;
5in
6
7{
8 ###### interface
9
10 options = {
11 programs.nano = {
12
13 nanorc = lib.mkOption {
14 type = lib.types.lines;
15 default = "";
16 description = ''
17 The system-wide nano configuration.
18 See <citerefentry><refentrytitle>nanorc</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
19 '';
20 example = ''
21 set nowrap
22 set tabstospaces
23 set tabsize 2
24 '';
25 };
26 syntaxHighlight = lib.mkOption {
27 type = lib.types.bool;
28 default = true;
29 description = "Whether to enable syntax highlight for various languages.";
30 };
31 };
32 };
33
34 ###### implementation
35
36 config = lib.mkIf (cfg.nanorc != "") {
37 environment.etc."nanorc".text = lib.concatStrings [ cfg.nanorc
38 (lib.optionalString cfg.syntaxHighlight ''include "${pkgs.nano}/share/nano/*.nanorc"'') ];
39 };
40
41}