1# Sample Nix file 2# --------------- 3let 4 bool = true && false; 5 var1 = if 3 < 4 then "a" else "b"; 6in { 7 /* 8 Multi-line comments 9 */ 10 inherit var1; 11 12 var2 = with builtins; [ 13 0 1 2 (-3) (-4) 14 123.456 .12e34 15 (12 + 345 * 6789 / 321) 16 ]; 17 18 var3 = [ 19 "Single-line string" 20 " 21 Multi-line string 22 " 23 '' 24 Indented string. 25 '' 26 ]; 27 nested.var4 = [ 28 "String with ${var1}" 29 "Another one with escaped \${var1}" 30 '' 31 Document with ${var1} 32 which is ''${var1} 33 '' 34 '' 35 My home: ${builtins.getEnv "HOME"} 36 Escaped tab: ''\\t 37 '' 38 ]; 39 40 nested.a.imported = (import ./example.nix); 41 42 fn = (x: y: x + y); 43 44 fn1 = { a, b ? import ./file.nix, c ? { a = 1; b = 2; }, ... }: rec { 45 inherit (import ./.); 46 x = a; 47 }; 48} 49