Hi friends,
I’d like to use a go library in haskell.
Can someone help me how to build the .a
and/or .so
file from go? I got it working manually by running go build -buildmode=c-archive -o bubbletea.a main.go
and then referencing that from haskell, but my haskell derivation wants the package as input, so I need a nix derivation to build this file.
I have tried the following:
pkgs.buildGoModule {
name = "bubbletea";
src = ./golang;
vendorHash = null;
buildPhase = ''
go build -trimpath -buildmode=c-archive -o libbubbletea.a $src/main.go
'';
installPhase = ''
mkdir $out
cp libbubbletea.a $out/
'';
};
This complains with
error: output '/nix/store/d24j89cjs6j0hm9v9597f870yil1p5qd-bubbletea' is not allowed to refer to the following paths:
/nix/store/y7abhs9glxfcg7lgcdc8i4ml5wg5ly92-go-1.21.4
Has anyone tried this? Am I even looking the right way?