summaryrefslogtreecommitdiffstats
path: root/derivation.nix
blob: e877c044cd8fbe8960131022f2ada8e02476318b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{ stdenv, rustPlatform, llvm, libclang, clang, runtimeShell }:

rustPlatform.buildRustPackage {
  pname = "poseidoc";
  version = "0.1";

  src = ./.;

  buildInputs = [ llvm libclang ];
  LIBCLANG_PATH = "${libclang}/lib";

  cargoSha256 = "0hrqzfzirq8xx32l969367xznlr6wf606xnwkqzknxdc2lxs7k40";

  postFixup = ''
    shell=${runtimeShell}
    wrapped='.poseidoc-wrapped'
    libc_includes='-idirafter "${clang.libc_dev}/include"'
    cxx_stdlib_flags='$(echo -n "${clang.default_cxx_stdlib_compile}")'
    resource_dir_flags='-resource-dir=${clang}/resource-root'

    export shell wrapped libc_includes cxx_stdlib_flags resource_dir_flags

    mv $out/bin/poseidoc $out/bin/$wrapped
    substituteAll ${./nix-wrapper.sh} $out/bin/poseidoc
    chmod --reference=$out/bin/$wrapped $out/bin/poseidoc
  '';
}