From c2aa335f5fa5344690256b03be9b6b787cb45cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rolf=20Schr=C3=B6der?= Date: Thu, 31 Oct 2024 06:57:25 +0100 Subject: [PATCH] nixos/lighthouse: appply nixfmt --- .../blockchain/ethereum/lighthouse.nix | 49 +++++++++++++------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/nixos/modules/services/blockchain/ethereum/lighthouse.nix b/nixos/modules/services/blockchain/ethereum/lighthouse.nix index 8e0afa7a7ce7..31de6113a5d7 100644 --- a/nixos/modules/services/blockchain/ethereum/lighthouse.nix +++ b/nixos/modules/services/blockchain/ethereum/lighthouse.nix @@ -1,14 +1,18 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let - cfg = config.services.lighthouse; -in { - +in +{ options = { services.lighthouse = { beacon = lib.mkOption { description = "Beacon node"; - default = {}; + default = { }; type = lib.types.submodule { options = { enable = lib.mkEnableOption "Lightouse Beacon node"; @@ -133,7 +137,7 @@ in { validator = lib.mkOption { description = "Validator node"; - default = {}; + default = { }; type = lib.types.submodule { options = { enable = lib.mkOption { @@ -152,7 +156,7 @@ in { beaconNodes = lib.mkOption { type = lib.types.listOf lib.types.str; - default = ["http://localhost:5052"]; + default = [ "http://localhost:5052" ]; description = '' Beacon nodes to connect to. ''; @@ -190,7 +194,13 @@ in { }; network = lib.mkOption { - type = lib.types.enum [ "mainnet" "gnosis" "chiado" "sepolia" "holesky" ]; + type = lib.types.enum [ + "mainnet" + "gnosis" + "chiado" + "sepolia" + "holesky" + ]; default = "mainnet"; description = '' The network to connect to. Mainnet is the default ethereum network. @@ -216,15 +226,13 @@ in { }; config = lib.mkIf (cfg.beacon.enable || cfg.validator.enable) { - - environment.systemPackages = [ cfg.package ] ; + environment.systemPackages = [ cfg.package ]; networking.firewall = lib.mkIf cfg.beacon.enable { allowedTCPPorts = lib.mkIf cfg.beacon.openFirewall [ cfg.beacon.port ]; allowedUDPPorts = lib.mkIf cfg.beacon.openFirewall [ cfg.beacon.port ]; }; - systemd.services.lighthouse-beacon = lib.mkIf cfg.beacon.enable { description = "Lighthouse beacon node (connect to P2P nodes and verify blocks)"; wantedBy = [ "multi-user.target" ]; @@ -243,8 +251,8 @@ in { --datadir ${cfg.beacon.dataDir}/${cfg.network} \ --execution-endpoint http://${cfg.beacon.execution.address}:${toString cfg.beacon.execution.port} \ --execution-jwt ''${CREDENTIALS_DIRECTORY}/LIGHTHOUSE_JWT \ - ${lib.optionalString cfg.beacon.http.enable '' --http --http-address ${cfg.beacon.http.address} --http-port ${toString cfg.beacon.http.port}''} \ - ${lib.optionalString cfg.beacon.metrics.enable '' --metrics --metrics-address ${cfg.beacon.metrics.address} --metrics-port ${toString cfg.beacon.metrics.port}''} \ + ${lib.optionalString cfg.beacon.http.enable ''--http --http-address ${cfg.beacon.http.address} --http-port ${toString cfg.beacon.http.port}''} \ + ${lib.optionalString cfg.beacon.metrics.enable ''--metrics --metrics-address ${cfg.beacon.metrics.address} --metrics-port ${toString cfg.beacon.metrics.port}''} \ ${cfg.extraArgs} ${cfg.beacon.extraArgs} ''; serviceConfig = { @@ -269,7 +277,10 @@ in { RestrictNamespaces = true; LockPersonality = true; RemoveIPC = true; - SystemCallFilter = [ "@system-service" "~@privileged" ]; + SystemCallFilter = [ + "@system-service" + "~@privileged" + ]; }; }; @@ -312,8 +323,14 @@ in { RestrictNamespaces = true; LockPersonality = true; RemoveIPC = true; - RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ]; - SystemCallFilter = [ "@system-service" "~@privileged" ]; + RestrictAddressFamilies = [ + "AF_INET" + "AF_INET6" + ]; + SystemCallFilter = [ + "@system-service" + "~@privileged" + ]; }; }; };