Nix is a purely functional package manager that creates reproducible, declarative and reliable systems. This is the only dependency required to build Cardano DB Sync.
This guide assumes you have the following tools:
Nix will handle all other dependencies.
Create a working directory for your builds:
mkdir -p ~/src
cd ~/src
Enable Flakes (and IFD support):
sudo mkdir -p /etc/nix
cat <<EOF | sudo tee /etc/nix/nix.conf
experimental-features = nix-command flakes
allow-import-from-derivation = true
EOF
Check this page for further instructions.
sudo mkdir -p /etc/nix
cat <<EOF | sudo tee -a /etc/nix/nix.conf
substituters = https://cache.nixos.org https://cache.iog.io
trusted-public-keys = cache.iog.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
EOF
Enter the working directory for your builds:
cd ~/src
Find the latest release here: https://github.com/input-output-hk/cardano-db-sync/releases
Check out the latest release version:
git clone https://github.com/input-output-hk/cardano-db-sync.git
cd cardano-db-sync
git fetch --all --tags
git checkout tags/<VERSION>
Build Cardano DB Sync with nix
:
nix build .
This will build the executable and link it in ./result
.
Install it in your nix proile:
nix profile install .
Check the version that has been installed:
cardano-db-sync --version