Skip to content
Snippets Groups Projects
  1. Dec 31, 2007
  2. Dec 30, 2007
  3. Dec 14, 2007
  4. Dec 13, 2007
  5. Dec 12, 2007
  6. Dec 10, 2007
  7. Dec 06, 2007
  8. Dec 04, 2007
  9. Nov 30, 2007
    • Eelco Dolstra's avatar
      * Added a new kind of multi-line string literal delimited by two · 6d6c68c0
      Eelco Dolstra authored
        single quotes.  Example (from NixOS):
      
          job = ''
            start on network-interfaces
      
            start script
      
              rm -f /var/run/opengl-driver
              ${if videoDriver == "nvidia"        
                then "ln -sf ${nvidiaDrivers} /var/run/opengl-driver"
                else if cfg.driSupport
                then "ln -sf ${mesa} /var/run/opengl-driver"
                else ""
              }
      
              rm -f /var/log/slim.log
      
            end script
          '';
      
        This style has two big advantages:
      
        - \, ' and " aren't special, only '' and ${.  So you get a lot less
          escaping in shell scripts / configuration files in Nixpkgs/NixOS.
          The delimiter '' is rare in scripts (and can usually be written as
          "").  ${ is also fairly rare.
      
          Other delimiters such as <<...>>, {{...}} and <|...|> were also
          considered but this one appears to have the fewest drawbacks
          (thanks Martin).
      
        - Indentation is intelligently stripped so that multi-line strings
          can follow the nesting structure of the containing Nix
          expression.  E.g. in the example above 6 spaces are stripped from
          the start of each line.  This prevents unnecessary indentation in
          generated files (which sometimes even breaks things).
      
        See tests/lang/eval-okay-ind-string.nix for some examples.
      
      6d6c68c0
  10. Nov 29, 2007
  11. Nov 21, 2007
  12. Nov 16, 2007
  13. Nov 15, 2007
  14. Nov 05, 2007
  15. Nov 01, 2007
  16. Oct 31, 2007
  17. Oct 29, 2007
Loading