Added C template
This commit is contained in:
parent
3950d3fe20
commit
a634e932f6
5 changed files with 43 additions and 2 deletions
4
c/.envrc
Normal file
4
c/.envrc
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
|
||||||
|
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
|
||||||
|
fi
|
||||||
|
use flake
|
||||||
16
c/Makefile
Normal file
16
c/Makefile
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
all: main
|
||||||
|
|
||||||
|
CC = clang
|
||||||
|
override CFLAGS += -g -Wno-everything -pthread -lm
|
||||||
|
|
||||||
|
SRCS = $(shell find . -name '.ccls-cache' -type d -prune -o -type f -name '*.c' -print)
|
||||||
|
HEADERS = $(shell find . -name '.ccls-cache' -type d -prune -o -type f -name '*.h' -print)
|
||||||
|
|
||||||
|
main: $(SRCS) $(HEADERS)
|
||||||
|
$(CC) $(CFLAGS) $(SRCS) -o "$@"
|
||||||
|
|
||||||
|
main-debug: $(SRCS) $(HEADERS)
|
||||||
|
$(CC) $(CFLAGS) -O0 $(SRCS) -o "$@"
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f main main-debug
|
||||||
13
c/flake.nix
Normal file
13
c/flake.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
description = "Flake template for a devShell";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils, ... }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let pkgs = import nixpkgs { inherit system; };
|
||||||
|
in with pkgs; { devShells.default = mkShell { packages = [ clang_12 ccls gdb gnumake ]; }; });
|
||||||
|
}
|
||||||
|
|
@ -3,17 +3,21 @@
|
||||||
|
|
||||||
outputs = { self }: {
|
outputs = { self }: {
|
||||||
templates = {
|
templates = {
|
||||||
|
c = {
|
||||||
|
path = ./c;
|
||||||
|
description = "Template for a C project";
|
||||||
|
};
|
||||||
package = {
|
package = {
|
||||||
path = ./package;
|
path = ./package;
|
||||||
description = "Template for a nix package";
|
description = "Template for a nix package";
|
||||||
};
|
};
|
||||||
python = {
|
python = {
|
||||||
path = ./python;
|
path = ./python;
|
||||||
description = "Template to python project";
|
description = "Template for a python project";
|
||||||
};
|
};
|
||||||
rust = {
|
rust = {
|
||||||
path = ./rust;
|
path = ./rust;
|
||||||
description = "Rust template, using oxalica/rust-overlay";
|
description = "Template for a rust project, using oxalica/rust-overlay";
|
||||||
};
|
};
|
||||||
shell = {
|
shell = {
|
||||||
path = ./shell;
|
path = ./shell;
|
||||||
|
|
|
||||||
4
python/.envrc
Normal file
4
python/.envrc
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
|
||||||
|
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
|
||||||
|
fi
|
||||||
|
use flake
|
||||||
Loading…
Add table
Add a link
Reference in a new issue