New Nix user here.
I’m trying to create a derivation for Blazegraph
from the tgz
release available here.
Blazegraph is a graph database for RDF data.
Once you extract the tgz
, inside it are multiple folders such as bin/
, conf/
, data/
, lib/
, log/
, pid/
and war/
. The blazegraph database can be launched using the command ./bin/blazegraph.sh start
. I’m trying to create a derivation to install the blazegraph
command to start the server. Afterwards, I would like to create a service which uses this command to launch the server.
However, I’m stuck on creating the derivation.
Here is my initial default.nix
:
# { stdenv, fetchurl, makeWrapper, jre }:
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "blazegraph-${version}";
version = "2.1.5";
src = fetchurl {
url = "https://github.com/blazegraph/database/releases/download/BLAZEGRAPH_RELEASE_2_1_5/blazegraph.tar.gz";
sha256 = "440cecbe1714fc8eba9ec4e798f44eecb41529394323cae9027c8d1944acd9e4";
};
phases = "installPhase";
installPhase = ''
mkdir -p $out
cd $out
cp ${src} $out
tar xvf $out/*blazegraph.tar.gz
cp -r $out/blazegraph-tgz-2.1.5/* $out
mv $out/bin/blazegraph.sh $out/bin/blazegraph
chmod +x $out/bin/blazegraph
'';
}
Afterwards, I ran nix-build
to create the result
folder and then nix-shell --pure
.
Then, when I try to run ./result/bin/blazegraph start
, I get the error
result/log/blazegraph.out: Permission denied
I’m guessing that nothing can be written inside the result
folder since it’s immutable. In that case, where do I put the folders listed above (data, configuration)? First candidate I can think of is /var/lib/blazegraph
. Any suggestions ?
The default.nix
was put inside my home directory. The output os ls -l result
is :
total 49952
dr-xr-xr-x 2 xxx xxx 4096 Dec 31 1969 bin
dr-xr-xr-x 9 xxx xxx 4096 Dec 31 1969 blazegraph-tgz-2.1.5
dr-xr-xr-x 2 xxx xxx 4096 Dec 31 1969 conf
dr-xr-xr-x 2 xxx xxx 4096 Dec 31 1969 data
dr-xr-xr-x 2 xxx xxx 4096 Dec 31 1969 lib
dr-xr-xr-x 2 xxx xxx 4096 Feb 13 17:21 log
dr-xr-xr-x 2 xxx xxx 4096 Feb 13 17:50 pid
dr-xr-xr-x 5 xxx xxx 4096 Dec 31 1969 war
-r--r--r-- 1 xxx xxx 51114828 Dec 31 1969 x5p8m36z8da5zvwarjhrkh22fdk3s1hf-blazegraph.tar.gz
The output of ls -l result/log
is:
total 16
-rw-r--r-- 1 xxx xxx 15300 Feb 13 17:19 blazegraph.out
Basically, I don’t know where I should put all those directories (data
, log
, lib
, etc.), since putting them in the result
folder does not seem to be a good solution. Any pointers would be of great help.
Thanks!