From f2603c72fbdd1007ee804ac39db50c7bf8728d5e Mon Sep 17 00:00:00 2001 From: Peter Waller Date: Sun, 7 Jul 2024 15:14:12 +0100 Subject: [PATCH] hello-cpp: init Proposal: a trivial hello-cpp to complement gnu hello, testing C++ and cmake infrastructure. This is intended to assist with testing exotic stdenvs such as the one used in pkgsLLVM, requiring no additional dependencies to get a quick test that the compiler and cmake are working as intended as a basic level. There does already exist tests.cc-wrapper, but this does not produce any outputs, and sometimes it is useful to have a quick test that something builds. It's also useful to be able to inspect the outputs to look at references and so forth. Signed-off-by: Peter Waller --- pkgs/by-name/he/hello-cpp/package.nix | 18 ++++++++++++++++++ pkgs/by-name/he/hello-cpp/src/CMakeLists.txt | 6 ++++++ pkgs/by-name/he/hello-cpp/src/main.cpp | 6 ++++++ 3 files changed, 30 insertions(+) create mode 100644 pkgs/by-name/he/hello-cpp/package.nix create mode 100644 pkgs/by-name/he/hello-cpp/src/CMakeLists.txt create mode 100644 pkgs/by-name/he/hello-cpp/src/main.cpp diff --git a/pkgs/by-name/he/hello-cpp/package.nix b/pkgs/by-name/he/hello-cpp/package.nix new file mode 100644 index 000000000000..a8313a66cc77 --- /dev/null +++ b/pkgs/by-name/he/hello-cpp/package.nix @@ -0,0 +1,18 @@ +{ + cmake, + lib, + ninja, + stdenv, +}: + +stdenv.mkDerivation { + name = "hello-cpp"; + src = ./src; + nativeBuildInputs = [ cmake ninja ]; + meta = { + description = "Basic sanity check that C++ and cmake infrastructure are working"; + platforms = lib.platforms.all; + maintainers = stdenv.meta.maintainers or []; + mainProgram = "hello-cpp"; + }; +} diff --git a/pkgs/by-name/he/hello-cpp/src/CMakeLists.txt b/pkgs/by-name/he/hello-cpp/src/CMakeLists.txt new file mode 100644 index 000000000000..b7bddfdefd0a --- /dev/null +++ b/pkgs/by-name/he/hello-cpp/src/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.10) +project(hello-cpp) + +add_executable(hello-cpp main.cpp) + +install(TARGETS hello-cpp) diff --git a/pkgs/by-name/he/hello-cpp/src/main.cpp b/pkgs/by-name/he/hello-cpp/src/main.cpp new file mode 100644 index 000000000000..5c887e112046 --- /dev/null +++ b/pkgs/by-name/he/hello-cpp/src/main.cpp @@ -0,0 +1,6 @@ +#include + +int main(int argc, char *argv[]) { + std::cout << "Hello, C++\n"; + return 0; +}