diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..5bf8fc159 --- /dev/null +++ b/.envrc @@ -0,0 +1,3 @@ +source_url "https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc" "sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0=" + +use devenv \ No newline at end of file diff --git a/.github/workflows/devenv.yml b/.github/workflows/devenv.yml new file mode 100644 index 000000000..60cbf097b --- /dev/null +++ b/.github/workflows/devenv.yml @@ -0,0 +1,25 @@ +name: Devenv + +on: + push: + branches: [ main ] + paths: + - "/devenv*" + pull_request: + branches: [ main ] + paths-ignore: + - "/devenv*" + +jobs: + test-nix-env: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v26 + - uses: cachix/cachix-action@v14 + with: + name: devenv + - name: Install devenv.sh + run: nix profile install nixpkgs#devenv + - name: Build the devenv shell and run any git hooks + run: devenv test \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6eeecd5db..64e3bfedd 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,11 @@ book # Coverage coverage -.nyc_output \ No newline at end of file +.nyc_output + +# Devenv +.devenv* +devenv.local.nix + +# direnv +.direnv \ No newline at end of file diff --git a/changelog.d/993.misc b/changelog.d/993.misc new file mode 100644 index 000000000..e6001246a --- /dev/null +++ b/changelog.d/993.misc @@ -0,0 +1 @@ +Add devenv development files. diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 000000000..32571958a --- /dev/null +++ b/devenv.lock @@ -0,0 +1,175 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1732585607, + "owner": "cachix", + "repo": "devenv", + "rev": "a520f05c40ebecaf5e17064b27e28ba8e70c49fb", + "treeHash": "18c0c037ca6ab98acc83bf17a1abefac00d77e65", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1732689334, + "owner": "nix-community", + "repo": "fenix", + "rev": "a8a983027ca02b363dfc82fbe3f7d9548a8d3dce", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1732722421, + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9ed2ac151eada2306ca8c418ebd97807bb08f6ac", + "treeHash": "89dbb8f9bb36708ea4455ee2225a9c60c950f2f7", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "treeHash": "ca14199cabdfe1a06a7b1654c76ed49100a689f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1716977621, + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "4267e705586473d3e5c8d50299e71503f16a6fb6", + "treeHash": "6d9f1f7ca0faf1bc2eeb397c78a49623260d3412", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1732632634, + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6f6076c37180ea3a916f84928cf3a714c5207a30", + "treeHash": "1e15b0cb2baeffc40a2c957508052031b879c401", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-upstream": { + "locked": { + "lastModified": 1732350895, + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0c582677378f2d9ffcb01490af2f2c678dcb29d3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1732021966, + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "3308484d1a443fc5bc92012435d79e80458fe43c", + "treeHash": "434cf02841a1faf9e53437604ffa4b9a92669bff", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "fenix": "fenix", + "nixpkgs": "nixpkgs", + "nixpkgs-upstream": "nixpkgs-upstream", + "pre-commit-hooks": "pre-commit-hooks" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1732633904, + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "8d5e91c94f80c257ce6dbdfba7bd63a5e8a03fa6", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 000000000..ad3d1cf4a --- /dev/null +++ b/devenv.nix @@ -0,0 +1,24 @@ +{ pkgs, lib, config, inputs, ... }: +let + pkgs-upstream = import inputs.nixpkgs-upstream { system = pkgs.stdenv.system; }; +in +{ + packages = [ pkgs.git pkgs.gcc pkgs.pkg-config pkgs.openssl ]; + + # https://devenv.sh/tests/ + enterTest = '' + echo "Running tests" + yarn + ''; + + # https://devenv.sh/services/ + services.redis.enable = true; + + # https://devenv.sh/languages/ + languages.typescript.enable = true; + languages.javascript.yarn.enable = true; + languages.javascript.enable = true; + languages.javascript.package = pkgs-upstream.nodejs_20; + languages.rust.enable = true; + languages.rust.channel = "stable"; +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 000000000..c53502e25 --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,10 @@ +inputs: + nixpkgs: + url: github:cachix/devenv-nixpkgs/rolling + fenix: + url: github:nix-community/fenix + inputs: + nixpkgs: + follows: nixpkgs + nixpkgs-upstream: + url: github:NixOS/nixpkgs/nixos-24.11 \ No newline at end of file