Closed Witcher01 closed 1 year ago
Oh I see now: maelstrom seems to generate a store
directory when running which holds testing data(?). That solves this issue :)
@Witcher01 would you be willing to share your solution? I'm currently trying to create a flake for a dev environment including maelstrom…
To be perfectly honest I gave up on creating the flake since I couldn't figure it out. Good luck, though!
I now have a flake that seems to work:
{
description = "A dev environment for Fly.io Gossip Glomers challenge";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
};
maelstrom = pkgs.stdenv.mkDerivation rec{
name = "Maelstrom";
version = "0.2.3";
src = builtins.fetchTarball {
url = "https://github.com/jepsen-io/maelstrom/releases/download/v${version}/maelstrom.tar.bz2";
sha256 = "sha256:1hkczlbgps3sl4mh6hk49jimp6wmks8hki0bqijxsqfbf0hcakwq";
};
# include upstream patch (not yet in 0.2.3)
# https://github.com/jepsen-io/maelstrom/commit/f0ce6dbc60369ec85f8cd69aa5ac953806634260
maelstromScriptPatch = pkgs.writeShellScript "maelstrom" ''
# A small wrapper script for invoking the Maelstrom jar, with arguments.
SCRIPT_DIR=$( cd -- "$( dirname "$(readlink -f "''${BASH_SOURCE[0]}")" )" &> /dev/null && pwd )
exec java -Djava.awt.headless=true -jar "''${SCRIPT_DIR}/lib/maelstrom.jar" "$@"
'';
installPhase = ''
mkdir -p $out/bin
cp -r * $out/bin/
cp $maelstromScriptPatch $out/bin/maelstrom
'';
};
in
{
devShell = pkgs.mkShell {
name = "Gossip Glomers env";
buildInputs = with pkgs; [
maelstrom
jdk
graphviz
gnuplot
# Golang
go
gopls
delve
golint
];
};
});
}
Within a nix shell (nix develop
) or using direnv the following now works:
maelstrom test -w echo --bin $(which maelstrom-echo) --node-count 1 --time-limit 10
While I also get the following lines, the rest of the script seems to run just fine:
WARNING: abs already refers to: #'clojure.core/abs in namespace: clojure.core.matrix.impl.mathsops, being replaced by: #'clojure.core.matrix.impl.mathsops/abs
Warning: protocol #'clojure.core.matrix.protocols/PMathsFunctions is overwriting function abs
WARNING: abs already refers to: #'clojure.core/abs in namespace: clojure.core.matrix.protocols, being replaced by: #'clojure.core.matrix.protocols/abs
WARNING: abs already refers to: #'clojure.core/abs in namespace: clojure.core.matrix, being replaced by: #'clojure.core.matrix/abs
WARNING: abs already refers to: #'clojure.core/abs in namespace: clojure.core.matrix.dataset, being replaced by: #'clojure.core.matrix/abs
WARNING: abs already refers to: #'clojure.core/abs in namespace: incanter.core, being replaced by: #'incanter.core/abs
INFO [2023-04-20 09:22:48,304] main - jepsen.cli Test options:
{:args [],
[…]
I'm trying to package maelstrom for myself using Nix but using the packaged version always crashes with the following backtrace:
I can't figure out what file is actually missing, nowhere can I find a reference to the given path and
strace
on a successful run doesn't mention it either.Packaging maelstrom crates
/bin/maelstrom
with the following content (nix store paths have been minimsed to what matters):lib/maelstrom.jar
is moved to/lib/maelstrom.jar
.Any ideas?