I have tried the recommended Nix build mode but the second step failed.
I executed the nix-build command but then the subsequent ls command fails because the bin folder does not exist:
Same problem here, my build was unsuccessful as well, albeit at a different step. Iâll post the corresponding console output once I get my hands on my nix machine
Hi. The link step appears to be no longer required. I saw some disussion and a pull request for the docs. Iâve started to put together two Dockerfiles here that follow the steps of how I think I ended up building locally here https://github.com/hcvst/cardano-daedalus-docker.
Under the section titled, âNOTE: the various other Cardano components can be obtained through other attributes:â it shows which executables you can create using which attribute. For example, to build cardano-node, cardano-wallet-hs2purs, and cardano-swagger, you need the âcardano-sl-walletâ, so you should run:
nix-build -A cardano-sl-wallet --cores 0 --max-jobs 2 --no-build-output --out-link cardano-sl-1.0
Note that when you build one attribute, it will remove the output from any prior attribute. So, you really canât build everything together.
FYI, I got it to build, but had to do a lot of hacky things. Here are the notes. This looks like a script, but it wonât work like one. You have to read the comments and copy/paste the lines individually.
#DISCLAIMER: I will swallow my pride and admit I'm not sure what I'm
#doing here. I don't know much about node, or nix. I was able to cobble
#this guide/script together by trial and error and some lucky guesses.
#Good luck!
#Note that you probably don't want to just run this blindly. That
#might work, but if it doesn't you wont know where the script failed,
#because if a step fails, the script will ignore the failure and
#continue on.
#Besides which, you have to do some prep work:
# You need to follow all the steps from the following website, up to
# "NOTE: the various other Cardano components can be obtained through
# other attributes:" using the "nix" (recommended) method in the web
# page
# https://github.com/input-output-hk/cardano-sl/blob/develop/docs/how-to/build-cardano-sl-and-daedalus-from-source-code.md
#Better to put this script in an editor, such as emacs (and never vi, no)
#and copy paste it into the commandline, one step at a time
#you'll need two git repositories, cardano-sl and daedalus
#Follow the instructions above to get the cardano-sl repository.
#You can get daedalus as follows. Put it in the same directory as
#cardano-sl (not inside cardano-sl, but at the same level)
git clone https://github.com/input-output-hk/daedalus.git
cd daedalus
#version 0.8.0 seems to work. v1.0-daedalus-rc1 gets as far as loading
#the block chain, but hangs when it gets to 100%
git checkout 0.8.0
cd ..
#we work with version 1.0.3 of cardano
#Note: the code has been changing rapidly lately, and some of the scripts available in
#v1.0.3 are no longer there in master.
#Note also that the dev team seem to not care about breaking tags...
#tag v1.0.3 once had ./scripts/launch/connect-to-cluster/mainnet.sh
# but they removed it and kept the same tag. I mean, come on...
#So this version works against v1.0.3 0c1fab91a7358fcb4c151a3a028ed650f7a36cbd
git checkout 0c1fab91a7358fcb4c151a3a028ed650f7a36cbd # same as v1.0.3 the time of this writing
#first we build cardano-sl
cd cardano-sl
# create a directory to hold the output
mkdir cardano-sl-all-1.0/
# we build all the attributes, one at a time, and collect the results
# (from "NOTE: the various other Cardano components can be obtained
# through other attributes:" in
# https://github.com/input-output-hk/cardano-sl/blob/develop/docs/how-to/build-cardano-sl-and-daedalus-from-source-code.md)
for i in cardano-sl-static cardano-report-server-static cardano-sl-auxx cardano-sl-explorer-static cardano-sl-tools cardano-sl-wallet
do
echo "Building $i..."
nix-build -A $i --cores 0 --max-jobs 2 --no-build-output --out-link cardano-sl-1.0
# we collect the output into the single directory
cp -r cardano-sl-1.0/* cardano-sl-all-1.0/
# in order to get around the fact that subdirectories will be
# created as read-only, preventing further files from being added
# from later compiles, we make everything writable in the output dir
chmod +w -R cardano-sl-all-1.0/
done
# remove the link from the last build
rm cardano-sl-1.0
# link our frankenstein output directory so further scripts that
# reference cardano-sl-1.0 work properly
ln -s cardano-sl-all-1.0 cardano-sl-1.0
#take a look at what we did
find cardano-sl-1.0/
#now we want to build daedalus. Unfortuantely, the daedalus script
#uses a stack build, and we just built nix, so we reach in and grab
#what we need
# copied from scripts/build/daedalus-bridge.sh
echo "2. Generating types for Bridge..."
export PATH=`pwd`/cardano-sl-1.0/bin:$PATH
stack exec -- cardano-wallet-hs2purs
# That step should have created the following files:
# ./daedalus/src/Generated/Pos/Wallet/Web/Sockets/Types.purs
# ./daedalus/src/Generated/Pos/Wallet/Web/Error/Types.purs
# ./daedalus/src/Generated/Pos/Wallet/Web/ClientTypes/Types.purs
# ./daedalus/src/Generated/Pos/Util/BackupPhrase.purs
# ./daedalus/src/Generated/Pos/Core/Update/Types.purs
# ./daedalus/src/Generated/Pos/Core/Common/Types.purs
# ./daedalus/src/Generated/Pos/Client/Txp/Util.purs
echo "3. Building Bridge..."
#note that this is the daedalus sub-directory within cardano-sl, not
#the separate git project called "daedalus", ie "cardano-sl/daedalus",
#not "daedalus"
cd ../cardano-sl/daedalus
npm install
npm run build:prod
cd ../../cardano-sl/ # I just do this silly ../cardano-sl/ so it's
# obvious what directory I want to be in
# now we just need to build daedalus, so this follows instructions
# from here: https://github.com/input-output-hk/daedalus
cd ../daedalus
npm install
cd ../cardano-sl/daedalus
#note, depending on how you set up npm, you may need to run as root
#I know that at least the following steps create the following links
#They probably do more, dunno
# lrwxrwxrwx 1 root root 38 Dec 23 15:11 daedalus-client-api -> /home/tim/projects/cardano-sl/daedalus
npm link
npm link daedalus-client-api
#Now to run
#This runs the node thingy frontend
#Be patient, takes a few minutes
cd ../../daedalus
NETWORK=mainnet npm run dev
#Probably best to run from another window...
#This runs the node
cd ../cardano-sl/
export PATH=`pwd`/cardano-sl-1.0/bin:$PATH
readonly TMP_TOPOLOGY_YAML=/tmp/topology.yaml
readonly CLUSTER=mainnet
printf "wallet:
relays: [[{ host: relays.cardano-mainnet.iohk.io }]]
valency: 1
fallbacks: 7" > "${TMP_TOPOLOGY_YAML}"
stack exec -- cardano-node \
--tlscert ./scripts/tls-files/server.crt \
--tlskey ./scripts/tls-files/server.key \
--tlsca ./scripts/tls-files/ca.crt \
--no-ntp \
--topology "${TMP_TOPOLOGY_YAML}" \
--log-config scripts/log-templates/log-config-qa.yaml \
--logs-prefix "logs/${CLUSTER}" \
--db-path db-${CLUSTER} \
--wallet-db-path wdb-${CLUSTER} \
--keyfile secret-$CLUSTER.key \
--configuration-file node/configuration.yaml \
--configuration-key mainnet_full
Edit: editted comments to be more readable in this forum