Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions c-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Simple C Project

Created By: <a href="https://github.com/shaiksahilrizwan">Shaik Sahil Rizwan</a>

# 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
<a href="https://idx.google.com/new?template=https://github.com/shaiksahilrizwan/community-templates/tree/c-template/c-template">
<picture>
<source
media="(prefers-color-scheme: dark)"
srcset="https://cdn.idx.dev/btn/open_dark_32.svg">
<source
media="(prefers-color-scheme: light)"
srcset="https://cdn.idx.dev/btn/open_light_32.svg">
<img
height="32"
alt="Open in IDX"
src="https://cdn.idx.dev/btn/open_purple_32.svg">
</picture>
</a>
27 changes: 27 additions & 0 deletions c-template/dev.nix
Original file line number Diff line number Diff line change
@@ -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";
};
};
};
}
12 changes: 12 additions & 0 deletions c-template/idx-template.json
Original file line number Diff line number Diff line change
@@ -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"
}
11 changes: 11 additions & 0 deletions c-template/idx-template.nix
Original file line number Diff line number Diff line change
@@ -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"
'';
}
4 changes: 4 additions & 0 deletions c-template/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include<stdio.h>
void main(){
printf("Hello, World!\n");
}