Skip to content

Commit b3a4677

Browse files
authored
feat: Devcontainer configuration for nix/direnv (#15)
1 parent c7e1858 commit b3a4677

File tree

5 files changed

+36
-0
lines changed

5 files changed

+36
-0
lines changed

.devcontainer/devcontainer.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "codetracer-ruby-recorder",
3+
"features": {
4+
"ghcr.io/devcontainers/features/nix:1": {},
5+
"ghcr.io/devcontainers-community/features/direnv:1": {}
6+
},
7+
"postCreateCommand": "direnv allow"
8+
}

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
*.json
2+
!.devcontainer/devcontainer.json
23
!test/fixtures/*.json
34
test/tmp/
5+
.direnv/

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ ruby trace.rb <path to ruby file>
1818

1919
however you probably want to use it in combination with CodeTracer, which would be released soon.
2020

21+
### Development
22+
23+
This repository provides a Nix flake for the development shell. With direnv installed, the shell is loaded automatically when you enter the directory. Run `direnv allow` once to enable it.
24+
25+
The same environment is configured for GitHub Codespaces via devcontainer configuration.
26+
2127
### env variables
2228

2329
* if you pass `CODETRACER_RUBY_TRACER_DEBUG=1`, you enables some additional debug-related logging

flake.nix

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
description = "Development environment for codetracer-ruby-recorder";
3+
4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
5+
6+
outputs = { self, nixpkgs }:
7+
let
8+
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
9+
forEachSystem = nixpkgs.lib.genAttrs systems;
10+
in {
11+
devShells = forEachSystem (system:
12+
let pkgs = import nixpkgs { inherit system; };
13+
in {
14+
default = pkgs.mkShell {
15+
packages = with pkgs; [ ruby just ];
16+
};
17+
});
18+
};
19+
}

0 commit comments

Comments
 (0)