mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
feat(shell): nf-lint-tf
This commit is contained in:
parent
47d1036c42
commit
4de65230b4
5 changed files with 26 additions and 5 deletions
6
.envrc
6
.envrc
|
|
@ -2,11 +2,11 @@ export NF_CONFIG_ROOT=$PWD
|
|||
export HOME_HOSTNAME=$(hostname -s)
|
||||
FLAKE_ARGS=()
|
||||
|
||||
if [[ $(id -un) = kat ]]; then
|
||||
git pull
|
||||
fi
|
||||
source_env_if_exists ".envrc.${USER-$(id -un)}"
|
||||
|
||||
source_env_if_exists .envrc.conf
|
||||
|
||||
use flake "${FLAKE_ARGS[@]}"
|
||||
export FLAKE_OPTS=${FLAKE_OPTS:-"${FLAKE_ARGS[*]}"}
|
||||
|
||||
watch_file devShell.nix
|
||||
|
|
|
|||
1
.envrc.kat
Normal file
1
.envrc.kat
Normal file
|
|
@ -0,0 +1 @@
|
|||
git pull
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -2,5 +2,7 @@
|
|||
/result*
|
||||
/.direnv/
|
||||
/wiki
|
||||
.DS_Store
|
||||
/tf/terraform.tfvars
|
||||
.terraform
|
||||
.DS_Store
|
||||
.envrc.conf
|
||||
|
|
|
|||
12
devShell.nix
12
devShell.nix
|
|
@ -19,7 +19,15 @@ let
|
|||
exec nix flake update "$@"
|
||||
'';
|
||||
nf-deploy = pkgs.writeShellScriptBin "nf-deploy" ''
|
||||
exec nix run ''${FLAKE_OPTS-} ''$NF_CONFIG_ROOT#nf-deploy -- "$@"
|
||||
exec nix run ''${FLAKE_OPTS-} "$NF_CONFIG_ROOT#nf-deploy" -- "$@"
|
||||
'';
|
||||
nf-tf = pkgs.writeShellScriptBin "nf-tf" ''
|
||||
cd "$NF_CONFIG_ROOT/tf"
|
||||
exec nix run ''${FLAKE_OPTS-} "$NF_CONFIG_ROOT#terraform" -- "$@"
|
||||
'';
|
||||
nf-lint-tf = pkgs.writeShellScriptBin "nf-lint-tf" ''
|
||||
cd "$NF_CONFIG_ROOT/tf"
|
||||
exec nix run ''${FLAKE_OPTS-} "$NF_CONFIG_ROOT#nf-lint-tf" -- "$@"
|
||||
'';
|
||||
in
|
||||
pkgs.mkShell {
|
||||
|
|
@ -30,6 +38,8 @@ pkgs.mkShell {
|
|||
nf-actions-test
|
||||
nf-update
|
||||
nf-deploy
|
||||
nf-tf
|
||||
nf-lint-tf
|
||||
];
|
||||
shellHook = ''
|
||||
export NIX_BIN_DIR=$(dirname $(readlink -f $(type -P nix)))
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) attrsOf package;
|
||||
inherit (lib.meta) getExe;
|
||||
cfg = config.outputs.packages;
|
||||
in {
|
||||
options.outputs.packages = mkOption {
|
||||
type = attrsOf package;
|
||||
|
|
@ -12,8 +15,13 @@ in {
|
|||
};
|
||||
|
||||
config.outputs.packages = {
|
||||
inherit (pkgs.buildPackages) terraform tflint;
|
||||
nf-deploy = pkgs.writeShellScriptBin "nf-deploy" ''
|
||||
exec ${pkgs.runtimeShell} ${../../ci/deploy.sh} "$@"
|
||||
'';
|
||||
nf-lint-tf = pkgs.writeShellScriptBin "nf-lint-tf" ''
|
||||
${getExe cfg.terraform} fmt "$@" &&
|
||||
${cfg.tflint}/bin/tflint
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue