Loading nixos/modules/services/web-servers/minio.nix +42 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,40 @@ in description = "The config directory, for the access keys and other settings."; }; accessKey = mkOption { default = ""; type = types.str; description = '' Access key of 5 to 20 characters in length that clients use to access the server. This overrides the access key that is generated by minio on first startup and stored inside the <literal>configDir</literal> directory. ''; }; secretKey = mkOption { default = ""; type = types.str; description = '' Specify the Secret key of 8 to 40 characters in length that clients use to access the server. This overrides the secret key that is generated by minio on first startup and stored inside the <literal>configDir</literal> directory. ''; }; region = mkOption { default = "us-east-1"; type = types.str; description = '' The physical location of the server. By default it is set to us-east-1, which is same as AWS S3's and Minio's default region. ''; }; browser = mkOption { default = true; type = types.bool; description = "Enable or disable access to web UI."; }; package = mkOption { default = pkgs.minio; defaultText = "pkgs.minio"; Loading Loading @@ -57,6 +91,14 @@ in Group = "minio"; LimitNOFILE = 65536; }; 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}"; }; }; users.extraUsers.minio = { Loading nixos/tests/minio.nix +15 −2 Original line number Diff line number Diff line Loading @@ -4,8 +4,15 @@ import ./make-test.nix ({ pkgs, ...} : { maintainers = [ bachp ]; }; nodes = { machine = { config, pkgs, ... }: { services.minio.enable = true; services.minio = { enable = true; accessKey = "BKIKJAA5BMMU2RHO6IBB"; secretKey = "V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12"; }; environment.systemPackages = [ pkgs.minio-client ]; }; }; testScript = Loading @@ -14,6 +21,12 @@ import ./make-test.nix ({ pkgs, ...} : { $machine->waitForUnit("minio.service"); $machine->waitForOpenPort(9000); $machine->succeed("curl --fail http://localhost:9000/minio/index.html"); # Create a test bucket on the server $machine->succeed("mc config host add minio http://localhost:9000 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v4"); $machine->succeed("mc mb minio/test-bucket"); $machine->succeed("mc ls minio") =~ /test-bucket/ or die; $machine->shutdown; ''; }) Loading
nixos/modules/services/web-servers/minio.nix +42 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,40 @@ in description = "The config directory, for the access keys and other settings."; }; accessKey = mkOption { default = ""; type = types.str; description = '' Access key of 5 to 20 characters in length that clients use to access the server. This overrides the access key that is generated by minio on first startup and stored inside the <literal>configDir</literal> directory. ''; }; secretKey = mkOption { default = ""; type = types.str; description = '' Specify the Secret key of 8 to 40 characters in length that clients use to access the server. This overrides the secret key that is generated by minio on first startup and stored inside the <literal>configDir</literal> directory. ''; }; region = mkOption { default = "us-east-1"; type = types.str; description = '' The physical location of the server. By default it is set to us-east-1, which is same as AWS S3's and Minio's default region. ''; }; browser = mkOption { default = true; type = types.bool; description = "Enable or disable access to web UI."; }; package = mkOption { default = pkgs.minio; defaultText = "pkgs.minio"; Loading Loading @@ -57,6 +91,14 @@ in Group = "minio"; LimitNOFILE = 65536; }; 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}"; }; }; users.extraUsers.minio = { Loading
nixos/tests/minio.nix +15 −2 Original line number Diff line number Diff line Loading @@ -4,8 +4,15 @@ import ./make-test.nix ({ pkgs, ...} : { maintainers = [ bachp ]; }; nodes = { machine = { config, pkgs, ... }: { services.minio.enable = true; services.minio = { enable = true; accessKey = "BKIKJAA5BMMU2RHO6IBB"; secretKey = "V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12"; }; environment.systemPackages = [ pkgs.minio-client ]; }; }; testScript = Loading @@ -14,6 +21,12 @@ import ./make-test.nix ({ pkgs, ...} : { $machine->waitForUnit("minio.service"); $machine->waitForOpenPort(9000); $machine->succeed("curl --fail http://localhost:9000/minio/index.html"); # Create a test bucket on the server $machine->succeed("mc config host add minio http://localhost:9000 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12 S3v4"); $machine->succeed("mc mb minio/test-bucket"); $machine->succeed("mc ls minio") =~ /test-bucket/ or die; $machine->shutdown; ''; })