mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 20:39:18 -08:00
ci: Reorganising, shell: Fixes for CI functions
This commit is contained in:
parent
5a75f7b986
commit
9c945dbf4d
3 changed files with 29 additions and 23 deletions
38
shell.nix
38
shell.nix
|
|
@ -1,30 +1,36 @@
|
|||
{ }: let
|
||||
config = import ./default.nix;
|
||||
tf = config.deploy.tf {};
|
||||
gh-actions-generate = config.pkgs.writeShellScriptBin "gh-actions-generate" ''
|
||||
#!/usr/bin/env bash
|
||||
export CI_ROOT=./;
|
||||
export CI_CONFIG_ROOT=./ci;
|
||||
CI_CONFIG_FILES=($CI_CONFIG_ROOT/hosts.nix)
|
||||
for f in "''${CI_CONFIG_FILES[@]}"; do
|
||||
nix run --arg config $f ci.run.gh-actions-generate
|
||||
done
|
||||
'';
|
||||
test-all = config.pkgs.writeShellScriptBin "test-all" ''
|
||||
#!/usr/bin/env bash
|
||||
export CI_ROOT=./;
|
||||
export CI_CONFIG_ROOT=./ci;
|
||||
CI_CONFIG_FILES=($CI_CONFIG_ROOT/hosts.nix)
|
||||
for f in "''${CI_CONFIG_FILES[@]}"; do
|
||||
nix run --arg config $f ci.test || break
|
||||
done
|
||||
'';
|
||||
inherit (config) pkgs;
|
||||
in pkgs.mkShell {
|
||||
nativeBuildInputs = config.runners.lazy.nativeBuildInputs;
|
||||
nativeBuildInputs = [
|
||||
gh-actions-generate
|
||||
test-all
|
||||
] ++ config.runners.lazy.nativeBuildInputs;
|
||||
HISTFILE = toString (tf.terraform.baseDir + "/.history");
|
||||
|
||||
CI_ROOT = toString ./.;
|
||||
CI_CONFIG_ROOT = toString ./ci;
|
||||
#CI_CONFIG = toString ./example/ci.nix
|
||||
CI_PLATFORM = "impure"; # use host's nixpkgs for more convenient testing
|
||||
|
||||
shellHook = ''
|
||||
export HOME_HOSTNAME=$(hostname -s)
|
||||
export NIX_PATH="$NIX_PATH:nixfiles=${toString ./.}"
|
||||
|
||||
CI_CONFIG_FILES=($CI_CONFIG_ROOT/hosts.nix)
|
||||
gh-actions-generate() {
|
||||
for f in "''${CI_CONFIG_FILES[@]}"; do
|
||||
nix run --arg config $f ci.run.gh-actions-generate
|
||||
done
|
||||
}
|
||||
test-all() {
|
||||
for f in "''${CI_CONFIG_FILES[@]}"; do
|
||||
nix run --arg config $f ci.test || break
|
||||
done
|
||||
}
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue