Skip to content

Conversation

yorickvP
Copy link
Contributor

@yorickvP yorickvP commented Dec 7, 2019

(vm instructions: nix-build ci.nix -A ton-vm && ./result/bin/run-nixos-vm)

to figure out:

  • can we actually regenerate the whole config file every time or does it use it as state
  • why can't it download any blockchain?

@yorickvP yorickvP requested review from kirelagin and mkaito December 7, 2019 07:18
overlay = import ./.;
nixpkgs = import sources.nixpkgs { overlays = [ overlay ]; };
in with nixpkgs;
lib.filterAttrs (n: _: lib.hasAttr n (overlay {} {})) nixpkgs
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment clarifying what this does and why

# to make sure people update the hash
sha256 = if version == "ceaed40" then
"1znikk7l2pv5mdl9rh59dljdrqkbwnazlpdjr4yfc87bcynb1rbz" else
"0000000000000000000000000000000000000000000000000000";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib.fakeSha256

in {
options.services.ton = with lib; {
enable = mkEnableOption "ton";
ports.main = mkOption {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description and/or default

example = 29108;
type = types.port;
};
ports.console = mkOption {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description and/or default

example = 29109;
type = types.port;
};
ports.lite = mkOption {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description and/or default

fi
IP=$(curl https://ifconfig.me)
rm -f db/config.json
validator-engine -C $HOME/etc/ton-global.config.json --db $HOME/db --ip $IP:${
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quote those variables

base64 server.pub
if [ ! -e lite_id ]; then
generate-random-id -m keys -n lite | tee lite_id
mv lite db/keyring/$(awk '{print $1}' lite_id)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quote the subshell

base64 lite.pub
LITE_B64=$(awk '{print $2}' lite_id)
cp server.pub lite.pub /run/ton
sed -e "s/@SERVER_B64@/$SERVER_B64/g" -e "s/@LITE_B64@/$LITE_B64/g" < ${config_merge_template} > config_merge.json
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Break up into multiple lines for better readability


}).config.system.build.vm.overrideAttrs (old:
let
# add switch-running-vm, ssh scripts
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this commend should be on the next attribute.

# add switch-running-vm, ssh scripts
ssh = writeShellScriptBin "ssh" ''
set -e
ssh -o StrictHostKeyChecking=no -i ${
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably also want -o UserKnownHostsFile=/dev/null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants