Warning, /frameworks/syntax-highlighting/autotests/input/test.nix is written in an unsupported language. File is not indexed.
0001 # Sample Nix file
0002 # ---------------
0003 let
0004 bool = true && false;
0005 var1 = if 3 < 4 then "a" else "b";
0006 in {
0007 /*
0008 Multi-line comments
0009 */
0010 inherit var1;
0011
0012 var2 = with builtins; [
0013 0 1 2 (-3) (-4)
0014 123.456 .12e34
0015 (12 + 345 * 6789 / 321)
0016 ];
0017
0018 var3 = [
0019 "Single-line string"
0020 "
0021 Multi-line string
0022 "
0023 ''
0024 Indented string.
0025 ''
0026 ];
0027 nested.var4 = [
0028 "String with ${var1}"
0029 "Another one with escaped \${var1}"
0030 ''
0031 Document with ${var1}
0032 which is ''${var1}
0033 ''
0034 ''
0035 My home: ${builtins.getEnv "HOME"}
0036 Escaped tab: ''\\t
0037 ''
0038 ];
0039
0040 nested.a.imported = (import ./example.nix);
0041
0042 fn = (x: y: x + y);
0043
0044 fn1 = { a, b ? import ./file.nix, c ? { a = 1; b = 2; }, ... }: rec {
0045 inherit (import ./.);
0046 x = a;
0047 };
0048 }