diff --git a/README.md b/README.md index 0b56e69..cc2efd7 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,7 @@ Differing from the upstream [Nix](https://github.com/NixOS/nix) installer script | `diagnostic-endpoint` | Diagnostic endpoint url where the installer sends install [diagnostic reports](https://github.com/DeterminateSystems/nix-installer#diagnostics) to, to disable set this to an empty string | string | `https://install.determinate.systems/nix-installer/diagnostic` | | `proxy` | The proxy to use (if any), valid proxy bases are `https://$URL`, `http://$URL` and `socks5://$URL` | string | | | `ssl-cert-file` | An SSL cert to use (if any), used for fetching Nix and sets `NIX_SSL_CERT_FILE` for Nix | string | | +| `timeout` | Timeout in milliseconds for fetching the Nix installer binary | integer | `10000` | [apfs]: https://en.wikipedia.org/wiki/Apple_File_System [backtrace]: https://doc.rust-lang.org/std/backtrace/index.html#environment-variables diff --git a/action.yml b/action.yml index f58598a..0e875ea 100644 --- a/action.yml +++ b/action.yml @@ -56,6 +56,10 @@ inputs: proxy: description: "The proxy to use (if any), valid proxy bases are `https://$URL`, `http://$URL` and `socks5://$URL`" required: false + timeout: + description: Timeout in milliseconds for fetching the Nix installer + required: false + default: "10000" mac-case-sensitive: description: "Use a case sensitive volume (`planner: macos` only)" required: false diff --git a/src/index.ts b/src/index.ts index 6eb2b7b..d392cb2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -72,6 +72,7 @@ class NixInstallerAction extends DetSysAction { logger: string | null; sslCertFile: string | null; proxy: string | null; + timeout: number | null; macCaseSensitive: string | null; macEncrypt: string | null; macRootDisk: string | null; @@ -123,6 +124,7 @@ class NixInstallerAction extends DetSysAction { this.logger = inputs.getStringOrNull("logger"); this.sslCertFile = inputs.getStringOrNull("ssl-cert-file"); this.proxy = inputs.getStringOrNull("proxy"); + this.timeout = inputs.getNumberOrNull("timeout"); this.macCaseSensitive = inputs.getStringOrNull("mac-case-sensitive"); this.macEncrypt = inputs.getStringOrNull("mac-encrypt"); this.macRootDisk = inputs.getStringOrNull("mac-root-disk"); @@ -929,7 +931,7 @@ class NixInstallerAction extends DetSysAction { private async fetchBinary(): Promise { if (!this.localRoot) { - return await this.fetchExecutable(); + return await this.fetchExecutable(this.timeout ?? undefined); } else { const localPath = join(this.localRoot, `nix-installer-${this.platform}`); actionsCore.info(`Using binary ${localPath}`);