nixos/nano: refactor nanorc creation

The default syntax highlighting rules are included at the top of the nanorc file to allow overriding.
This commit is contained in:
uoleg 2023-02-27 20:24:33 +03:00
parent 345b995437
commit 8ca0687b97

View File

@ -35,8 +35,17 @@ in
###### implementation
config = lib.mkIf (cfg.nanorc != "" || cfg.syntaxHighlight) {
environment.etc.nanorc.text = lib.concatStrings [ cfg.nanorc
(lib.optionalString cfg.syntaxHighlight ''${LF}include "${pkgs.nano}/share/nano/*.nanorc"'') ];
environment.etc.nanorc.text = lib.concatStringsSep LF (
( lib.optionals cfg.syntaxHighlight [
"# The line below is added because value of programs.nano.syntaxHighlight is set to true"
''include "${pkgs.nano}/share/nano/*.nanorc"''
""
])
++ ( lib.optionals (cfg.nanorc != "") [
"# The lines below have been set from value of programs.nano.nanorc"
cfg.nanorc
])
);
};
}