nano: add nix syntax hightlight, nano module: provide default (#21912)
this is awesome! thanks.
This commit is contained in:
parent
5c7ecab75c
commit
4a662e5206
@ -1,4 +1,4 @@
|
|||||||
{ config, lib, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.programs.nano;
|
cfg = config.programs.nano;
|
||||||
@ -20,16 +20,22 @@ in
|
|||||||
example = ''
|
example = ''
|
||||||
set nowrap
|
set nowrap
|
||||||
set tabstospaces
|
set tabstospaces
|
||||||
set tabsize 4
|
set tabsize 2
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
syntaxHighlight = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Whether to enable syntax highlight for various languages.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = lib.mkIf (cfg.nanorc != "") {
|
config = lib.mkIf (cfg.nanorc != "") {
|
||||||
environment.etc."nanorc".text = cfg.nanorc;
|
environment.etc."nanorc".text = lib.concatStrings [ cfg.nanorc
|
||||||
|
(lib.optionalString cfg.syntaxHighlight ''include "${pkgs.nano}/share/nano/*.nanorc"'') ];
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, fetchurl
|
{ stdenv, fetchurl, fetchFromGitHub
|
||||||
, ncurses
|
, ncurses
|
||||||
, texinfo
|
, texinfo
|
||||||
, gettext ? null
|
, gettext ? null
|
||||||
@ -10,7 +10,14 @@ assert enableNls -> (gettext != null);
|
|||||||
|
|
||||||
with stdenv.lib;
|
with stdenv.lib;
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
let
|
||||||
|
nixSyntaxHighlight = fetchFromGitHub {
|
||||||
|
owner = "seitz";
|
||||||
|
repo = "nanonix";
|
||||||
|
rev = "17e0de65e1cbba3d6baa82deaefa853b41f5c161";
|
||||||
|
sha256 = "1g51h65i31andfs2fbp1v3vih9405iknqn11fzywjxji00kjqv5s";
|
||||||
|
};
|
||||||
|
in stdenv.mkDerivation rec {
|
||||||
name = "nano-${version}";
|
name = "nano-${version}";
|
||||||
version = "2.7.3";
|
version = "2.7.3";
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
@ -30,6 +37,10 @@ stdenv.mkDerivation rec {
|
|||||||
substituteInPlace src/text.c --replace "__time_t" "time_t"
|
substituteInPlace src/text.c --replace "__time_t" "time_t"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
cp ${nixSyntaxHighlight}/nix.nanorc $out/share/nano/
|
||||||
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://www.nano-editor.org/;
|
homepage = http://www.nano-editor.org/;
|
||||||
description = "A small, user-friendly console text editor";
|
description = "A small, user-friendly console text editor";
|
||||||
|
Loading…
Reference in New Issue
Block a user