fork/home-manager
git clone https://git.julia.blue/fork/home-manager
cb09a968
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7# Samples taken from the ne manual. 8keybindings = '' 9SEQ "\x1b[1;5D" 14A 10KEY 14A HELP 11'' ; 12 13menus = '' 14MENU "File" 15ITEM "Open... ^O" Open 16ITEM "Close " Close 17ITEM "DoIt " Macro DoIt 18'' ; 19 20virtualExtensions = '' 21sh 1 ^#!\s*/.*\b(bash|sh|ksh|zsh)\s* 22csh 1 ^#!\s*/.*\b(csh|tcsh)\s* 23pl 1 ^#!\s*/.*\bperl\b 24py 1 ^#!\s*/.*\bpython[0-9]*\s* 25rb 1 ^#!\s*/.*\bruby\s* 26xml 1 ^<\?xml 27'' ; 28 29automaticPreferences = { 30nix = '' 31TAB 0 32TS 2 33'' ; 34js = '' 35TS 4 36'' ; 37}; 38 39checkFile = filename :contents :'' 40assertFileExists home-files/.ne/ ${ filename } 41assertFileContent home-files/.ne/ ${ filename } ${ 42builtins . toFile "checkFile" contents 43} 44'' ; 45 46in { 47config = { 48programs . ne = { 49enable = true ; 50inherit keybindings ; 51inherit menus ; 52inherit virtualExtensions ; 53inherit automaticPreferences ; 54}; 55 56test . stubs . ne = { }; 57 58nmt = { 59description = "Check that configuration files are correctly written" ; 60script = concatStringsSep "\n" [ 61( checkFile ".keys" keybindings ) 62( checkFile ".extensions" virtualExtensions ) 63( checkFile ".menus" menus ) 64 65# Generates a check command for each entry in automaticPreferences. 66( concatStringsSep "\n" ( mapAttrsToList 67( extension :contents :checkFile " ${ extension } #ap" contents ) 68automaticPreferences )) 69]; 70}; 71}; 72}