enable building with nix

This commit is contained in:
eymeric
2024-04-08 22:47:59 +02:00
parent 31d8f4d773
commit e3fd1382e9
6 changed files with 146 additions and 0 deletions

34
packaging/nix/default.nix Normal file
View File

@@ -0,0 +1,34 @@
{ pkgs ? import <nixpkgs> {} }:
# Nix derivation for basic C++ project using clang
with pkgs; stdenv.mkDerivation {
name = "clang-uml";
src = ../..;
buildInputs = [
clang
libclang
cmake
llvmPackages_latest.libllvm
yaml-cpp
ccache
elfutils
pkg-config
];
dontUseCmakeConfigure = true;
buildPhase = "CCACHE_DIR=/build/.ccache make release";
installPhase = ''
mkdir -p $out/bin
cp release/src/clang-uml $out/bin/clang-uml
'';
postInstall = "
installShellCompletion --cmd clang-uml \
--zsh packaging/autocomplete/_clang-uml
--bach packaging/autocomplete/clang-uml
";
}