diff options
| author | Akshay Nair <phenax5@gmail.com> | 2026-06-02 00:25:05 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2026-06-02 00:25:05 +0530 |
| commit | 6cb596cafa71b8c8d3521deb0521c0969942fb3a (patch) | |
| tree | ff29fda05008f27235bd0520f6a377e628d98081 | |
| parent | 219227c9171f2402939b0c6b12606e52f0c2de99 (diff) | |
| download | sqlite-creative-coding-6cb596cafa71b8c8d3521deb0521c0969942fb3a.tar.gz sqlite-creative-coding-6cb596cafa71b8c8d3521deb0521c0969942fb3a.zip | |
Just the tip
Diffstat (limited to '')
| -rw-r--r-- | .clangd | 5 | ||||
| -rw-r--r-- | .envrc | 1 | ||||
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | flake.lock | 27 | ||||
| -rw-r--r-- | flake.nix | 30 | ||||
| -rw-r--r-- | justfile | 21 | ||||
| -rw-r--r-- | src/main.c | 17 |
7 files changed, 104 insertions, 0 deletions
@@ -0,0 +1,5 @@ +CompileFlags: + Compiler: gcc +Diagnostics: + Suppress: unknown-attributes + Add: bugprone-*, readability-* @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e0acd02 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build/ +compile_flags.txt +*.db diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f106e5d --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1780246643, + "narHash": "sha256-4T1KWX7xWGQMs9hNZ24IOY3aYOi8D6+5WtkNRBSttB8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "3109eaae18e09d0b8aef23dc2579e7d94b8d4b4e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6c37d1d --- /dev/null +++ b/flake.nix @@ -0,0 +1,30 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + }; + + outputs = + { self, nixpkgs }: + let + forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed; + in + { + devShells = forAllSystems ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + default = pkgs.mkShell { + buildInputs = with pkgs; [ + gcc + sqlite + clang-tools + unixtools.xxd + pkg-config + ]; + }; + } + ); + }; +} diff --git a/justfile b/justfile new file mode 100644 index 0000000..6c0f728 --- /dev/null +++ b/justfile @@ -0,0 +1,21 @@ +set export + +CC := "gcc" +CFLAGS := f"-std=c11 -O2 \ +-Wall -Wextra -Wshadow -Wformat=2 -fsanitize=address,undefined \ +{{shell('pkg-config --cflags --libs sqlite3')}}" +OUTDIR := "build" + +build: compile-flags + mkdir -p "{{OUTDIR}}" + {{CC}} {{CFLAGS}} src/*.c -o "{{OUTDIR}}/sqlheavy" + +run: build + "./{{OUTDIR}}/sqlheavy" + +@compile-flags: + echo '{{CFLAGS}}' | tr ' ' '\n' > ./compile_flags.txt + +format: + find src/ -iname '*.h' -o -iname '*.c' | xargs clang-format -i + diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..23d6e58 --- /dev/null +++ b/src/main.c @@ -0,0 +1,17 @@ +#include <sqlite3.h> +#include <stdio.h> + +int main(void) { + sqlite3 *db; + + sqlite3_open("fun.db", &db); + if (db == NULL) { + printf("Unable to open db\n"); + return 1; + } + + printf("Foobar\n"); + + sqlite3_close(db); + return 0; +} |
