Skip to content

Added a module and a VM for testing#2

Open
yorickvP wants to merge 6 commits intomasterfrom
module
Open

Added a module and a VM for testing#2
yorickvP wants to merge 6 commits intomasterfrom
module

Conversation

@yorickvP
Copy link
Copy Markdown
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
Comment thread ci.nix
overlay = import ./.;
nixpkgs = import sources.nixpkgs { overlays = [ overlay ]; };
in with nixpkgs;
lib.filterAttrs (n: _: lib.hasAttr n (overlay {} {})) nixpkgs
Copy link
Copy Markdown

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

Comment thread default.nix
# to make sure people update the hash
sha256 = if version == "ceaed40" then
"1znikk7l2pv5mdl9rh59dljdrqkbwnazlpdjr4yfc87bcynb1rbz" else
"0000000000000000000000000000000000000000000000000000";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lib.fakeSha256

Comment thread modules/ton.nix
in {
options.services.ton = with lib; {
enable = mkEnableOption "ton";
ports.main = mkOption {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Description and/or default

Comment thread modules/ton.nix
example = 29108;
type = types.port;
};
ports.console = mkOption {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Description and/or default

Comment thread modules/ton.nix
example = 29109;
type = types.port;
};
ports.lite = mkOption {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Description and/or default

Comment thread modules/ton.nix
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
Copy Markdown

Choose a reason for hiding this comment

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

Quote those variables

Comment thread modules/ton.nix
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
Copy Markdown

Choose a reason for hiding this comment

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

Quote the subshell

Comment thread modules/ton.nix
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
Copy Markdown

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

Comment thread pkgs/vm.nix

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

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.

Comment thread pkgs/vm.nix
# add switch-running-vm, ssh scripts
ssh = writeShellScriptBin "ssh" ''
set -e
ssh -o StrictHostKeyChecking=no -i ${
Copy link
Copy Markdown

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