I'm trying to get a hello-world Purescript project working on NixOS, and am encountering an error trying to get spago
to build it. The installation of dependencies fails with the following error:
[error]
Failed to install dependency "console"
Git output:
fatal: destination path '.' already exists and is not an empty directory.
Aborting installation..
[error] Installation failed
[error] Error:
[error] ExitFailure 1
This seems to occur when spago
tries to clone the dependencies (like console and effect) into the current directory (.) instead of the correct subdirectory under .spago
. I don't know why git is using .
instead of, for example, .spago/console
.
I've tried:
shellHook
section of shell.nix
, below.Despite these steps, Spago still tries to install dependencies into the project directory .
and fails.
Any advice on how to resolve this issue would be appreciated.
Additional Info:
NixOS environment with a shell.nix
configuration:
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = [
pkgs.spago
pkgs.nodejs
pkgs.purescript
pkgs.git
pkgs.strace
pkgs.purescript-psa
];
shellHook = ''
unset NIX_ENFORCE_NO_NATIVE
unset NIX_LD_LIBRARY_PATH
unset NIX_CFLAGS_COMPILE
unset NIX_LDFLAGS
'';
}
Spago version: 0.21.0 PureScript version: 0.15.15 PSA version: 0.8.2
How do I resolve this, or otherwise, get hello-world Purescript working on nixos?
I found a work-around by installing spago locally via npm, instead of using nixos's installation of spago. I used npx
to reference npm's spago. Here's what worked for me.
shell.nix
:{ pkgs ? import <nixpkgs> {} }: pkgs.mkShell { buildInputs = [ pkgs.nodejs pkgs.gmp ]; shellHook = '' export LD_LIBRARY_PATH=${pkgs.gmp}/lib:$LD_LIBRARY_PATH ''; }
npm install spago --save-dev
Ensure that local version of spago is available: $ npx spago --version
0.21.0
Init: $ npx spago init
build: $ npx spago build