diff --git a/flake.nix b/flake.nix index 71ee476..7047d00 100644 --- a/flake.nix +++ b/flake.nix @@ -92,9 +92,9 @@ echo -e "\\e[0Ksection_start:`date +%s`:nix_setup\\r\\e[0KSetting up Nix CI" nix path-info --all > /tmp/nix-store-before - if [ -z "$_NIX_CI_DISABLE_CACHE" ]; then - echo -e "\\e[0Ksection_start:`date +%s`:cache_setup[collapsed=true]\\r\\e[0KConfiguring cache ($_NIX_CI_CACHE_STRATEGY)" - case "$_NIX_CI_CACHE_STRATEGY" in + if [ -z "$NIX_CI_DISABLE_CACHE" ]; then + echo -e "\\e[0Ksection_start:`date +%s`:cache_setup[collapsed=true]\\r\\e[0KConfiguring cache ($NIX_CI_CACHE_STRATEGY)" + case "$NIX_CI_CACHE_STRATEGY" in "runner") export RUNNER_CACHE=''${RUNNER_CACHE:-"file://$(pwd)/.nix-cache"} echo "Runner Cache: $RUNNER_CACHE" @@ -116,7 +116,7 @@ echo "Cache strategy is none, doing nothing..." ;; *) - echo "WARNING: Invalid cache strategy set: '$_NIX_CI_CACHE_STRATEGY'" + echo "WARNING: Invalid cache strategy set: '$NIX_CI_CACHE_STRATEGY'" ;; esac echo -e "\\e[0Ksection_end:`date +%s`:cache_setup\\r\\e[0K" @@ -141,10 +141,10 @@ --old-line-format="" --unchanged-line-format="" \ /tmp/nix-store-before /tmp/nix-store-after) COUNT=$(${pkgs.busybox}/bin/wc -l <<<"$NEW_PATHS") - if [ -z "$_NIX_CI_DISABLE_CACHE" ]; then - echo -e "\\e[0Ksection_start:`date +%s`:cache_push[collapsed=true]\\r\\e[0KPushing $COUNT new store paths to cache ($_NIX_CI_CACHE_STRATEGY)" + if [ -z "$NIX_CI_DISABLE_CACHE" ]; then + echo -e "\\e[0Ksection_start:`date +%s`:cache_push[collapsed=true]\\r\\e[0KPushing $COUNT new store paths to cache ($NIX_CI_CACHE_STRATEGY)" echo $NEW_PATHS | { - case "$_NIX_CI_CACHE_STRATEGY" in + case "$NIX_CI_CACHE_STRATEGY" in "runner") export RUNNER_CACHE=''${RUNNER_CACHE:-"file://$(pwd)/.nix-cache"} # add ^* to all store paths ending in .drv (prevent warning log spam) @@ -160,7 +160,7 @@ echo "Cache strategy is none, doing nothing..." ;; *) - echo "WARNING: Invalid cache strategy set: '$_NIX_CI_CACHE_STRATEGY'" + echo "WARNING: Invalid cache strategy set: '$NIX_CI_CACHE_STRATEGY'" ;; esac } diff --git a/lib/flakeModule.nix b/lib/flakeModule.nix index 7e311de..8dbf97e 100644 --- a/lib/flakeModule.nix +++ b/lib/flakeModule.nix @@ -25,7 +25,7 @@ }; configType = subType { - nix-jobs-per-default = mkOption { + nix-jobs-by-default = mkOption { type = types.bool; default = true; description = "Handle jobs nix-based by default or via opt-in (in a job set nix.enable = true) if false"; @@ -73,7 +73,7 @@ }; image = mkOption { type = types.str; - default = "$_NIX_CI_IMAGE"; + default = "$NIX_CI_IMAGE"; }; after_script = mkNullOption (types.listOf types.str); allow_failure = mkNullOption (types.either types.attrs types.bool); @@ -258,7 +258,7 @@ variables = (filterJobVariables false job) // lib.optionalAttrs job.nix.enable-runner-cache { - _NIX_CI_CACHE_STRATEGY = "runner"; + NIX_CI_CACHE_STRATEGY = "runner"; }; cache = (