Open chekoopa opened 5 years ago
Partly resolved by not running spago2nix
as an app, preferring a Nix-generated script instead.
buildPhase = let spagoPkgs = import ./spago-packages.nix { inherit pkgs; };
in ''
${spagoPkgs.installSpagoStyle}
${spagoPkgs.buildSpagoStyle}
'';
Could try to look at what causes some of the issues, but yeah, better to just not have to call spago2nix and use plain nix instead when using this for an actual build.
I ran into the following when trying to build in a Nix sandbox (macOS was fine) and it seems like the same issue as above.
...
building
/nix/store/63karsgdg7fm3q0if4zfd7apbd8ac1ci-stdenv-linux/setup: /nix/store/la80wr5yqk6v135jczypqsgma0c9anv9-install-spago-style: /usr/bin/env: bad interpreter: No such file or directory
This worked for me:
let removeHashBang = drv: drv.overrideAttrs (oldAttrs: {
buildCommand = builtins.replaceStrings ["#!/usr/bin/env"] [""] oldAttrs.buildCommand;
}); in
buildPhase = ''
- ${spagoPackages.installSpagoStyle}
+ ${removeHashBang spagoPackages.installSpagoStyle}
- ${spagoPackages.buildSpagoStyle} "src/**/*.purs" "test/**/*.purs"
+ ${removeHashBang spagoPackages.buildSpagoStyle} "src/**/*.purs" "test/**/*.purs"
purs bundle './output/*/*.js' --module Main --main Main --output ${exeName}
'';
should we just remove that shebang in general? might not be an issue
oops
My NixOS and Darwin builds both work without it
removeHashBang
also works for me on NixOS, broken without. Thanks for the tip!
Removing the hash-bang fixes it in nix-build
but breaks the shell when running a phase like eval $checkPhase
in a nix-shell
. Replacing the hash-bang with #!/bin/sh
seems to fix it everywhere.
For convenience
fixHashBang = drv: drv.overrideAttrs (oldAttrs: {
buildCommand = builtins.replaceStrings ["#!/usr/bin/env bash"] ["#!/bin/sh"] oldAttrs.buildCommand;
});
Unless there is a reason to not use #!/bin/sh
, I recommend replacing #!/usr/bin/env bash
with #!/bin/sh
.
Yes, that is probably fine with me. Especially considering that we do not need any glob pattern handling in the actual scripts
Please make a PR with whatever solution pleases you.
Trying to call
spago2nix
inside ofconfigurePhase
of derivation, got this:Seems that there's
node
missing in the$PATH
.