about summary refs log tree commit diff stats
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--c/.envrc1
-rw-r--r--c/.gitignore2
-rw-r--r--c/Makefile49
-rw-r--r--c/README.md5
-rw-r--r--c/cog.toml28
-rw-r--r--c/src/main.c3
-rwxr-xr-xc/test14
-rw-r--r--templates/c/.ccls (renamed from c/.ccls)0
-rw-r--r--templates/c/COPYING (renamed from c/COPYING)0
-rw-r--r--templates/c/flake.nix (renamed from c/flake.nix)37
10 files changed, 28 insertions, 111 deletions
diff --git a/c/.envrc b/c/.envrc
deleted file mode 100644
index 3550a30..0000000
--- a/c/.envrc
+++ /dev/null
@@ -1 +0,0 @@
-use flake
diff --git a/c/.gitignore b/c/.gitignore
deleted file mode 100644
index ee080b2..0000000
--- a/c/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.direnv
-.ccls-cache
diff --git a/c/Makefile b/c/Makefile
deleted file mode 100644
index 57fa7cf..0000000
--- a/c/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-PREFIX    := /usr/local
-BINPREFIX := $(DESTDIR)$(PREFIX)/bin
-MANPREFIX := $(DESTDIR)$(PREFIX)/share/man/man1
-
-BIN_NAME := project_name
-
-SRC := $(wildcard src/*.c)
-OBJ := $(SRC:.c=.o)
-DEP := $(OBJ:.o=.d)
-
-LIBS :=
-
-ALL_CFLAGS  := -O3 -MMD -Wall -Wextra -Wno-unused-parameter $(CFLAGS) $(CPPFLAGS)
-ALL_LDFLAGS := $(addprefix -l,$(LIBS)) $(CFLAGS) $(LDFLAGS)
-
-
-
-$(BIN_NAME): $(OBJ)
-	$(CC) -o $@ $+ $(ALL_LDFLAGS)
-
-install: $(BIN_NAME)
-	install -d $(BINPREFIX)
-	install $^ $(BINPREFIX)
-
-.c.o:
-	$(CC) -o $@ $< -c $(ALL_CFLAGS)
-
-valgrind-out.txt: $(BIN_NAME)
-	valgrind --leak-check=full \
-         --show-leak-kinds=all \
-         --show-error-list=yes \
-         --track-origins=yes \
-         --log-file=valgrind-out.txt \
-         ./rename
-
-.PHONY : clean options install test
-options:
-	@echo "CC      = $(CC)"
-	@echo "CFLAGS  = $(ALL_CFLAGS)"
-	@echo "LDFLAGS = $(ALL_LDFLAGS)"
-	@echo "OBJ = $(OBJ)"
-	@echo "DEP = $(DEP)"
-	@echo ""
-
-clean :
-	rm $(BIN_NAME) valgrind-out.txt $(OBJ) $(DEP)
-
-test:
-	./test
diff --git a/c/README.md b/c/README.md
deleted file mode 100644
index 8f65521..0000000
--- a/c/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# PROJECT NAME
-
-
-## Licence
-This is licenced under the GNU Public License (GPL).
diff --git a/c/cog.toml b/c/cog.toml
deleted file mode 100644
index d920064..0000000
--- a/c/cog.toml
+++ /dev/null
@@ -1,28 +0,0 @@
-from_latest_tag = false
-tag_prefix = "v"
-ignore_merge_commits = false
-pre_package_bump_hooks = []
-post_package_bump_hooks = []
-
-branch_whitelist = [
-  "prime",
-]
-
-pre_bump_hooks = [
-    "nix build", # verify the project builds
-    "nix flake check",
-]
-post_bump_hooks = [
-    "git push",
-    "git push origin v{{version}}", # push the new tag to origin
-]
-
-[commit_types]
-
-[changelog]
-path = "NEWS.md"
-authors = []
-
-[bump_profiles]
-
-[packages]
diff --git a/c/src/main.c b/c/src/main.c
deleted file mode 100644
index 061a06a..0000000
--- a/c/src/main.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdio.h>
-
-int main() { printf("Hello World!"); }
diff --git a/c/test b/c/test
deleted file mode 100755
index 05d1fb5..0000000
--- a/c/test
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-
-CFLAGS=-ggdb3 make valgrind-out.txt
-
-printf "\n___RESULTS:___\n";
-if grep -q 'ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)' valgrind-out.txt; then
-     echo "No Memory leaks";
-else
-     echo "Memory leaks: " && tail valgrind-out.txt;
-     exit 1;
-fi
-
-
-# vim: ft=sh
diff --git a/c/.ccls b/templates/c/.ccls
index 90584dd..90584dd 100644
--- a/c/.ccls
+++ b/templates/c/.ccls
diff --git a/c/COPYING b/templates/c/COPYING
index f288702..f288702 100644
--- a/c/COPYING
+++ b/templates/c/COPYING
diff --git a/c/flake.nix b/templates/c/flake.nix
index 0eab217..cd4200c 100644
--- a/c/flake.nix
+++ b/templates/c/flake.nix
@@ -1,9 +1,16 @@
 {
-  description = "<Project description>";
+  description = "TODO";
 
   inputs = {
     nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
 
+    treefmt-nix = {
+      url = "github:numtide/treefmt-nix";
+      inputs = {
+        nixpkgs.follows = "nixpkgs";
+      };
+    };
+
     # inputs for following
     systems = {
       url = "github:nix-systems/x86_64-linux"; # only evaluate for this system
@@ -24,29 +31,41 @@
     self,
     nixpkgs,
     flake-utils,
+    treefmt-nix,
     ...
   }:
     flake-utils.lib.eachDefaultSystem (system: let
       pkgs = nixpkgs.legacyPackages."${system}";
 
-      nativeBuildInputs = with pkgs; [valgrind];
-    in {
-      packages.default = pkgs.stdenv.mkDerivation {
+      nativeBuildInputs = with pkgs; [valgrind pandoc];
+      treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
+
+      pname = "TODO";
+      version = "0.1";
+
+      build = pkgs.stdenv.mkDerivation {
+        inherit pname version;
+
         src = ./.;
-        pname = "<pkgs_name>";
-        version = "0.1";
         makeFlags = ["PREFIX=${placeholder "out"}"];
         inherit nativeBuildInputs;
       };
-      apps.default = {
-        type = "app";
-        program = "${self.packages.${system}.default}/bin/<pkgs_name>";
+    in {
+      packages.default = build;
+      checks = {
+        inherit build;
+        formatting = treefmtEval.config.build.check self;
       };
+      formatter = treefmtEval.config.build.wrapper;
+
       devShells.default = pkgs.mkShell {
         packages = with pkgs; [
           cocogitto
         ];
         inherit nativeBuildInputs;
+        env = {
+          GCC_COLORS = "error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01";
+        };
       };
     });
 }