From e4fc65e079fcf2ea3d98ecde971912a7898ebc79 Mon Sep 17 00:00:00 2001 From: Matt Moriarity Date: Wed, 18 Sep 2024 17:04:48 -0600 Subject: [PATCH] nixos/garage: reformat --- nixos/modules/services/web-servers/garage.nix | 52 ++++++++++++++----- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/nixos/modules/services/web-servers/garage.nix b/nixos/modules/services/web-servers/garage.nix index 7cf71ff6ff06..8a547a8f430c 100644 --- a/nixos/modules/services/web-servers/garage.nix +++ b/nixos/modules/services/web-servers/garage.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; @@ -20,7 +25,9 @@ in type = types.attrsOf types.str; description = "Extra environment variables to pass to the Garage server."; default = { }; - example = { RUST_BACKTRACE = "yes"; }; + example = { + RUST_BACKTRACE = "yes"; + }; }; environmentFile = mkOption { @@ -30,7 +37,13 @@ in }; logLevel = mkOption { - type = types.enum ([ "error" "warn" "info" "debug" "trace" ]); + type = types.enum ([ + "error" + "warn" + "info" + "debug" + "trace" + ]); default = "info"; example = "debug"; description = "Garage log level, see for examples."; @@ -49,10 +62,12 @@ in data_dir = mkOption { default = "/var/lib/garage/data"; - example = [ { - path = "/var/lib/garage/data"; - capacity = "2T"; - } ]; + example = [ + { + path = "/var/lib/garage/data"; + capacity = "2T"; + } + ]; type = with types; either path (listOf attrs); description = '' The directory in which Garage will store the data blocks of objects. This folder can be placed on an HDD. @@ -83,7 +98,9 @@ in # These assertions can be removed in NixOS 24.11, when all users have been # warned once. { - assertion = (cfg.settings ? replication_factor || cfg.settings ? replication_mode) || lib.versionOlder cfg.package.version "1.0.0"; + assertion = + (cfg.settings ? replication_factor || cfg.settings ? replication_mode) + || lib.versionOlder cfg.package.version "1.0.0"; message = '' Garage 1.0.0 requires an explicit replication factor to be set. Please set replication_factor to 1 explicitly to preserve the previous behavior. @@ -129,14 +146,25 @@ in systemd.services.garage = { description = "Garage Object Storage (S3 compatible)"; - after = [ "network.target" "network-online.target" ]; - wants = [ "network.target" "network-online.target" ]; + after = [ + "network.target" + "network-online.target" + ]; + wants = [ + "network.target" + "network-online.target" + ]; wantedBy = [ "multi-user.target" ]; - restartTriggers = [ configFile ] ++ (lib.optional (cfg.environmentFile != null) cfg.environmentFile); + restartTriggers = [ + configFile + ] ++ (lib.optional (cfg.environmentFile != null) cfg.environmentFile); serviceConfig = { ExecStart = "${cfg.package}/bin/garage server"; - StateDirectory = mkIf (hasPrefix "/var/lib/garage" cfg.settings.data_dir || hasPrefix "/var/lib/garage" cfg.settings.metadata_dir) "garage"; + StateDirectory = mkIf ( + hasPrefix "/var/lib/garage" cfg.settings.data_dir + || hasPrefix "/var/lib/garage" cfg.settings.metadata_dir + ) "garage"; DynamicUser = lib.mkDefault true; ProtectHome = true; NoNewPrivileges = true;