Loading pkgs/development/tools/misc/ctags/wrapped.nix +79 −67 Original line number Diff line number Diff line { pkgs, ctags }: with pkgs.lib; { lib, ctags, writeTextFile, runtimeShell, ctagsWrapped, name ? "${ctags.name}-wrapped", args ? lib.concatLists [ ctagsWrapped.defaultArgs ctagsWrapped.phpLang ctagsWrapped.jsLang ctagsWrapped.nixLang ctagsWrapped.asLang ctagsWrapped.rubyLang ], }: # define some ctags wrappers adding support for some not that common languages # customization: # a) add stuff here # b) override asLang, phpLang, ... using packageOverrides # c) use ctagsWrapped.override {args = [ your liste ];} # Define a ctags wrapper derivation adding support for some not-that-common languages customization. # Override this to provide different args. # install using -iA ctagsWrapped.ctagsWrapped writeTextFile { inherit name; executable = true; destination = "/bin/${name}"; text = '' #!${runtimeShell} exec ${ctags}/bin/ctags ${lib.concatStringsSep " " (map lib.escapeShellArg args)} "$@" ''; derivationArgs = { # Inherit the metadata from the parent `ctags` derivation. inherit (ctags) meta; { # the derivation. use language extensions specified by args ctagsWrapped = makeOverridable ( {args, name} : pkgs.writeScriptBin name '' #!${pkgs.runtimeShell} exec ${pkgs.ctags}/bin/ctags ${concatStringsSep " " (map escapeShellArg args)} "$@" '') { args = let x = pkgs.ctagsWrapped; in concatLists [ x.defaultArgs x.phpLang x.jsLang x.nixLang x.asLang x.rubyLang ]; name = "${ctags.name}-wrapped"; }; passthru = { # `ctagsWrapped` exists for backwards compatibility; ctagsWrapped used to be an attrset and # now is a derivation, so keep supporting the use of `ctagsWrapped.ctagsWrapped`. inherit ctagsWrapped; ### language arguments Loading Loading @@ -59,9 +71,7 @@ with pkgs.lib; # { # a : function () {} # only recognize names up 100 characters. Else you'll be in trouble scanning compressed .js files. jsLang = [ "--regex-JavaScript=/([^ \\t]{1,100})[ \\t]*:[ \\t]*function[ \\t]*\\(/\\1/f/" ]; jsLang = [ "--regex-JavaScript=/([^ \\t]{1,100})[ \\t]*:[ \\t]*function[ \\t]*\\(/\\1/f/" ]; # find foo in "foo =", don't think we can do a lot better nixLang = [ Loading @@ -75,4 +85,6 @@ with pkgs.lib; "--regex-RUBY=/class ([^ ]*)/\\1/c/" "--regex-RUBY=/^[ ]*module[ ]*([^ ]*)/\\1/m/" ]; }; }; } Loading
pkgs/development/tools/misc/ctags/wrapped.nix +79 −67 Original line number Diff line number Diff line { pkgs, ctags }: with pkgs.lib; { lib, ctags, writeTextFile, runtimeShell, ctagsWrapped, name ? "${ctags.name}-wrapped", args ? lib.concatLists [ ctagsWrapped.defaultArgs ctagsWrapped.phpLang ctagsWrapped.jsLang ctagsWrapped.nixLang ctagsWrapped.asLang ctagsWrapped.rubyLang ], }: # define some ctags wrappers adding support for some not that common languages # customization: # a) add stuff here # b) override asLang, phpLang, ... using packageOverrides # c) use ctagsWrapped.override {args = [ your liste ];} # Define a ctags wrapper derivation adding support for some not-that-common languages customization. # Override this to provide different args. # install using -iA ctagsWrapped.ctagsWrapped writeTextFile { inherit name; executable = true; destination = "/bin/${name}"; text = '' #!${runtimeShell} exec ${ctags}/bin/ctags ${lib.concatStringsSep " " (map lib.escapeShellArg args)} "$@" ''; derivationArgs = { # Inherit the metadata from the parent `ctags` derivation. inherit (ctags) meta; { # the derivation. use language extensions specified by args ctagsWrapped = makeOverridable ( {args, name} : pkgs.writeScriptBin name '' #!${pkgs.runtimeShell} exec ${pkgs.ctags}/bin/ctags ${concatStringsSep " " (map escapeShellArg args)} "$@" '') { args = let x = pkgs.ctagsWrapped; in concatLists [ x.defaultArgs x.phpLang x.jsLang x.nixLang x.asLang x.rubyLang ]; name = "${ctags.name}-wrapped"; }; passthru = { # `ctagsWrapped` exists for backwards compatibility; ctagsWrapped used to be an attrset and # now is a derivation, so keep supporting the use of `ctagsWrapped.ctagsWrapped`. inherit ctagsWrapped; ### language arguments Loading Loading @@ -59,9 +71,7 @@ with pkgs.lib; # { # a : function () {} # only recognize names up 100 characters. Else you'll be in trouble scanning compressed .js files. jsLang = [ "--regex-JavaScript=/([^ \\t]{1,100})[ \\t]*:[ \\t]*function[ \\t]*\\(/\\1/f/" ]; jsLang = [ "--regex-JavaScript=/([^ \\t]{1,100})[ \\t]*:[ \\t]*function[ \\t]*\\(/\\1/f/" ]; # find foo in "foo =", don't think we can do a lot better nixLang = [ Loading @@ -75,4 +85,6 @@ with pkgs.lib; "--regex-RUBY=/class ([^ ]*)/\\1/c/" "--regex-RUBY=/^[ ]*module[ ]*([^ ]*)/\\1/m/" ]; }; }; }