View on GitHub
File Changes
m
+1/-1
    gitrev = cardano-sl-src.rev;
  };
  mantis-pkgs     = commonLib.fetchProjectPackages "mantis"     <mantis>     ./goguen/pins   mantisRevOverride  args;
-
  cardano-node-srcs = sources.cardano-node.revOverride cardanoNodeRevOverride;
+
  cardano-node-srcs = ../cardano-node;
  cardano-node-pkgs = import cardano-node-srcs {};

                      
  iohk-ops = pkgs.haskell.lib.overrideCabal
-
with import ../lib.nix;
-

                      
{ config, pkgs, lib, options, ... }:
+
with lib;
let
  cfg = config.services.cardano-node-legacy;
  name = "cardano-node";

                      
  command = toString [
    cfg.executable
-
    (optionalString (cfg.publicIP != null && config.params.name != "explorer")
+
    (optionalString (cfg.publicIP != null && cfg.name != "explorer")
     "--address ${cfg.publicIP}:${toString cfg.port}")
-
    (optionalString (config.params.name != "explorer")
+
    (optionalString (cfg.name != "explorer")
     "--listen ${cfg.privateIP}:${toString cfg.port}")
    # Profiling
    # NB. can trigger https://ghc.haskell.org/trac/ghc/ticket/7836
    (optionalString cfg.jsonLog "--json-log ${stateDir}/jsonLog.json")
    (optionalString (cfg.statsdServer != null) "--metrics +RTS -T -RTS --statsd-server ${cfg.statsdServer}")
    (optionalString (cfg.serveEkg)             "--ekg-server ${cfg.privateIP}:8080")
-
    (optionalString (cfg.productionMode && config.params.name != "explorer")
+
    (optionalString (cfg.productionMode && cfg.name != "explorer")
      "--keyfile ${stateDir}/key${toString cfg.nodeIndex}.sk")
-
    (optionalString (cfg.productionMode && config.global.systemStart != 0) "--system-start ${toString config.global.systemStart}")
+
    (optionalString (cfg.productionMode && cfg.systemStart != 0) "--system-start ${toString cfg.systemStart}")
    (optionalString cfg.supporter "--supporter")
    "--log-config ${cardano-config}/log-configs/cluster.yaml"
    "--logs-prefix /var/lib/cardano-node"
    "--configuration-key ${config.deployment.arguments.configurationKey}"
    "--topology ${cfg.topologyYaml}"
    (optionalString (cfg.assetLockFile != null) "--asset-lock-file ${cfg.assetLockFile}")
-
    "--node-id ${config.params.name}"
-
    (optionalString cfg.enablePolicies ("--policies " + (if (config.params.typeIsCore) then "${../benchmarks/policy_core.yaml}" else "${../benchmarks/policy_relay.yaml}")))
+
    "--node-id ${cfg.name}"
+
    (optionalString cfg.enablePolicies ("--policies " + (if cfg.nodeType == "core" then "${../benchmarks/policy_core.yaml}" else "${../benchmarks/policy_relay.yaml}")))
    (optionalString cfg.enableProfiling "+RTS -p -RTS")
  ];
in {
  options = {
    services.cardano-node-legacy = {
+
      name = mkOption { type = types.str; };
+
      
      enable = mkEnableOption name;
      port = mkOption { type = types.int; default = 3000; };
      systemStart = mkOption { type = types.int; default = 0; };

                      
+
      preseedDB = mkOption { type = types.nullOr types.path; default = null; };
+
      
      enableP2P = mkOption { type = types.bool; default = true; };
      supporter = mkOption { type = types.bool; default = false; };
      enableProfiling = mkOption { type = types.bool; default = false; };
  };

                      
  config = mkIf cfg.enable {
-
    services.cardano-node-legacy.serveEkg = config.global.enableEkgWeb;
-

                      
    assertions = [
    { assertion = cfg.nodeType != null;
      message = "services.cardano-node-legacy.type must be set to one of: core relay other"; }
      description   = "cardano node service";
      after         = [ "network.target" ];
      wantedBy = optionals cfg.autoStart [ "multi-user.target" ];
+
      preStart = optionalString (cfg.preseedDB != null) ''
+
        if test ! -d ${stateDir}/node-db
+
        then cp    ${cfg.preseedDB} ${stateDir}/node-db -r
+
             chown     cardano-node ${stateDir}/node-db -R
+
             chmod u+w cardano-node ${stateDir}/node-db -R
+
        fi
+
      '';
      script = let
        key = "key${toString cfg.nodeIndex}.sk";
      in ''
let
+
  sources = import ../../nix/sources.nix;
  inherit (import ../.. {}) cardano-node-pkgs cardano-node-srcs;
in
{
    deployment.virtualbox.memorySize = 1024;
  };

                      
-
  a-node = { pkgs, ... }: {
+
  a-node = { pkgs, config, lib, ... }: with builtins; with lib; {
    imports = [
      (cardano-node-srcs + "/nix/nixos/cardano-node-service.nix")
      (cardano-node-srcs + "/nix/nixos/cardano-cluster-service.nix")
      (cardano-node-srcs + "/nix/nixos/chairman-as-a-service.nix")
+
      # (cardano-node-srcs + "/nix/nixos/cardano-node-legacy-service.nix")
+
      (sources.cardano-byron-proxy + "/nix/nixos")
+
      ../../modules/cardano-service.nix
    ];
-
    # services.cardano-node.enable = true;
-
    services.chairman.enable = true;
-
    services.cardano-cluster = {
+
    services.dnsmasq.enable = true;
+
    services.dnsmasq.servers = [ "127.0.0.1" ];
+
    services.cardano-node-legacy = {
      enable = true;
-
      node-count = 3;
+
      nodeType = "relay";
+
      nodeIndex = 0;
+
      name = "r-a-1";
+
      systemStart = 1506203091;
+
      topologyYaml = ../../topology-isolated-relay.yaml;
+
      preseedDB = pkgs.runCommand "node-db-seed" {} ''
+
        mkdir $out
+
        tar xaf ${../../static/node-db.mainnet.tar.xz} -C $out
+
      '';
    };
+
    networking.extraHosts = ''
+
      127.0.0.1 r-a-1.cardano
+
    '';
+
    deployment.arguments.configurationKey = "mainnet_full";
+

                      
+
    services.byron-proxy = {
+
      enable = true;
+
      environment = "mainnet";
+
      topologyFile = toFile "proxy-topology.yaml" ''
+
        wallet:
+
          relays: [[{ host: r-a-1.cardano }]]
+
        '';
+
    };
+
     
+
    # services.cardano-node.enable = true;
+
    # services.chairman.enable = true;
+
    # services.cardano-cluster = {
+
    #   enable = true;
+
    #   node-count = 3;
+
    # };
  };
}
+
nodes:
+
  'r-a-1':
+
    region: ap-northeast-1
+
    zone: ap-northeast-1a
+
    type: relay
+
    org: IOHK
+
    host: r-a-1.cardano
+
    kademlia: false
+
    public: true
+
    static-routes: [['r-a-1']]