From 2daa1eef655892e77b3954cf2ff6760a5b5cd847 Mon Sep 17 00:00:00 2001 From: kat witch Date: Sat, 15 May 2021 03:03:34 +0100 Subject: [PATCH] shell: CI fixes --- shell.nix | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/shell.nix b/shell.nix index d5d08669..426d857f 100644 --- a/shell.nix +++ b/shell.nix @@ -2,10 +2,49 @@ config = import ./default.nix; tf = config.deploy.tf {}; inherit (config) pkgs; + nf-actions = config.pkgs.writeShellScriptBin "nf-actions" '' + export START_DIR="$PWD" + cd ${toString ./.} + export NF_CONFIG_ROOT=${toString ./.}/ci + NF_CONFIG_FILES=($NF_CONFIG_ROOT/hosts.nix) + for f in "''${NF_CONFIG_FILES[@]}"; do + echo $f + nix run --arg config $f ci.run.gh-actions-generate + done + cd ${toString ./trusted} + export TRUSTED_CONFIG_ROOT=${toString ./trusted}/ci + TRUSTED_CONFIG_FILES=($TRUSTED_CONFIG_ROOT/{hosts,niv-cron}.nix) + for f in "''${TRUSTED_CONFIG_FILES[@]}"; do + echo $f + nix run --arg config $f ci.run.gh-actions-generate + done + cd $START_DIR + ''; + nf-test = config.pkgs.writeShellScriptBin "nf-test" '' + export START_DIR="$PWD" + cd ${toString ./.} + export NF_CONFIG_ROOT=${toString ./.}/ci + NF_CONFIG_FILES=($NF_CONFIG_ROOT/hosts.nix) + for f in "''${NF_CONFIG_FILES[@]}"; do + echo $f + nix run --arg config $f ci.run.gh-actions-generate + done + cd ${toString ./trusted} + export TRUSTED_CONFIG_ROOT=${toString ./trusted}/ci + TRUSTED_CONFIG_FILES=($TRUSTED_CONFIG_ROOT/{hosts,niv-cron}.nix) + for f in "''${TRUSTED_CONFIG_FILES[@]}"; do + echo $f + nix run --arg config $f ci.test + done + cd $START_DIR + ''; in pkgs.mkShell { - nativeBuildInputs = config.runners.lazy.nativeBuildInputs; - HISTFILE = toString (tf.terraform.baseDir + "/.history"); + nativeBuildInputs = [ + nf-actions + nf-test + ] ++ config.runners.lazy.nativeBuildInputs; + HISTFILE = toString (tf.terraform.baseDir + "/.history"); CI_PLATFORM = "impure"; # use host's nixpkgs for more convenient testing shellHook = ''