Skip to content

Latest commit

 

History

History
68 lines (52 loc) · 1.29 KB

README.md

File metadata and controls

68 lines (52 loc) · 1.29 KB

Nix Flake Template for C++ using

All of this information is also included in the README.md

Initialize using

nix flake init --template "github:nulladmin1/nix-flake-templates#cpp-cmake"

OR Initialize using

nix flake init --template "github:nulladmin1/nix-flake-templates#cpp"

This is how the structure of the template looks like:

📦 cpp-cmake
├── ⚙️ .envrc
├── 🙈 .gitignore
├── ⚙️ CMakeLists.txt
├── 📃 README.md
├── ❄️ flake.nix
└── src
    ├── ⚙️ CMakeLists.txt
    └── 📝 hello.cpp

It includes a really simple Hello World program

Run using Nix

nix run

Go into Development Shell

nix develop

(Optional) Format flake.nix using Alejandra

nix fmt

To customize it to your own needs

  • In flake.nix
    • Edit description
      {
          description = "project_name";
      }
    • Change the name of the binary
         {
            program = "${self.packages.${system}.default}/bin/project_name";
        }
  • For the structure and code
    • Add necessary code into the src/ directory and configure CMake accordingly