Basic C project template.

feat: Add template files.

stau.space e8fc1464

+121
+1
.envrc
··· 1 + use flake
+2
.gitignore
··· 1 + .direnv 2 + .build
+16
LICENSE
··· 1 + MIT No Attribution 2 + 3 + Copyright 2025 Sona Tau Estrada Rivera <sona@stau.space> 4 + 5 + Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 + software and associated documentation files (the "Software"), to deal in the Software 7 + without restriction, including without limitation the rights to use, copy, modify, 8 + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 + permit persons to whom the Software is furnished to do so. 10 + 11 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 12 + INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 13 + PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 14 + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 15 + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 16 + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+18
Makefile
··· 1 + ADDRESS := "127.0.0.1" 2 + PORT := "42069" 3 + CC := gcc 4 + CFLAGS := -std=c11 -g -Wextra -Wall -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wconversion -Wunreachable-code -pedantic -fsanitize=address -fsanitize=undefined -save-temps 5 + CLIBS := -lm 6 + SRC := src/main.c 7 + 8 + edevice.py: .build/main 9 + ./.build/main "$(ADDRESS)" "$(PORT)" 10 + 11 + .build/main: .build $(SRC) 12 + $(CC) $(CFLAGS) $(CLIBS) $(SRC) -o $@ 13 + 14 + .build: 15 + mkdir .build 16 + 17 + clean: 18 + rm -rf .build
+12
README.md
··· 1 + 2 + 3 + 4 + Example of how to run the embedded device: 5 + 6 + ```sh 7 + make edevice.py ADDRESS=<server address> PORT=<server port> 8 + ``` 9 + 10 + 11 + where `<server address>` is the IP address of the cluster, and `<server port>` 12 + is the port number of the cluster.
+25
flake.lock
··· 1 + { 2 + "nodes": { 3 + "nixpkgs": { 4 + "locked": { 5 + "lastModified": 1746904237, 6 + "narHash": "sha256-3e+AVBczosP5dCLQmMoMEogM57gmZ2qrVSrmq9aResQ=", 7 + "rev": "d89fc19e405cb2d55ce7cc114356846a0ee5e956", 8 + "revCount": 797896, 9 + "type": "tarball", 10 + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.797896%2Brev-d89fc19e405cb2d55ce7cc114356846a0ee5e956/0196c1a7-7ad3-74a9-9d50-1b854aca6d6c/source.tar.gz" 11 + }, 12 + "original": { 13 + "type": "tarball", 14 + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1" 15 + } 16 + }, 17 + "root": { 18 + "inputs": { 19 + "nixpkgs": "nixpkgs" 20 + } 21 + } 22 + }, 23 + "root": "root", 24 + "version": 7 25 + }
+42
flake.nix
··· 1 + { 2 + description = "Declarations for the environment that this project will use."; 3 + 4 + # Flake inputs 5 + inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; 6 + 7 + # Flake outputs 8 + outputs = inputs: 9 + let 10 + # The systems supported for this flake 11 + supportedSystems = [ 12 + "x86_64-linux" # 64-bit Intel/AMD Linux 13 + "aarch64-linux" # 64-bit ARM Linux 14 + "x86_64-darwin" # 64-bit Intel macOS 15 + "aarch64-darwin" # 64-bit ARM macOS 16 + ]; 17 + 18 + # Helper to provide system-specific attributes 19 + forEachSupportedSystem = f: inputs.nixpkgs.lib.genAttrs supportedSystems (system: f { 20 + pkgs = import inputs.nixpkgs { inherit system; }; 21 + }); 22 + in 23 + { 24 + devShells = forEachSupportedSystem ({ pkgs }: { 25 + default = pkgs.mkShell { 26 + # The Nix packages provided in the environment 27 + # Add any you need here 28 + packages = with pkgs; [ 29 + gcc 30 + gnumake 31 + ]; 32 + 33 + # Set any environment variables for your dev shell 34 + env = { }; 35 + 36 + # Add any shell logic you want executed any time the environment is activated 37 + shellHook = '' 38 + ''; 39 + }; 40 + }); 41 + }; 42 + }
+5
src/main.c
··· 1 + #include <stdio.h> 2 + 3 + int main() { 4 + printf("Hello world!\n"); 5 + }