So, I’m trying to build the metakit library (It’s a dependency for a C++ thing I’m trying to build). GitHub - jnorthrup/metakit: Metakit is an efficient embedded database library with a small footprint
I noticed that there are some build instructions for this in the readme which says the following:
UNIX (ALSO MAC OS X)
It is no longer advised to build the Unix code in the "unix/" directory.
Instead, you should perform the following steps:
cd builds
sh ../unix/configure
make
make test
And optionally (this only installs the core lib, not script extensions):
make install
I’ve tried to convert this to a simple flake.nix
(NB: I have forked the repo and put the flake.nix
into that fork):
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
in {
packages.${system}.default =
pkgs.stdenv.mkDerivation
{
name = "metakit-.2.4.9.7";
src = ./.;
inherit system;
buildPhase = ''
cd builds
../unix/configure
make
'';
installPhase = ''
make install
'';
};
};
}
Running nix build
fails with the following error (slightly modified for brevity):
error: builder for '/nix/store/8j89xmcbnnpgxlb7l0cwrghc3z9py4i0-metakit-.2.4.9.7.drv' failed with exit code 2;
last few log lines:
> Running phase: installPhase
> mkdir -p /usr/local/include /usr/local/lib
> mkdir: cannot create directory '/usr': Permission denied
> mkdir: cannot create directory '/usr': Permission denied
> make: *** [Makefile:95: install-mk] Error 1