Skip to content

Commit

Permalink
fixed test build
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Mar 18, 2024
1 parent 0c08e2f commit 81531ec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ in {
...
}: let
prev = config.hermes;
# remove `null` from toml render
cfg = prev // {chains = builtins.map (pkgs.lib.filterAttrsRecursive (_: v: v != null)) prev.chains;};
hermes-toml = nix-std.lib.serde.toTOML (builtins.removeAttrs cfg ["toml"]);
in
Expand Down
15 changes: 9 additions & 6 deletions nixosModules/hermes/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
pkgs,
...
}: let
hermes-path = lib.meta.getExe hermes;
defaultPackage =
if hermes != null
then hermes
else pkgs.hermes;
prev = config.services.hermes;
sanitizedCfg =
# remove non toml parts
(builtins.map (pkgs.lib.filterAttrs (k: _: k == "package")) prev)
(builtins.removeAttrs prev ["package"])
// {
chains =
# remove `null` from toml render
Expand All @@ -28,23 +31,23 @@ in
// {
enable = mkEnableOption "hermes";
package = mkOption {
type = types.str;
default = hermes-path;
type = types.package;
default = defaultPackage;
description = ''
The hermes (ibc-rs) software to run.
'';
};
};

config = mkIf cfg.enable {
config = mkIf sanitizedCfg.enable {
systemd.services.hermes = {
description = "Hermes Daemon";
wantedBy = ["multi-user.target"];
after = ["network.target"];
preStart = "echo \"hermes toml can be found here: ${hermes-toml}\"";
serviceConfig = {
Type = "notify";
ExecStart = "${cfg.package} -c ${hermes-toml} start";
ExecStart = "${pkgs.lib.meta.getExe config.services.hermes.package} -c ${hermes-toml} start";
};
};
};
Expand Down
1 change: 1 addition & 0 deletions nixosTests/tests/hermes-test.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
pkgs,
nix-std,
gaia,
hermes,
}: let
Expand Down

0 comments on commit 81531ec

Please sign in to comment.