From e079214f431709170b82eaa47be78725a57c04a0 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 12 Jun 2016 21:14:03 +0200 Subject: tv nix.vim Nix{ID,Other}: init --- tv/2configs/vim.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tv') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 826c2d4ca..12eab46ed 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -211,9 +211,8 @@ let nix.vim = pkgs.writeText "nix.vim" '' setf nix - syn match NixCode /./ - " Ref + syn match NixID /[a-zA-Z\_][a-zA-Z0-9\_\'\-]*/ syn match NixINT /\<[0-9]\+\>/ syn match NixPATH /[a-zA-Z0-9\.\_\-\+]*\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ syn match NixHPATH /\~\(\/[a-zA-Z0-9\.\_\-\+]\+\)\+/ @@ -231,6 +230,7 @@ let \ end="'''" syn cluster NixStrings contains=NixSTRING,NixIND_STRING + syn match NixOther /[():/;=.,?\[\]]/ syn match NixCommentMatch /\(^\|\s\)#.*/ syn region NixCommentRegion start="/\*" end="\*/" @@ -241,6 +241,7 @@ let hi link NixCommentMatch NixComment hi link NixCommentRegion NixComment + hi link NixID NixCode hi link NixINT NixData hi link NixPATH NixData hi link NixHPATH NixData @@ -251,6 +252,7 @@ let hi link NixEnter NixCode hi link NixExit NixData + hi link NixOther NixCode hi link NixQuote NixData hi link NixQuote2 NixQuote hi link NixQuote3 NixQuote -- cgit v1.2.3 From 8237c8606ec67154bb084c4c47c8538a3cdb6455 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 12 Jun 2016 21:25:03 +0200 Subject: tv nix.vim: add quoting for STRING --- tv/2configs/vim.nix | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'tv') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 12eab46ed..9a8471330 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -229,7 +229,6 @@ let \ skip="'''\('\|[$]\|\\[nrt]\)" \ end="'''" - syn cluster NixStrings contains=NixSTRING,NixIND_STRING syn match NixOther /[():/;=.,?\[\]]/ syn match NixCommentMatch /\(^\|\s\)#.*/ @@ -251,13 +250,12 @@ let hi link NixIND_STRING NixData hi link NixEnter NixCode - hi link NixExit NixData hi link NixOther NixCode hi link NixQuote NixData - hi link NixQuote2 NixQuote - hi link NixQuote3 NixQuote - syn cluster NixSubLangs contains=NONE + syn cluster nix_has_dollar_curly contains=@nix_ind_strings,@nix_strings + syn cluster nix_ind_strings contains=NixIND_STRING + syn cluster nix_strings contains=NixSTRING ${concatStringsSep "\n" (mapAttrsToList (lang: { extraStart ? null }: let startAlts = filter isString [ @@ -271,10 +269,10 @@ let syn match nix_${lang}_sigil \ X${replaceStrings ["X"] ["\\X"] sigil}\ze\('''\|"\)X - \ nextgroup=nix_${lang}_region + \ nextgroup=nix_${lang}_region_IND_STRING,nix_${lang}_region_STRING \ transparent - syn region nix_${lang}_region + syn region nix_${lang}_region_STRING \ matchgroup=NixSTRING \ start='"' \ skip='\\"' @@ -282,7 +280,7 @@ let \ contained \ contains=@nix_${lang}_syntax - syn region nix_${lang}_region + syn region nix_${lang}_region_IND_STRING \ matchgroup=NixIND_STRING \ start="'''" \ skip="'''\('\|[$]\|\\[nrt]\)" @@ -290,8 +288,14 @@ let \ contained \ contains=@nix_${lang}_syntax - syn cluster NixSubLangs - \ add=nix_${lang}_region,@nix_${lang}_syntax + syn cluster nix_ind_strings + \ add=nix_${lang}_region_IND_STRING + + syn cluster nix_strings + \ add=nix_${lang}_region_STRING + + syn cluster nix_has_dollar_curly + \ add=@nix_${lang}_syntax '') { c = {}; cabal = {}; @@ -310,7 +314,7 @@ let \ start="[$]{" \ end="}" \ contains=TOP - \ containedin=@NixSubLangs,@NixStrings + \ containedin=@nix_has_dollar_curly syn region NixBlockHack \ matchgroup=NixEnter @@ -318,9 +322,13 @@ let \ end="}" \ contains=TOP - syn match NixQuote "'''[$]"he=e-1 contained containedin=@NixSubLangs - syn match NixQuote2 "''''"he=s+1 contained containedin=@NixSubLangs - syn match NixQuote3 "'''\\[nrt]" contained containedin=@NixSubLangs + syn match NixQuote /'''\([''$']\|\\.\)/he=s+2 + \ containedin=@nix_ind_strings + \ contained + + syn match NixQuote /\\./he=s+1 + \ containedin=@nix_strings + \ contained syn sync fromstart -- cgit v1.2.3 From ac3b87b9a62929a81d2a275b808681352cc3c10e Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 12 Jun 2016 21:28:31 +0200 Subject: tv nix.vim: transparent nix_*_region_* and curly blocks --- tv/2configs/vim.nix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'tv') diff --git a/tv/2configs/vim.nix b/tv/2configs/vim.nix index 9a8471330..85045332f 100644 --- a/tv/2configs/vim.nix +++ b/tv/2configs/vim.nix @@ -279,6 +279,7 @@ let \ end='"' \ contained \ contains=@nix_${lang}_syntax + \ transparent syn region nix_${lang}_region_IND_STRING \ matchgroup=NixIND_STRING @@ -287,6 +288,7 @@ let \ end="'''" \ contained \ contains=@nix_${lang}_syntax + \ transparent syn cluster nix_ind_strings \ add=nix_${lang}_region_IND_STRING @@ -305,22 +307,24 @@ let ''write[^ \t\r\n]*[ \t\r\n]*"\(\([^"]*\.\)\?vimrc\|[^"]*\.vim\)"''; })} - " Clear syntax that interferes with NixBlock. - " TODO redefine NixBlock so syntax don't have to be cleared - syn clear shOperator shSetList shVarAssign + " Clear syntax that interferes with nixINSIDE_DOLLAR_CURLY. + syn clear shVarAssign - syn region NixBlock + syn region nixINSIDE_DOLLAR_CURLY \ matchgroup=NixEnter \ start="[$]{" \ end="}" \ contains=TOP \ containedin=@nix_has_dollar_curly + \ transparent - syn region NixBlockHack + syn region nix_inside_curly \ matchgroup=NixEnter \ start="{" \ end="}" \ contains=TOP + \ containedin=nixINSIDE_DOLLAR_CURLY,nix_inside_curly + \ transparent syn match NixQuote /'''\([''$']\|\\.\)/he=s+2 \ containedin=@nix_ind_strings -- cgit v1.2.3 From a16f4383142403eab145a8d147e5c9c93309ba4f Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 13 Jun 2016 02:04:22 +0200 Subject: sprinkle with some write{B,D}ash --- tv/1systems/nomic.nix | 3 +-- tv/1systems/xu.nix | 3 +-- tv/2configs/pulse.nix | 3 +-- tv/5pkgs/default.nix | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) (limited to 'tv') diff --git a/tv/1systems/nomic.nix b/tv/1systems/nomic.nix index fed67a105..3696bcdfc 100644 --- a/tv/1systems/nomic.nix +++ b/tv/1systems/nomic.nix @@ -47,8 +47,7 @@ with config.krebs.lib; boot.tmpOnTmpfs = true; environment.systemPackages = with pkgs; [ - (writeScriptBin "play" '' - #! /bin/sh + (writeDashBin "play" '' set -euf mpv() { exec ${mpv}/bin/mpv "$@"; } case $1 in diff --git a/tv/1systems/xu.nix b/tv/1systems/xu.nix index a79ae498b..6ba7ab327 100644 --- a/tv/1systems/xu.nix +++ b/tv/1systems/xu.nix @@ -26,8 +26,7 @@ with config.krebs.lib; hashPassword haskellPackages.lentil parallel - (pkgs.writeScriptBin "im" '' - #! ${pkgs.bash}/bin/bash + (pkgs.writeBashBin "im" '' export PATH=${makeSearchPath "bin" (with pkgs; [ tmux gnugrep diff --git a/tv/2configs/pulse.nix b/tv/2configs/pulse.nix index 8e611f21e..512919759 100644 --- a/tv/2configs/pulse.nix +++ b/tv/2configs/pulse.nix @@ -67,8 +67,7 @@ in }; serviceConfig = { ExecStart = "${pkg}/bin/pulseaudio"; - ExecStartPre = pkgs.writeScript "pulse-start" '' - #! /bin/sh + ExecStartPre = pkgs.writeDash "pulse-start" '' install -o pulse -g pulse -m 0750 -d ${runDir} install -o pulse -g pulse -m 0700 -d ${runDir}/home ''; diff --git a/tv/5pkgs/default.nix b/tv/5pkgs/default.nix index da3c914b8..607980807 100644 --- a/tv/5pkgs/default.nix +++ b/tv/5pkgs/default.nix @@ -3,8 +3,7 @@ { nixpkgs.config.packageOverrides = { # TODO use XDG_RUNTIME_DIR? - cr = pkgs.writeScriptBin "cr" '' - #! /bin/sh + cr = pkgs.writeDashBin "cr" '' set -efu export LC_TIME=de_DE.utf8 exec ${pkgs.chromium}/bin/chromium \ -- cgit v1.2.3