Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions modules/aztec/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{ withSystem, ... }:
{
flake.modules.nixos.aztec-sequencer =
{
pkgs,
config,
lib,
...
}:
let
cfg = config.services.aztec-sequencer;
package = withSystem pkgs.stdenv.hostPlatform.system ({ config, ... }: config.packages.aztec);
in
{
options.services.aztec-sequencer = with lib; {
enable = mkEnableOption (lib.mdDoc "Aztec Sequencer");
ethereumHosts = mkOption {
type = types.listOf types.str;
description = "Ethereum hosts for the sequencer";
};
l1ConsensusHostUrls = mkOption {
type = types.listOf types.str;
description = "L1 consensus host URLs for the sequencer";
};
coinbase = mkOption {
type = types.str;
description = "Coinbase for the sequencer";
};
p2pIp = mkOption {
type = types.str;
description = "P2P IP for the computer running the node (you can get this by running, curl api.ipify.org, on your node)";
};
p2pPort = mkOption {
type = types.port;
default = 40400;
description = "The port for the P2P service.";
};
validatorPrivateKeys = mkOption {
type = types.path;
description = "Path to private key of testnet L1 EOA that defines the sequencer identity that holds Sepolia ETH.";
};
};
config = lib.mkIf cfg.enable {
virtualisation.docker.enable = true;

systemd.tmpfiles.rules = [
"d /var/lib/aztec-sequencer 0755 root root -"
];
systemd.services.aztec-sequencer = {
description = "Aztec Sequencer";
wantedBy = [ "multi-user.target" ];
path = [ pkgs.docker ];
environment = {
HOME = "/var/lib/aztec-sequencer";
};
serviceConfig = {
WorkingDirectory = "/var/lib/aztec-sequencer";

ExecStart = pkgs.writeShellScript "aztec-sequencer" ''
${lib.getExe package} start --node --archiver --sequencer \
--network alpha-testnet \
--l1-rpc-urls ${lib.concatStringsSep "," cfg.ethereumHosts} \
--l1-consensus-host-urls ${lib.concatStringsSep "," cfg.l1ConsensusHostUrls} \
--sequencer.validatorPrivateKeys "$(cat ${cfg.validatorPrivateKeys})" \
--sequencer.coinbase ${cfg.coinbase} \
--p2p.p2pIp ${cfg.p2pIp} \
--p2p.p2pPort ${toString cfg.p2pPort}
'';
};
};

};
};
}
1 change: 1 addition & 0 deletions modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
imports = [
./lido
./pyroscope
./aztec
./folder-size-metrics
./shard-split
./random-alerts
Expand Down
42 changes: 42 additions & 0 deletions packages/aztec/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
stdenv,
fetchurl,
lib,
}:
stdenv.mkDerivation {
name = "aztec";
srcs = [
(fetchurl {
url = "https://install.aztec.network/.aztec-run";
hash = "sha256-hLLneMb+RE/+btcIz/pK54Diz5N8i4tsKz+1zZatlPQ=";
})
(fetchurl {
url = "https://install.aztec.network/aztec";
hash = "sha256-Z3tst1Fn5dQibZzaSnXzPz3DPwY6bkiRSeilM5DZbro=";
})
(fetchurl {
url = "https://install.aztec.network/aztec-up";
hash = "sha256-9mJWn+cj8loFkw/RhpV/y1rGapMYYTmiCiDmUJqeqdc=";
})
(fetchurl {
url = "https://install.aztec.network/aztec-nargo";
hash = "sha256-9T9m/Ops1O/uYKNIaBxZ9RC+q7ADQnMjRDU4oTbSORA=";
})
(fetchurl {
url = "https://install.aztec.network/aztec-wallet";
hash = "sha256-WZvmrVWEnxVRh/zwhaTk6PWSHBD8ElgX8ivODFUUZzU=";
})
];
sourceRoot = ".";
unpackCmd = ''
curTrg=$(basename $(stripHash $curSrc))
cp $curSrc $curTrg
chmod +x $curTrg
'';
installPhase = ''
mkdir -p $out/bin
cp -r * .* $out/bin/
mv $out/bin/aztec-run $out/bin/.aztec-run
'';
meta.mainProgram = "aztec";
}
1 change: 1 addition & 0 deletions packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
}
// optionalAttrs (system == "x86_64-linux" || system == "aarch64-darwin") {
secret = import ./secret { inherit inputs' pkgs; };
aztec = pkgs.callPackage ./aztec { };
}
// optionalAttrs isLinux {
folder-size-metrics = pkgs.callPackage ./folder-size-metrics { };
Expand Down