Merge pull request #37 from hackworthltd/upstream

Another error-handling fix in Nix-generated scripts.
This commit is contained in:
Justin Woo 2020-10-13 19:01:14 +03:00 committed by GitHub
commit 898798204f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -7406,7 +7406,7 @@ var PS = {};
var Simple_JSON = $PS["Simple.JSON"]; var Simple_JSON = $PS["Simple.JSON"];
var Simple_JSON_Utils = $PS["Simple.JSON.Utils"]; var Simple_JSON_Utils = $PS["Simple.JSON.Utils"];
var Sunde = $PS["Sunde"]; var Sunde = $PS["Sunde"];
var template = "# This file was generated by Spago2Nix\x0a\x0a{ pkgs ? import <nixpkgs> {} }:\x0a\x0alet\x0a inputs = {\x0aINPUTS\x0a };\x0a\x0a cpPackage = pkg:\x0a let\x0a target = \".spago/${pkg.name}/${pkg.version}\";\x0a in ''\x0a if [ ! -e ${target} ]; then\x0a echo \"Installing ${target}.\"\x0a mkdir -p ${target}\x0a cp --no-preserve=mode,ownership,timestamp -r ${toString pkg.outPath}/* ${target}\x0a else\x0a echo \"${target} already exists. Skipping.\"\x0a fi\x0a '';\x0a\x0a getGlob = pkg: ''\".spago/${pkg.name}/${pkg.version}/src/**/*.purs\"'';\x0a\x0a getStoreGlob = pkg: ''\"${pkg.outPath}/src/**/*.purs\"'';\x0a\x0ain {\x0a inherit inputs;\x0a\x0a installSpagoStyle = pkgs.writeShellScriptBin \"install-spago-style\" ''\x0a #!/usr/bin/env bash -e\x0a echo installing dependencies...\x0a ${builtins.toString (builtins.map cpPackage (builtins.attrValues inputs))}\x0a echo \"echo done.\"\x0a '';\x0a\x0a buildSpagoStyle = pkgs.writeShellScriptBin \"build-spago-style\" ''\x0a #!/usr/bin/env bash -e\x0a echo building project...\x0a purs compile ${builtins.toString (builtins.map getGlob (builtins.attrValues inputs))} \"$@\"\x0a echo done.\x0a '';\x0a\x0a buildFromNixStore = pkgs.writeShellScriptBin \"build-from-store\" ''\x0a #!/usr/bin/env bash -e\x0a echo building project using sources from nix store...\x0a purs compile ${builtins.toString (\x0a builtins.map getStoreGlob (builtins.attrValues inputs))} \"$@\"\x0a echo done.\x0a '';\x0a\x0a mkBuildProjectOutput =\x0a { src, purs }:\x0a\x0a pkgs.stdenv.mkDerivation {\x0a name = \"build-project-output\";\x0a src = src;\x0a\x0a buildInputs = [ purs ];\x0a\x0a installPhase = ''\x0a mkdir -p $out\x0a purs compile \"$src/**/*.purs\" ${builtins.toString\x0a (builtins.map\x0a (x: ''\"${x.outPath}/src/**/*.purs\"'')\x0a (builtins.attrValues inputs))}\x0a mv output $out\x0a '';\x0a };\x0a}\x0a"; var template = "# This file was generated by Spago2Nix\x0a\x0a{ pkgs ? import <nixpkgs> {} }:\x0a\x0alet\x0a inputs = {\x0aINPUTS\x0a };\x0a\x0a cpPackage = pkg:\x0a let\x0a target = \".spago/${pkg.name}/${pkg.version}\";\x0a in ''\x0a if [ ! -e ${target} ]; then\x0a echo \"Installing ${target}.\"\x0a mkdir -p ${target}\x0a cp --no-preserve=mode,ownership,timestamp -r ${toString pkg.outPath}/* ${target}\x0a else\x0a echo \"${target} already exists. Skipping.\"\x0a fi\x0a '';\x0a\x0a getGlob = pkg: ''\".spago/${pkg.name}/${pkg.version}/src/**/*.purs\"'';\x0a\x0a getStoreGlob = pkg: ''\"${pkg.outPath}/src/**/*.purs\"'';\x0a\x0ain {\x0a inherit inputs;\x0a\x0a installSpagoStyle = pkgs.writeShellScriptBin \"install-spago-style\" ''\x0a set -e\x0a echo installing dependencies...\x0a ${builtins.toString (builtins.map cpPackage (builtins.attrValues inputs))}\x0a echo \"echo done.\"\x0a '';\x0a\x0a buildSpagoStyle = pkgs.writeShellScriptBin \"build-spago-style\" ''\x0a set -e\x0a echo building project...\x0a purs compile ${builtins.toString (builtins.map getGlob (builtins.attrValues inputs))} \"$@\"\x0a echo done.\x0a '';\x0a\x0a buildFromNixStore = pkgs.writeShellScriptBin \"build-from-store\" ''\x0a set -e\x0a echo building project using sources from nix store...\x0a purs compile ${builtins.toString (\x0a builtins.map getStoreGlob (builtins.attrValues inputs))} \"$@\"\x0a echo done.\x0a '';\x0a\x0a mkBuildProjectOutput =\x0a { src, purs }:\x0a\x0a pkgs.stdenv.mkDerivation {\x0a name = \"build-project-output\";\x0a src = src;\x0a\x0a buildInputs = [ purs ];\x0a\x0a installPhase = ''\x0a mkdir -p $out\x0a purs compile \"$src/**/*.purs\" ${builtins.toString\x0a (builtins.map\x0a (x: ''\"${x.outPath}/src/**/*.purs\"'')\x0a (builtins.attrValues inputs))}\x0a mv output $out\x0a '';\x0a };\x0a}\x0a";
var spagoListPackages = (function () { var spagoListPackages = (function () {
var words = (function () { var words = (function () {
var $61 = Data_String_Common.split("\x0a"); var $61 = Data_String_Common.split("\x0a");

View File

@ -808,21 +808,21 @@ in {
inherit inputs; inherit inputs;
installSpagoStyle = pkgs.writeShellScriptBin "install-spago-style" '' installSpagoStyle = pkgs.writeShellScriptBin "install-spago-style" ''
#!/usr/bin/env bash -e set -e
echo installing dependencies... echo installing dependencies...
${builtins.toString (builtins.map cpPackage (builtins.attrValues inputs))} ${builtins.toString (builtins.map cpPackage (builtins.attrValues inputs))}
echo "echo done." echo "echo done."
''; '';
buildSpagoStyle = pkgs.writeShellScriptBin "build-spago-style" '' buildSpagoStyle = pkgs.writeShellScriptBin "build-spago-style" ''
#!/usr/bin/env bash -e set -e
echo building project... echo building project...
purs compile ${builtins.toString (builtins.map getGlob (builtins.attrValues inputs))} "$@" purs compile ${builtins.toString (builtins.map getGlob (builtins.attrValues inputs))} "$@"
echo done. echo done.
''; '';
buildFromNixStore = pkgs.writeShellScriptBin "build-from-store" '' buildFromNixStore = pkgs.writeShellScriptBin "build-from-store" ''
#!/usr/bin/env bash -e set -e
echo building project using sources from nix store... echo building project using sources from nix store...
purs compile ${builtins.toString ( purs compile ${builtins.toString (
builtins.map getStoreGlob (builtins.attrValues inputs))} "$@" builtins.map getStoreGlob (builtins.attrValues inputs))} "$@"

View File

@ -146,21 +146,21 @@ in {
inherit inputs; inherit inputs;
installSpagoStyle = pkgs.writeShellScriptBin "install-spago-style" '' installSpagoStyle = pkgs.writeShellScriptBin "install-spago-style" ''
#!/usr/bin/env bash -e set -e
echo installing dependencies... echo installing dependencies...
${builtins.toString (builtins.map cpPackage (builtins.attrValues inputs))} ${builtins.toString (builtins.map cpPackage (builtins.attrValues inputs))}
echo "echo done." echo "echo done."
''; '';
buildSpagoStyle = pkgs.writeShellScriptBin "build-spago-style" '' buildSpagoStyle = pkgs.writeShellScriptBin "build-spago-style" ''
#!/usr/bin/env bash -e set -e
echo building project... echo building project...
purs compile ${builtins.toString (builtins.map getGlob (builtins.attrValues inputs))} "$@" purs compile ${builtins.toString (builtins.map getGlob (builtins.attrValues inputs))} "$@"
echo done. echo done.
''; '';
buildFromNixStore = pkgs.writeShellScriptBin "build-from-store" '' buildFromNixStore = pkgs.writeShellScriptBin "build-from-store" ''
#!/usr/bin/env bash -e set -e
echo building project using sources from nix store... echo building project using sources from nix store...
purs compile ${builtins.toString ( purs compile ${builtins.toString (
builtins.map getStoreGlob (builtins.attrValues inputs))} "$@" builtins.map getStoreGlob (builtins.attrValues inputs))} "$@"