summaryrefslogtreecommitdiff
path: root/nix-dependencies/dependencies.nix
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-05-31 18:30:10 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-06-03 10:09:24 +0200
commit3626877554b6c567d43336ec49414cedfe487260 (patch)
treef80c51ec1867fea029b955d85e89e39017f920e3 /nix-dependencies/dependencies.nix
downloadhello-nix-3626877554b6c567d43336ec49414cedfe487260.tar.gz
Initial commit
Diffstat (limited to 'nix-dependencies/dependencies.nix')
-rw-r--r--nix-dependencies/dependencies.nix58
1 files changed, 58 insertions, 0 deletions
diff --git a/nix-dependencies/dependencies.nix b/nix-dependencies/dependencies.nix
new file mode 100644
index 0000000..99280cc
--- /dev/null
+++ b/nix-dependencies/dependencies.nix
@@ -0,0 +1,58 @@
+{ stdenv
+, jo
+, pkg-config
+, coreutils
+, protobuf_25
+, grpc
+, clang
+, fmt
+
+ # for tests
+, gnugrep
+, unixtools
+}:
+
+stdenv.mkDerivation rec {
+ name = "nix-dependencies";
+
+ unpackPhase=''true'';
+
+ nativeBuildInputs = [
+ pkg-config
+ protobuf_25
+ grpc
+ jo
+ ];
+
+ buildInputs = [
+ clang
+ fmt
+ coreutils
+ gnugrep
+ unixtools.xxd
+ ];
+
+ buildPhase = ''
+ echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH
+ jo TOOLCHAIN_CONFIG=$(jo \
+ CC=$(jo PATH=$(jo -a ${clang}/bin ${coreutils}/bin)) \
+ PROTO=$(jo PATH=$(jo -a ${protobuf_25}/bin ${grpc}/bin) \
+ PROTOC=${protobuf_25}/bin/protoc \
+ GRPC_PLUGIN=${grpc}/bin/grpc_cpp_plugin \
+ ) \
+ shell=$(jo PATH=$(jo -a ${coreutils}/bin)) \
+ test=$(jo PATH=$(jo -a ${gnugrep}/bin ${unixtools.xxd}/bin)) \
+ PKGCONFIG=$(jo pkg-config=${pkg-config}/bin/pkg-config \
+ PKG_CONFIG_PATH=$(jo -a $PKG_CONFIG_PATH)) \
+ ) > config.json
+ cat config.json
+ jo "just files"=$(jo config=$(jo -a $(jo root=system path=$out/share/config.json))) > rc.json
+ '';
+
+ installPhase = ''
+ mkdir -p $out/share
+ cp config.json $out/share
+ cp rc.json $out/share
+ '';
+
+}