1
0
Fork 0
forked from auxolotl/templates

feat(c): add configuration files

This commit is contained in:
Sigmanificient 2024-05-06 23:40:38 +02:00
parent 30022cc914
commit c1524d5bd9
5 changed files with 72 additions and 0 deletions

22
c/.editorconfig Normal file
View file

@ -0,0 +1,22 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 80
tab_width = 4
[{Makefile,*.mk}]
indent_style = tab
[*.nix]
indent_style = space
tab_width = 2
indent_size = 2
[*.lock]
indent_style = unset
insert_final_newline = unset

2
c/.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
* text=lf
* eol=lf

15
c/.gitignore vendored Normal file
View file

@ -0,0 +1,15 @@
# binaries
hello
# build
*.[aod]
# config
compile_commands.json
.pre-commit-config.yaml
.cache
# nix
.direnv
.envrc
result

29
c/Dockerfile Normal file
View file

@ -0,0 +1,29 @@
# Credit to Mitchell Hashimoto
# post: https://mitchellh.com/writing/nix-with-dockerfiles
# Nix builder
FROM nixos/nix:latest AS builder
# Copy our source and setup our working dir.
COPY . /tmp/build
WORKDIR /tmp/build
# Build our Nix environment
RUN nix \
--extra-experimental-features "nix-command flakes" \
--option filter-syscalls false \
build
# Copy the Nix store closure into a directory. The Nix store closure is the
# entire set of Nix store values that we need for our build.
RUN mkdir /tmp/nix-store-closure
RUN cp -R $(nix-store -qR result/) /tmp/nix-store-closure
# Final image is based on scratch. We copy a bunch of Nix dependencies
# but they're fully self-contained so we don't need Nix anymore.
FROM scratch
# Copy /nix/store
COPY --from=builder /tmp/nix-store-closure /nix/store
COPY --from=builder /tmp/build/result /app
CMD ["/app/bin/hello"]

4
c/tokei.toml Normal file
View file

@ -0,0 +1,4 @@
columns = 80
sort = "lines"
types = ["C", "C Header", "Makefile", "Markdown"]
treat_doc_strings_as_comments = true