chore: centralise folders

This commit is contained in:
Leon Schwarzäugl 2025-07-04 00:27:16 +02:00
parent 7d614f784c
commit 34badc91d5
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
152 changed files with 6292 additions and 6645 deletions

View file

@ -0,0 +1 @@
use flake

12
files/templates/cpp/.gitignore vendored Normal file
View file

@ -0,0 +1,12 @@
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
CMakeUserPresets.json

View file

@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.20)
project(name)
set(CMAKE_CXX_STANDARD 23)
add_subdirectory(src)
install(TARGETS name DESTINATION bin)

View file

@ -0,0 +1,62 @@
# heavily inspired by https://github.com/nulladmin1/nix-flake-templates/blob/main/cpp-cmake/flake.nix
{
description = "C++ Flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
systems.url = "github:nix-systems/default";
};
outputs =
{ self
, nixpkgs
, systems
, ...
}:
let
forEachSystem = nixpkgs.lib.genAttrs (import systems);
pkgsFor = forEachSystem (system: import nixpkgs { inherit system; });
pname = "name";
in
{
formatter = forEachSystem (system: pkgsFor.${system}.nixpgks-fmt);
devShells = forEachSystem (system: {
default = pkgsFor.${system}.mkShell {
packages = with pkgsFor.${system}; [
libllvm
cmake
gtest
cppcheck
valgrind
doxygen
clang-tools
# cudatoolkit
];
};
});
packages = forEachSystem (system: {
default = pkgsFor.${system}.stdenv.mkDerivation {
inherit pname;
version = "0.1.0";
src = ./.;
nativeBuildInputs = with pkgsFor.${system}; [
cmake
];
buildInputs = with pkgsFor.${system}; [
gtest
];
};
});
apps = forEachSystem (system: {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/${pname}";
};
});
};
}

View file

@ -0,0 +1 @@
add_executable(name name.cpp name.cpp)

View file

@ -0,0 +1,7 @@
#include <iostream>
using namespace std;
int main() {
cout << "Hello, world!" << endl;
return 0;
}