tools for building gleam projects with nix

buildGleamApplication: allow specifying runtime, create wrapper using runtime

foxgirl.engineering cdd981c6 1ab77734

verified
+9
+9
nix/build-gleam-application.nix
··· 31 gleamNix, 32 erlang ? inputs.erlang, 33 gleam ? inputs.gleam, 34 35 target ? "erlang", 36 buildGleamArgs ? { }, ··· 82 erlang 83 gleam 84 target 85 ; 86 87 nativeBuildInputs = nativeBuildInputs ++ [ ··· 120 ${lib.concatMapStringsSep "\n" (package: "ln -s ${package}/* $out/lib/") compiledPackages} 121 122 mv gleam_entrypoint.mjs $out/lib/ 123 '' 124 } 125
··· 31 gleamNix, 32 erlang ? inputs.erlang, 33 gleam ? inputs.gleam, 34 + jsRuntime ? null, 35 36 target ? "erlang", 37 buildGleamArgs ? { }, ··· 83 erlang 84 gleam 85 target 86 + jsRuntime 87 ; 88 89 nativeBuildInputs = nativeBuildInputs ++ [ ··· 122 ${lib.concatMapStringsSep "\n" (package: "ln -s ${package}/* $out/lib/") compiledPackages} 123 124 mv gleam_entrypoint.mjs $out/lib/ 125 + 126 + ${lib.optionalString (finalAttrs.jsRuntime != null) '' 127 + makeWrapper ${lib.getExe finalAttrs.jsRuntime} $out/bin/${finalAttrs.pname} --add-flags \ 128 + "${ 129 + lib.optionalString (finalAttrs.jsRuntime.pname != "deno") "--preserve-symlinks" 130 + } $out/lib/gleam_entrypoint.mjs" 131 + ''} 132 '' 133 } 134