From 1cf64fd7a68fcf464136a63c6a45bfd6e0048e92 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 24 Jan 2023 08:17:18 -0800 Subject: [PATCH 1/6] Add start-daemon and init args --- action.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/action.yml b/action.yml index 59d260e..1502edc 100644 --- a/action.yml +++ b/action.yml @@ -51,6 +51,12 @@ inputs: mac-root-disk: description: The root disk of the target (Mac only) required: false + start-daemon: + description: If the daemon should be started + required: false + init: + description: The init system to configure (On Linux choose `none` or `systemd`, on Mac choose `none` or `launchd`) + required: false nix-installer-url: description: A URL pointing to a `nix-installer.sh` script required: false @@ -235,6 +241,16 @@ runs: echo "Set NIX_INSTALLER_LOGGER=$NIX_INSTALLER_LOGGER" fi + if [ -n "${{ inputs.init }}" ]; then + export NIX_INSTALLER_INIT=${{ inputs.init }} + echo "Set NIX_INSTALLER_INIT=$NIX_INSTALLER_INIT" + fi + + if [ -n "${{ inputs.start-daemon }}" ]; then + export NIX_INSTALLER_START_DAEMON=${{ inputs.start-daemon }} + echo "Set NIX_INSTALLER_START_DAEMON=$NIX_INSTALLER_START_DAEMON" + fi + if [ -n "${{ inputs.log-directives }}" ]; then export NIX_INSTALLER_LOG_DIRECTIVES=${{ inputs.log-directives }} echo "Set NIX_INSTALLER_LOG_DIRECTIVES=$NIX_INSTALLER_LOG_DIRECTIVES" From 7f874ef194ec406257bb62e12c549ef08425e0e8 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 24 Jan 2023 08:51:23 -0800 Subject: [PATCH 2/6] Use some arguments as input templated --- action.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index 1502edc..a818194 100644 --- a/action.yml +++ b/action.yml @@ -73,13 +73,16 @@ inputs: description: The setting for `RUST_BACKTRACE` (see https://doc.rust-lang.org/std/backtrace/index.html#environment-variables) required: false nix-installer-tag: - description: The tag of `nix-installer` to use + description: The tag of `nix-installer` to use (conflicts with `nix-installer-revision`, `nix-installer-branch`, `nix-installer-pr`) required: false nix-installer-revision: - description: The revision of `nix-installer` to use + description: The revision of `nix-installer` to use (conflicts with `nix-installer-tag`, `nix-installer-branch`, `nix-installer-pr`) required: false nix-installer-branch: - description: The branch of `nix-installer` to use + description: The branch of `nix-installer` to use (conflicts with `nix-installer-tag`, `nix-installer-revision`, `nix-installer-pr`) + required: false + nix-installer-pr: + description: The PR of `nix-installer` to use (conflicts with `nix-installer-tag`, `nix-installer-revision`, `nix-installer-branch`) required: false reinstall: description: Force a reinstall if an existing installation is detected (consider backing up `/nix/store`) @@ -223,12 +226,14 @@ runs: if [ -n "${{ inputs.nix-installer-url }}" ]; then export NIX_INSTALLER_URL=${{ inputs.nix-installer-url }} else - if [ -n "$NIX_INSTALLER_TAG" ]; then - export NIX_INSTALLER_URL=https://install.determinate.systems/nix/tag/$NIX_INSTALLER_TAG - elif [ -n "$NIX_INSTALLER_REVISION" ]; then - export NIX_INSTALLER_URL=https://install.determinate.systems/nix/rev/$NIX_INSTALLER_REVISION - elif [ -n "$NIX_INSTALLER_REVISION" ]; then - export NIX_INSTALLER_URL=https://install.determinate.systems/nix/branch/$NIX_INSTALLER_BRANCH + if [ -n "${{ inputs.nix-installer-pr }}" ]; then + export NIX_INSTALLER_URL=https://install.determinate.systems/nix/pr/${{ inputs.nix-installer-pr }} + elif [ -n "${{ inputs.nix-installer-tag }}" ]; then + export NIX_INSTALLER_URL=https://install.determinate.systems/nix/tag/${{ inputs.nix-installer-tag }} + elif [ -n "${{ inputs.nix-installer-revision }}" ]; then + export NIX_INSTALLER_URL=https://install.determinate.systems/nix/rev/${{ inputs.nix-installer-revision }} + elif [ -n "${{ inputs.nix-installer-branch }}" ]; then + export NIX_INSTALLER_URL=https://install.determinate.systems/nix/branch/${{ inputs.nix-installer-branch }} else export NIX_INSTALLER_URL=https://install.determinate.systems/nix fi From ed4bbe1cd4711b95cdb0479ea57d17cef59f3ef0 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 24 Jan 2023 09:29:24 -0800 Subject: [PATCH 3/6] Wording around how to use `init` and `start-daemon` --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index a818194..02f81e8 100644 --- a/action.yml +++ b/action.yml @@ -52,17 +52,17 @@ inputs: description: The root disk of the target (Mac only) required: false start-daemon: - description: If the daemon should be started + description: "If the daemon should be started , requires `planner: linux-multi` or `planner: darwin-multi`" required: false init: - description: The init system to configure (On Linux choose `none` or `systemd`, on Mac choose `none` or `launchd`) + description: "The init system to configure, requires `planner: linux-multi` (allowing the choice between `none` or `systemd`) or `planner: darwin-multi` (allowing the choive between `none` or `launchd`)" required: false nix-installer-url: description: A URL pointing to a `nix-installer.sh` script required: false logger: description: The logger to use for install (eg. `pretty`, `json`, `full`, `compact`) - required: false + required: falseg local-root: description: A local `nix-installer` binary root, overrides the `nix-installer-url` setting (a `nix-installer.sh` should exist, binaries should be named `nix-installer-$ARCH`, eg. `nix-installer-x86_64-linux`) required: false From 6d99d4ce08fa50d7cd2e9503aa10af34b5fa0492 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 24 Jan 2023 10:51:02 -0800 Subject: [PATCH 4/6] init/start-daemon are linux only --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 02f81e8..042116f 100644 --- a/action.yml +++ b/action.yml @@ -52,10 +52,10 @@ inputs: description: The root disk of the target (Mac only) required: false start-daemon: - description: "If the daemon should be started , requires `planner: linux-multi` or `planner: darwin-multi`" + description: "If the daemon should be started , requires `planner: linux-multi`" required: false init: - description: "The init system to configure, requires `planner: linux-multi` (allowing the choice between `none` or `systemd`) or `planner: darwin-multi` (allowing the choive between `none` or `launchd`)" + description: "The init system to configure, requires `planner: linux-multi` (allowing the choice between `none` or `systemd`)" required: false nix-installer-url: description: A URL pointing to a `nix-installer.sh` script From 3764baabb9dcf4a45e65feafb8210dfffcaa76a5 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 31 Jan 2023 07:44:42 -0800 Subject: [PATCH 5/6] Add errors if options conflict --- action.yml | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/action.yml b/action.yml index 042116f..6851f51 100644 --- a/action.yml +++ b/action.yml @@ -52,7 +52,7 @@ inputs: description: The root disk of the target (Mac only) required: false start-daemon: - description: "If the daemon should be started , requires `planner: linux-multi`" + description: "If the daemon should be started, requires `planner: linux-multi`" required: false init: description: "The init system to configure, requires `planner: linux-multi` (allowing the choice between `none` or `systemd`)" @@ -62,7 +62,7 @@ inputs: required: false logger: description: The logger to use for install (eg. `pretty`, `json`, `full`, `compact`) - required: falseg + required: false local-root: description: A local `nix-installer` binary root, overrides the `nix-installer-url` setting (a `nix-installer.sh` should exist, binaries should be named `nix-installer-$ARCH`, eg. `nix-installer-x86_64-linux`) required: false @@ -113,21 +113,6 @@ runs: fi fi - if [ -n "${{ inputs.nix-installer-tag }}" ]; then - export NIX_INSTALLER_TAG=${{ inputs.nix-installer-tag }} - echo "Set NIX_INSTALLER_TAG=$NIX_INSTALLER_TAG" - fi - - if [ -n "${{ inputs.nix-installer-revision }}" ]; then - export NIX_INSTALLER_TAG=${{ inputs.nix-installer-revision }} - echo "Set NIX_INSTALLER_TAG=$NIX_INSTALLER_TAG" - fi - - if [ -n "${{ inputs.nix-installer-branch }}" ]; then - export NIX_INSTALLER_BRANCH=${{ inputs.nix-installer-branch }} - echo "Set NIX_INSTALLER_BRANCH=$NIX_INSTALLER_BRANCH" - fi - if [ -n "${{ inputs.channels }}" ]; then export NIX_INSTALLER_CHANNELS=${{ inputs.channels }} echo "Set NIX_INSTALLER_CHANNELS=$NIX_INSTALLER_CHANNELS" @@ -202,6 +187,31 @@ runs: echo "Set NIX_INSTALLER_ROOT_DISK=$NIX_INSTALLER_ROOT_DISK" fi + if [ -n "${{ inputs.nix-installer-pr }}" ] && [ -n "${{ inputs.nix-installer-tag }}" ]; then + echo "The nix-installer-pr and nix-installer-tag options conflict, please choose one" + exit 1 + fi + if [ -n "${{ inputs.nix-installer-pr }}" ] && [ -n "${{ inputs.nix-installer-revision }}" ]; then + echo "The nix-installer-pr and nix-installer-revision options conflict, please choose one" + exit 1 + fi + if [ -n "${{ inputs.nix-installer-pr }}" ] && [ -n "${{ inputs.nix-installer-branch }}" ]; then + echo "The nix-installer-pr and nix-installer-branch options conflict, please choose one" + exit 1 + fi + if [ -n "${{ inputs.nix-installer-tag }}" ] && [ -n "${{ inputs.nix-installer-revision }}" ]; then + echo "The nix-installer-tag and nix-installer-revision options conflict, please choose one" + exit 1 + fi + if [ -n "${{ inputs.nix-installer-branch }}" ] && [ -n "${{ inputs.nix-installer-revision }}" ]; then + echo "The nix-installer-branch and nix-installer-revision options conflict, please choose one" + exit 1 + fi + if [ -n "${{ inputs.nix-installer-tag }}" ] && [ -n "${{ inputs.nix-installer-branch }}" ]; then + echo "The nix-installer-tag and nix-installer-branch options conflict, please choose one" + exit 1 + fi + if [ -n "${{ inputs.local-root }}" ]; then if [ "$RUNNER_OS" == "macOS" ]; then export PYTHON="python3" From 8ca5194c76504a710496a139147ace8417ca215f Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Wed, 1 Feb 2023 10:20:19 -0800 Subject: [PATCH 6/6] More conflicts checked --- action.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/action.yml b/action.yml index 6851f51..9f27aed 100644 --- a/action.yml +++ b/action.yml @@ -211,6 +211,18 @@ runs: echo "The nix-installer-tag and nix-installer-branch options conflict, please choose one" exit 1 fi + if [ -n "${{ inputs.nix-installer-url }}" ] && [ -n "${{ inputs.nix-installer-pr }}" ]; then + echo "The nix-installer-url and nix-installer-pr options conflict, please choose one" + exit 1 + fi + if [ -n "${{ inputs.nix-installer-url }}" ] && [ -n "${{ inputs.nix-installer-tag }}" ]; then + echo "The nix-installer-url and nix-installer-tag options conflict, please choose one" + exit 1 + fi + if [ -n "${{ inputs.nix-installer-url }}" ] && [ -n "${{ inputs.nix-installer-branch }}" ]; then + echo "The nix-installer-url and nix-installer-branch options conflict, please choose one" + exit 1 + fi if [ -n "${{ inputs.local-root }}" ]; then if [ "$RUNNER_OS" == "macOS" ]; then