nix.nixRaw
import { nix } from "https://garn.io/ts/v0.0.19/mod.ts";
const { nixRaw } = nix;
A template literal function to construct NixExpression
s from raw strings.
Example:
const myNixExpr = nixRaw`
let
x = ${someNixExpr};
y = ${otherNixExpr};
in
x y
`;
It explicitly does not allow interpolating strings since it is not clear what the correct behavior should be. Instead:
If the string you want to interpolate is a Nix expression, wrap the string
in nixRaw
before interpolating, or consider using a NixExpression
type
instead of string
.
If the string you want to interpolate is meant to turn into a string in Nix,
wrap the string in nixStrLit
before interpolating.
A template literal function to construct NixExpression
s from raw strings.
Example:
const myNixExpr = nixRaw`
let
x = ${someNixExpr};
y = ${otherNixExpr};
in
x y
`;
It explicitly does not allow interpolating strings since it is not clear what the correct behavior should be. Instead:
If the string you want to interpolate is a Nix expression, wrap the string
in nixRaw
before interpolating, or consider using a NixExpression
type
instead of string
.
If the string you want to interpolate is meant to turn into a string in Nix,
wrap the string in nixStrLit
before interpolating.