diff --git a/c-template/README.md b/c-template/README.md new file mode 100644 index 00000000..b00a16c6 --- /dev/null +++ b/c-template/README.md @@ -0,0 +1,22 @@ +# Simple C Project + +Created By: Shaik Sahil Rizwan + +# About +This repo is a template for bootstrapping a simple C application on Project IDX. It comes pre-configured with GCC and GDB. + +# Try it out + + + + + Open in IDX + + \ No newline at end of file diff --git a/c-template/dev.nix b/c-template/dev.nix new file mode 100644 index 00000000..7daf9527 --- /dev/null +++ b/c-template/dev.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: { + # Choose a stable channel + channel = "stable-23.11"; + + # Install GCC, Make, and GDB (debugger) + packages = [ + pkgs.gcc + pkgs.gnumake + pkgs.gdb + ]; + + idx = { + # Install the official C/C++ extension for VS Code + extensions = [ + "ms-vscode.cpptools" + "ms-vscode.cpptools-extension-pack" + "danielpinto8zz6.c-cpp-compile-run" + ]; + + workspace = { + onCreate = { + # Optional: Compile the project automatically when the workspace is created + buildAndRun = "gcc main.c -o app && ./app"; + }; + }; + }; +} \ No newline at end of file diff --git a/c-template/idx-template.json b/c-template/idx-template.json new file mode 100644 index 00000000..bd5bc288 --- /dev/null +++ b/c-template/idx-template.json @@ -0,0 +1,12 @@ +{ + "name": "C-Tempalte", + "description": "A barebones C project with GCC, Make, and GDB configured.", + "categories": [ + "Systems", + "Backend", + "Console" + ], + "icon": "https://upload.wikimedia.org/wikipedia/commons/1/18/C_Programming_Language.svg", + "website": "https://gcc.gnu.org/", + "publisher": "shaiksahilrizwan" +} \ No newline at end of file diff --git a/c-template/idx-template.nix b/c-template/idx-template.nix new file mode 100644 index 00000000..b1885cb4 --- /dev/null +++ b/c-template/idx-template.nix @@ -0,0 +1,11 @@ + +{ pkgs, ... }: { + packages=[]; + bootstrap = '' + mkdir "$out" + mkdir -p "$out/.idx/" + cp -rf ${./dev.nix} "$out/.idx/dev.nix" + cp -r ${./src}/* "$out" + chmod -R +w "$out" + ''; +} \ No newline at end of file diff --git a/c-template/src/main.c b/c-template/src/main.c new file mode 100644 index 00000000..5a000bf9 --- /dev/null +++ b/c-template/src/main.c @@ -0,0 +1,4 @@ +#include +void main(){ + printf("Hello, World!\n"); +} \ No newline at end of file