diff options
author | Pascal Bach <pascal.bach@nextrem.ch> | 2021-06-30 08:10:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-30 08:10:27 +0200 |
commit | 69f2fd97210f60d5a51d7d2abd9a6635e2f5836b (patch) | |
tree | d6b28fd13c19c7313df8c85ac400e2ad58ebc35e /nixos/modules/services/web-servers | |
parent | c9ea6baaf916bbe0b60dd58f94ad7b27935d7cdb (diff) | |
parent | b1b9e003dcc41e4c9f9672fc5cd4a66fea3a98e5 (diff) | |
download | nixpkgs-69f2fd97210f60d5a51d7d2abd9a6635e2f5836b.tar nixpkgs-69f2fd97210f60d5a51d7d2abd9a6635e2f5836b.tar.gz nixpkgs-69f2fd97210f60d5a51d7d2abd9a6635e2f5836b.tar.bz2 nixpkgs-69f2fd97210f60d5a51d7d2abd9a6635e2f5836b.tar.lz nixpkgs-69f2fd97210f60d5a51d7d2abd9a6635e2f5836b.tar.xz nixpkgs-69f2fd97210f60d5a51d7d2abd9a6635e2f5836b.tar.zst nixpkgs-69f2fd97210f60d5a51d7d2abd9a6635e2f5836b.zip |
Merge pull request #123834 from bachp/minio-module-update
nixos/minio: replace deprecated variables
Diffstat (limited to 'nixos/modules/services/web-servers')
-rw-r--r-- | nixos/modules/services/web-servers/minio.nix | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/nixos/modules/services/web-servers/minio.nix b/nixos/modules/services/web-servers/minio.nix index 381a55faff1..d075449012f 100644 --- a/nixos/modules/services/web-servers/minio.nix +++ b/nixos/modules/services/web-servers/minio.nix @@ -4,6 +4,11 @@ with lib; let cfg = config.services.minio; + + legacyCredentials = cfg: pkgs.writeText "minio-legacy-credentials" '' + MINIO_ROOT_USER=${cfg.accessKey} + MINIO_ROOT_PASSWORD=${cfg.secretKey} + ''; in { meta.maintainers = [ maintainers.bachp ]; @@ -49,6 +54,17 @@ in ''; }; + rootCredentialsFile = mkOption { + type = types.nullOr types.path; + default = null; + description = '' + File containing the MINIO_ROOT_USER, default is "minioadmin", and + MINIO_ROOT_PASSWORD (length >= 8), default is "minioadmin"; in the format of + an EnvironmentFile=, as described by systemd.exec(5). + ''; + example = "/etc/nixos/minio-root-credentials"; + }; + region = mkOption { default = "us-east-1"; type = types.str; @@ -72,6 +88,8 @@ in }; config = mkIf cfg.enable { + warnings = optional ((cfg.accessKey != "") || (cfg.secretKey != "")) "services.minio.`accessKey` and services.minio.`secretKey` are deprecated, please use services.minio.`rootCredentialsFile` instead."; + systemd.tmpfiles.rules = [ "d '${cfg.configDir}' - minio minio - -" ] ++ (map (x: "d '" + x + "' - minio minio - - ") cfg.dataDir); @@ -86,14 +104,13 @@ in User = "minio"; Group = "minio"; LimitNOFILE = 65536; + EnvironmentFile = if (cfg.rootCredentialsFile != null) then cfg.rootCredentialsFile + else if ((cfg.accessKey != "") || (cfg.secretKey != "")) then (legacyCredentials cfg) + else null; }; environment = { MINIO_REGION = "${cfg.region}"; MINIO_BROWSER = "${if cfg.browser then "on" else "off"}"; - } // optionalAttrs (cfg.accessKey != "") { - MINIO_ACCESS_KEY = "${cfg.accessKey}"; - } // optionalAttrs (cfg.secretKey != "") { - MINIO_SECRET_KEY = "${cfg.secretKey}"; }; }; |