ne: add module
Added a simple module to place configuration files for ne: the nice editor. PR #1336
This commit is contained in:
parent
8ab1139891
commit
8f2342e13a
9 changed files with 217 additions and 0 deletions
4
tests/modules/programs/ne/default.nix
Normal file
4
tests/modules/programs/ne/default.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
ne-defprefs = ./defprefs.nix;
|
||||
ne-passthroughs = ./passthroughs.nix;
|
||||
}
|
||||
30
tests/modules/programs/ne/defprefs.nix
Normal file
30
tests/modules/programs/ne/defprefs.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
defpref = ''
|
||||
defined through defaultPreferences
|
||||
'';
|
||||
autopref = ''
|
||||
defined through automaticPreferences
|
||||
'';
|
||||
in {
|
||||
config = {
|
||||
programs.ne = {
|
||||
enable = true;
|
||||
defaultPreferences = defpref;
|
||||
automaticPreferences.".default" = autopref;
|
||||
};
|
||||
nmt = {
|
||||
description =
|
||||
"Check that it gracefully handles the case of both defaultPreferences and automaticPreferences.'.default' being set, defaulting to the former.";
|
||||
script = ''
|
||||
assertFileExists home-files/.ne/.default#ap
|
||||
assertFileContent home-files/.ne/.default#ap ${
|
||||
builtins.toFile "defpref" defpref
|
||||
}
|
||||
'';
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
70
tests/modules/programs/ne/passthroughs.nix
Normal file
70
tests/modules/programs/ne/passthroughs.nix
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
# Samples taken from the ne manual.
|
||||
keybindings = ''
|
||||
SEQ "\x1b[1;5D" 14A
|
||||
KEY 14A HELP
|
||||
'';
|
||||
|
||||
menus = ''
|
||||
MENU "File"
|
||||
ITEM "Open... ^O" Open
|
||||
ITEM "Close " Close
|
||||
ITEM "DoIt " Macro DoIt
|
||||
'';
|
||||
|
||||
virtualExtensions = ''
|
||||
sh 1 ^#!\s*/.*\b(bash|sh|ksh|zsh)\s*
|
||||
csh 1 ^#!\s*/.*\b(csh|tcsh)\s*
|
||||
pl 1 ^#!\s*/.*\bperl\b
|
||||
py 1 ^#!\s*/.*\bpython[0-9]*\s*
|
||||
rb 1 ^#!\s*/.*\bruby\s*
|
||||
xml 1 ^<\?xml
|
||||
'';
|
||||
|
||||
automaticPreferences = {
|
||||
nix = ''
|
||||
TAB 0
|
||||
TS 2
|
||||
'';
|
||||
js = ''
|
||||
TS 4
|
||||
'';
|
||||
};
|
||||
|
||||
checkFile = filename: contents: ''
|
||||
assertFileExists home-files/.ne/${filename}
|
||||
assertFileContent home-files/.ne/${filename} ${
|
||||
builtins.toFile "checkFile" contents
|
||||
}
|
||||
'';
|
||||
|
||||
in {
|
||||
config = {
|
||||
programs.ne = {
|
||||
enable = true;
|
||||
inherit keybindings;
|
||||
inherit menus;
|
||||
inherit virtualExtensions;
|
||||
inherit automaticPreferences;
|
||||
};
|
||||
|
||||
nmt = {
|
||||
description = "Check that configuration files are correctly written";
|
||||
script = concatStringsSep "\n" [
|
||||
(checkFile ".keys" keybindings)
|
||||
(checkFile ".extensions" virtualExtensions)
|
||||
(checkFile ".menus" menus)
|
||||
|
||||
# Generates a check command for each entry in automaticPreferences.
|
||||
(concatStringsSep "\n" (mapAttrsToList
|
||||
(extension: contents: checkFile "${extension}#ap" contents)
|
||||
automaticPreferences))
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue