diff --git a/.envrc b/.envrc new file mode 100644 index 000000000000..cc5c18b36b3e --- /dev/null +++ b/.envrc @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +export DIRENV_WARN_TIMEOUT=20s + +eval "$(devenv direnvrc)" + +# `use devenv` supports the same options as the `devenv shell` command. +# +# To silence all output, use `--quiet`. +# +# Example usage: use devenv --quiet --impure --option services.postgres.enable:bool true +use devenv diff --git a/.gitattributes b/.gitattributes index 39706c3859c0..8705f5f75e11 100644 --- a/.gitattributes +++ b/.gitattributes @@ -27,6 +27,10 @@ spec/std/string/grapheme_break_spec.cr linguist-generated # produced by spec/generate_wasm32_spec.sh spec/wasm32_std_spec.cr linguist-generated +# devenv +.devenv.flake.nix -merge linguist-generated +devenv.lock -merge linguist-generated + ## Syntax highlighting Makefile.win linguist-language=makefile diff --git a/.gitignore b/.gitignore index 0ad417e3a2bb..81239d58615e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ # Environment configuration /Makefile.local /Makefile.win.local +.env +.env.* # Build artifacts *.o @@ -20,3 +22,14 @@ /coverage/ /tmp/ /.junit/ + +# Devenv +.devenv* +devenv.local.nix +devenv.local.yaml + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 000000000000..2dbb8e0f6570 --- /dev/null +++ b/devenv.lock @@ -0,0 +1,103 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1761091275, + "owner": "cachix", + "repo": "devenv", + "rev": "a795c32dc826b51d12706f27fb344f966bb2b084", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1747046372, + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1760663237, + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1758532697, + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "207a4cb0e1253c7658c6736becc6eb9cace1f25f", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "git-hooks": "git-hooks", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": [ + "git-hooks" + ] + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 000000000000..f4ca65c086d9 --- /dev/null +++ b/devenv.nix @@ -0,0 +1,22 @@ +{ pkgs, lib, config, inputs, ... }: + +{ + dotenv.enable = true; + + git-hooks.hooks = { + actionlint.enable = true; + check-toml.enable = true; + check-vcs-permalinks.enable = true; + circleci.enable = true; + crystal.enable = true; + markdownlint.enable = true; + reuse.enable = true; + shellcheck = { + enable = true; + excludes = [ + ".*\.zsh$" + ]; + }; + typos.enable = true; + }; +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 000000000000..116a2adb37fa --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,15 @@ +# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json +inputs: + nixpkgs: + url: github:cachix/devenv-nixpkgs/rolling + +# If you're using non-OSS software, you can set allowUnfree to true. +# allowUnfree: true + +# If you're willing to use a package that's vulnerable +# permittedInsecurePackages: +# - "openssl-1.1.1w" + +# If you have more than one devenv you can merge them +#imports: +# - ./backend