shell: CI fixes

This commit is contained in:
kat witch 2021-05-15 03:03:34 +01:00
parent 1603d07216
commit 2daa1eef65
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72

View file

@ -2,10 +2,49 @@
config = import ./default.nix; config = import ./default.nix;
tf = config.deploy.tf {}; tf = config.deploy.tf {};
inherit (config) pkgs; 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 { in pkgs.mkShell {
nativeBuildInputs = config.runners.lazy.nativeBuildInputs; nativeBuildInputs = [
HISTFILE = toString (tf.terraform.baseDir + "/.history"); 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 CI_PLATFORM = "impure"; # use host's nixpkgs for more convenient testing
shellHook = '' shellHook = ''