summaryrefslogtreecommitdiff
path: root/lib/generators.nix
diff options
context:
space:
mode:
authorMatt Sturgeon <matt@sturgeon.me.uk>2025-03-15 11:40:47 +0000
committerMatt Sturgeon <matt@sturgeon.me.uk>2025-03-15 11:40:47 +0000
commit0be0e7529b7842823846ca4b3e594f40b479ae22 (patch)
tree2ed8e5a3fa6c30b870ceb28b4d6b0a2b6b27fd33 /lib/generators.nix
parentlib.types: add `luaInline` (diff)
downloadnixpkgs-0be0e7529b7842823846ca4b3e594f40b479ae22.tar.gz
lib.generators.toLua: support path-values
Diffstat (limited to 'lib/generators.nix')
-rw-r--r--lib/generators.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/generators.nix b/lib/generators.nix
index 352644df0431..eb8d76626e71 100644
--- a/lib/generators.nix
+++ b/lib/generators.nix
@@ -743,6 +743,8 @@ in rec {
"nil"
else if isInt v || isFloat v || isString v || isBool v then
toJSON v
+ else if isPath v || isDerivation v then
+ toJSON "${v}"
else if isList v then
(if v == [ ] then "{}" else
"{${introSpace}${concatItems (map (value: "${toLua innerArgs value}") v)}${outroSpace}}")
@@ -752,8 +754,6 @@ in rec {
"(${v.expr})"
else if v == { } then
"{}"
- else if isDerivation v then
- ''"${toString v}"''
else
"{${introSpace}${concatItems (
mapAttrsToList (key: value: "[${toJSON key}] = ${toLua innerArgs value}") v