diff options
Diffstat (limited to 'nixpkgs/nixos/modules/programs/nano.nix')
-rw-r--r-- | nixpkgs/nixos/modules/programs/nano.nix | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/programs/nano.nix b/nixpkgs/nixos/modules/programs/nano.nix new file mode 100644 index 000000000000..6a4d46338e19 --- /dev/null +++ b/nixpkgs/nixos/modules/programs/nano.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.programs.nano; + LF = "\n"; +in + +{ + ###### interface + + options = { + programs.nano = { + + nanorc = lib.mkOption { + type = lib.types.lines; + default = ""; + description = '' + The system-wide nano configuration. + See <citerefentry><refentrytitle>nanorc</refentrytitle><manvolnum>5</manvolnum></citerefentry>. + ''; + example = '' + set nowrap + set tabstospaces + set tabsize 2 + ''; + }; + syntaxHighlight = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Whether to enable syntax highlight for various languages."; + }; + }; + }; + + ###### 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"'') ]; + }; + +} |