Skip to content

Commit

Permalink
updating README
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbarter committed Oct 29, 2022
1 parent b2adb9a commit 79a784f
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Mini Compile Commands

Mini compile commands instruments the compiler wrappers in nixpkgs to generate `compile_commands.json` files. Using a version of nixpkgs which has mini compile commands, it can be included in a `shell.nix` as follows:
Mini compile commands instruments the compiler wrappers in nixpkgs to generate `compile_commands.json` files. Using a version of nixpkgs after [this PR](https://github.com/NixOS/nixpkgs/pull/197937), it can be included in a `shell.nix` as follows:

```
with (import <nixpkgs> {});
(mkShell.override {stdenv = ( mini-compile-commands.wrap clang13Stdenv );}) {
let mini-compile-commands = callPackage <this_repo> {};
in (mkShell.override {stdenv = ( mini-compile-commands.wrap stdenv );}) {
buildInputs = [ cmake gtest ];
}
```
Expand All @@ -13,18 +14,12 @@ When the compiler is invoked, it will send a message to `mini_compile_commands_s

https://user-images.githubusercontent.com/8081722/192353380-5c417134-1cf5-4f60-97c1-386f24b0d4f7.mp4

## Examples
## Example

Mini compile commands can be used to generate a `compile_commands.json` for the linux kernel:

```
nix-shell -E "with (import <nixpkgs> {}); linux.override { stdenv = (mini-compile-commands.wrap stdenv); }"
```

or nix itself:

```
nix-shell -E "with (import <nixpkgs> {}); nix.override { stdenv = (mini-compile-commands.wrap stdenv); }"
nix-shell -E "with (import <nixpkgs> {}); let mini-compile-commands = callPackage <this_repo> {}; in linux.override { stdenv = (mini-compile-commands.wrap stdenv); }"
```

As demonstrated in the above video, create two shells. In one, run `mini_compile_commands_server.py compile_commands.json` and in the other, run your build command.

0 comments on commit 79a784f

Please sign in to comment.