diff --git a/.envrc b/.envrc index 588671d..79ac68b 100644 --- a/.envrc +++ b/.envrc @@ -18,4 +18,7 @@ layout_poetry() { export VIRTUAL_ENV } -layout_poetry \ No newline at end of file +layout_poetry + +use flake +lefthook install \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0569159..ad52c3a 100644 --- a/.gitignore +++ b/.gitignore @@ -93,3 +93,4 @@ ENV/ .ropeproject .vscode toolset.py +.direnv/ \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 131d296..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,43 +0,0 @@ -default_install_hook_types: - - pre-commit - - post-commit - - post-checkout - - commit-msg -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 - hooks: - - id: trailing-whitespace - - id: mixed-line-ending - - id: end-of-file-fixer - - id: check-added-large-files - - repo: https://github.com/psf/black - rev: 23.3.0 - hooks: - - id: black - types: - - python - - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 - hooks: - - id: flake8 - types: - - python - - repo: https://github.com/pycqa/bandit - rev: 1.7.5 - hooks: - - id: bandit - args: ["-ll"] - files: .py$ - - repo: git@github.com:mailergroup/pre-commit-conventional-commits.git - # renovate: datasource=github-releases depName=mailergroup/pre-commit-conventional-commits - rev: v1.0.2 - hooks: - - id: pre-commit-conventional-commits - stages: [commit-msg] - - repo: git@github.com:mailergroup/pre-commit-branch-name-validation.git - # renovate: datasource=github-releases depName=mailergroup/pre-commit-branch-name-validation - rev: v1.1.1 - hooks: - - id: pre-commit-branch-validation - stages: [post-commit, post-checkout] diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..128df5b --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1763966396, + "narHash": "sha256-6eeL1YPcY1MV3DDStIDIdy/zZCDKgHdkCmsrLJFiZf0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5ae3b07d8d6527c42f17c876e404993199144b6a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..49eddf5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,23 @@ +{ + description = "Terraform Infrastructure Flake"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { system = system; config.allowUnfree = true; }; + in + { + devShells.default = pkgs.mkShell { + buildInputs = [ + pkgs.go-task + ]; + + packages = [ pkgs.lefthook pkgs.terraform ]; + }; + }); +} diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 0000000..76b5c91 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,13 @@ +--- +remotes: + - git_url: git@github.com:mailerlite/git-hooks.git + ref: main + configs: + - branch-validation-config.yml + +pre-commit: + parallel: true + commands: + black: + glob: "*.py" + run: black .