forked from auxolotl/templates
feat(c): add configuration files
This commit is contained in:
parent
30022cc914
commit
c1524d5bd9
22
c/.editorconfig
Normal file
22
c/.editorconfig
Normal 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
2
c/.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
* text=lf
|
||||
* eol=lf
|
15
c/.gitignore
vendored
Normal file
15
c/.gitignore
vendored
Normal 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
29
c/Dockerfile
Normal 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
4
c/tokei.toml
Normal file
|
@ -0,0 +1,4 @@
|
|||
columns = 80
|
||||
sort = "lines"
|
||||
types = ["C", "C Header", "Makefile", "Markdown"]
|
||||
treat_doc_strings_as_comments = true
|
Loading…
Reference in a new issue