From decb4266f19722dab8da7ecfd0667ad2a4022b7a Mon Sep 17 00:00:00 2001 From: Joachim Fasting Date: Fri, 1 Aug 2014 13:08:13 +0200 Subject: [PATCH] nano: support system-wide nanorc This patch does two things 1. builds nano with sysconfdir=/etc; and 2. adds an option programs.nano.nanorc --- nixos/modules/module-list.nix | 1 + nixos/modules/programs/nano.nix | 35 ++++++++++++++++++++++ pkgs/applications/editors/nano/default.nix | 2 ++ 3 files changed, 38 insertions(+) create mode 100644 nixos/modules/programs/nano.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 2cbda50ba29..2e0230f2b5e 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -52,6 +52,7 @@ ./programs/blcr.nix ./programs/environment.nix ./programs/info.nix + ./programs/nano.nix ./programs/screen.nix ./programs/shadow.nix ./programs/shell.nix diff --git a/nixos/modules/programs/nano.nix b/nixos/modules/programs/nano.nix new file mode 100644 index 00000000000..b8803eec7be --- /dev/null +++ b/nixos/modules/programs/nano.nix @@ -0,0 +1,35 @@ +{ config, lib, ... }: + +let + cfg = config.programs.nano; +in + +{ + ###### interface + + options = { + programs.nano = { + + nanorc = lib.mkOption { + type = lib.types.lines; + default = ""; + description = '' + The system-wide nano configuration. + See nanorc5. + ''; + example = '' + set nowrap + set tabstospaces + set tabsize 4 + ''; + }; + }; + }; + + ###### implementation + + config = lib.mkIf (cfg.nanorc != "") { + environment.etc."nanorc".text = cfg.nanorc; + }; + +} diff --git a/pkgs/applications/editors/nano/default.nix b/pkgs/applications/editors/nano/default.nix index c347a038ac9..61cea68fa78 100644 --- a/pkgs/applications/editors/nano/default.nix +++ b/pkgs/applications/editors/nano/default.nix @@ -13,6 +13,8 @@ stdenv.mkDerivation (rec { buildInputs = [ ncurses gettext ]; + configureFlags = "sysconfdir=/etc"; + meta = { homepage = http://www.nano-editor.org/; description = "A small, user-friendly console text editor";