Skip to content

kngrektor/compileCommandsFor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CompileCommandsFor

Generate a compile_commands.json for clangd from a nix package/derivtion using cc-wrapper's cc-wrapper-hook and bear.

Usage

# flake.nix
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    compileCommandsFor = {
        url = "github:kngrektor/compileCommandsFor";
        inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  outputs = {self, nixpkgs, compileCommandsFor}: let
    system = "x86_64-linux";
    pkgs = nixpkgs.legacyPackages."${system}";
    inherit (compileCommandsFor.lib."${system}") compileCommands;
  in {
    packages."${system}" = {
      compileCommands = compileCommands pkgs.hello;
    };
  };
}

nix build .#compileCommands --out-link compile_commands.json

Prior work

https://github.com/danielbarter/mini_compile_commands

About

compile_commands.json for nix packages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •