From 2209bda83f29d044fdeb3b531d9497c33916b0fe Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 17 Apr 2025 13:02:17 +0200 Subject: [PATCH] Init --- .envrc | 1 + .gitignore | 3 +++ CMakeLists.txt | 10 ++++++++++ flake.lock | 23 +++++++++++++++++++++++ flake.nix | 16 ++++++++++++++++ src/CMakeLists.txt | 1 + src/helloWorld.cpp | 6 ++++++ 7 files changed, 60 insertions(+) create mode 100644 .envrc create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 src/CMakeLists.txt create mode 100644 src/helloWorld.cpp diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f0bae22 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build/ +.cache/ +.direnv/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..0ed743b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.31) +project( + cpp_experiments + VERSION 1.0 + LANGUAGES CXX) + +set(CMAKE_EXPORT_COMPILE_COMMANDS true) +set(CMAKE_CXX_STANDARD 23) + +add_subdirectory(src) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b9cd684 --- /dev/null +++ b/flake.lock @@ -0,0 +1,23 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 0, + "narHash": "sha256-F7n4+KOIfWrwoQjXrL2wD9RhFYLs2/GGe/MQY1sSdlE=", + "path": "/nix/store/fwhfa9pbx8vdi8nd5pcys665baz6xdxf-source", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6150827 --- /dev/null +++ b/flake.nix @@ -0,0 +1,16 @@ +{ + description = "C/C++ environment"; + + # inputs.nixpkgs.url = "nixpkgs"; + + outputs = { nixpkgs, ... }: { + devShells.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.mkShell { + name = "C_CPP-devshell"; + packages = with nixpkgs.legacyPackages.x86_64-linux; [ + clang-tools + cmake + cmake-language-server + ]; + }; + }; +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..e92bddf --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1 @@ +add_executable(Hello helloWorld.cpp) diff --git a/src/helloWorld.cpp b/src/helloWorld.cpp new file mode 100644 index 0000000..0a554f6 --- /dev/null +++ b/src/helloWorld.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + std::cout << "Hello world!"; + return 0; +}