Skip to content

Commit

Permalink
Merge #2376 #2443
Browse files Browse the repository at this point in the history
2376: Only use `reorder-goals` for windows builds r=deepfire a=hamishmack

Using `reorder-goals` makes `cabal configure` work for windows, but makes it significantly slower for linux:

Without reorder goals
```
$ time nix-build -A plan-nix
...
Resolving dependencies...
...
real	1m48.648s
user	0m3.526s
sys	0m0.312s
```

With reorder goals:
```
$ time nix-build -A plan-nix
...
Resolving dependencies...
...
real	7m48.627s
user	0m4.095s
sys	0m0.369s
```


2443: CAD-2717: cardano node service extensions r=deepfire a=deepfire

1. Allow the `topology` path config option to also be a string.
2. Add the `executable` option, to allow customising the way the node is started -- so that we can, for example, use `cabal run -- cardano-node`.

Co-authored-by: Hamish Mackenzie <Hamish.K.Mackenzie@gmail.com>
Co-authored-by: Kosyrev Serge <serge.kosyrev@iohk.io>
  • Loading branch information
3 people authored Mar 4, 2021
3 parents f8b616e + 35c4f64 + c55a2f3 commit f1ffe1f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
4 changes: 0 additions & 4 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@ source-repository-package
typed-protocols-examples
Win32-network

-- Needed for the Windows cabal constraint solver.
max-backjumps: 10000
reorder-goals: True

constraints:
hedgehog >= 1.0
, bimap >= 0.4.0
Expand Down
5 changes: 5 additions & 0 deletions nix/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ let
# will run twice.
cabalProjectLocal = ''
allow-newer: terminfo:base
''
# Needed for the Windows cabal constraint solver.
+ lib.optionalString stdenv.hostPlatform.isWindows ''
max-backjumps: 10000
reorder-goals: True
'';

projectPackages = lib.attrNames (haskell-nix.haskellLib.selectProjectPackages
Expand Down
38 changes: 23 additions & 15 deletions nix/nixos/cardano-node-service.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,21 @@ let
];
};
instanceDbPath = "${cfg.databasePath}${optionalString (i > 0) "-${toString i}"}";
exec = "cardano-node run";
cmd = builtins.filter (x: x != "") [
"${cfg.package}/bin/${exec}"
"--config ${realNodeConfigFile}"
"--database-path ${instanceDbPath}"
"--topology ${topology}"
] ++ (lib.optionals (!cfg.systemdSocketActivation) ([
"--host-addr ${cfg.hostAddr}"
"--port ${toString (cfg.port + i)}"
"--socket-path ${cfg.socketPath}"
] ++ lib.optional (cfg.ipv6HostAddr != null)
"--host-ipv6-addr ${cfg.ipv6HostAddr}"
)) ++ consensusParams.${cfg.nodeConfig.Protocol} ++ cfg.extraArgs ++ cfg.rtsArgs;
cmd = builtins.filter (x: x != "") [
"${cfg.executable} run"
"--config ${realNodeConfigFile}"
"--database-path ${instanceDbPath}"
"--topology ${topology}"
] ++ (lib.optionals (!cfg.systemdSocketActivation) ([
"--host-addr ${cfg.hostAddr}"
"--port ${toString (cfg.port + i)}"
"--socket-path ${cfg.socketPath}"
] ++ lib.optional (cfg.ipv6HostAddr != null)
"--host-ipv6-addr ${cfg.ipv6HostAddr}"
)) ++ consensusParams.${cfg.nodeConfig.Protocol} ++ cfg.extraArgs ++ cfg.rtsArgs;
in ''
choice() { i=$1; shift; eval "echo \''${$((i + 1))}"; }
echo "Starting ${exec}: ${concatStringsSep "\"\n echo \"" cmd}"
echo "Starting: ${concatStringsSep "\"\n echo \"" cmd}"
echo "..or, once again, in a single line:"
echo "${toString cmd}"
${lib.optionalString (cfg.environment == "selfnode") ''
Expand Down Expand Up @@ -165,6 +164,15 @@ in {
'';
};

executable = mkOption {
type = types.str;
default = "${cfg.package}/bin/cardano-node";
defaultText = "cardano-node";
description = ''
The cardano-node executable invocation to use
'';
};

environments = mkOption {
type = types.attrs;
default = commonLib.environments;
Expand Down Expand Up @@ -391,7 +399,7 @@ in {
};

topology = mkOption {
type = types.nullOr types.path;
type = types.nullOr (types.either types.str types.path);
default = null;
description = ''
Cluster topology. If not set `producers` array is used to generated topology file.
Expand Down

0 comments on commit f1ffe1f

Please sign in to comment.