summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoachim Fasting <joachifm@fastmail.fm>2014-08-01 13:08:13 +0200
committerJoachim Fasting <joachifm@fastmail.fm>2014-08-01 18:19:03 +0200
commitdecb4266f19722dab8da7ecfd0667ad2a4022b7a (patch)
tree797dac0edf887db8e005910fcdf7a8c47bd9f391
parent64561b437d78e03c3854fddc8587d6ceb21a02f2 (diff)
downloadnixpkgs-decb4266f19722dab8da7ecfd0667ad2a4022b7a.tar
nixpkgs-decb4266f19722dab8da7ecfd0667ad2a4022b7a.tar.gz
nixpkgs-decb4266f19722dab8da7ecfd0667ad2a4022b7a.tar.bz2
nixpkgs-decb4266f19722dab8da7ecfd0667ad2a4022b7a.tar.lz
nixpkgs-decb4266f19722dab8da7ecfd0667ad2a4022b7a.tar.xz
nixpkgs-decb4266f19722dab8da7ecfd0667ad2a4022b7a.tar.zst
nixpkgs-decb4266f19722dab8da7ecfd0667ad2a4022b7a.zip
nano: support system-wide nanorc
This patch does two things
1. builds nano with sysconfdir=/etc; and
2. adds an option programs.nano.nanorc
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/programs/nano.nix35
-rw-r--r--pkgs/applications/editors/nano/default.nix2
3 files changed, 38 insertions, 0 deletions
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 <citerefentry><refentrytitle>nanorc</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
+        '';
+        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";