File tree Expand file tree Collapse file tree 12 files changed +231
-0
lines changed Expand file tree Collapse file tree 12 files changed +231
-0
lines changed Original file line number Diff line number Diff line change 2929 ) ;
3030
3131 templates = {
32+ c = {
33+ path = ./template/c ;
34+ description = "Setup C Project" ;
35+ } ;
3236 elm = {
3337 path = ./template/elm ;
3438 description = "Setup Elm Project" ;
Original file line number Diff line number Diff line change 1+ BasedOnStyle : LLVM
2+ IndentWidth : 4
3+ UseTab : Never
Original file line number Diff line number Diff line change 1+ ; https://editorconfig.org
2+ root = true
3+
4+ ; default configuration
5+ [* ]
6+ charset = utf-8
7+ end_of_line = lf
8+ trim_trailing_whitespace = true
9+ insert_final_newline = true
10+ indent_style = unset
11+
12+ [{* .nix,flake.lock} ]
13+ indent_style = space
14+ indent_size = 2
15+
16+ [* .{yml,yaml} ]
17+ indent_style = space
18+ indent_size = 2
19+
20+ [* .md ]
21+ indent_style = space
22+ indent_size = 2
23+
24+ [* .{c,h,zig} ]
25+ indent_style = space
26+ indent_size = 4
Original file line number Diff line number Diff line change 1+ use flake
Original file line number Diff line number Diff line change 1+ name : main
2+ on :
3+ pull_request :
4+ branches : [main]
5+ push :
6+ branches : [main]
7+ env :
8+ CI_NIX_FLAKE : .#default
9+ jobs :
10+ lint :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout
14+ uses : actions/checkout@v4
15+ - name : Setup Nix
16+ uses : DeterminateSystems/nix-installer-action@main
17+ - name : Cache Nix
18+ uses : DeterminateSystems/magic-nix-cache-action@main
19+ - name : Lint
20+ run : |
21+ nix develop ${{ env.CI_NIX_FLAKE }} --command \
22+ editorconfig-checker && echo "ok"
23+ test :
24+ runs-on : ubuntu-latest
25+ steps :
26+ - name : Checkout
27+ uses : actions/checkout@v4
28+ - name : Setup Nix
29+ uses : DeterminateSystems/nix-installer-action@main
30+ - name : Cache Nix
31+ uses : DeterminateSystems/magic-nix-cache-action@main
32+ - name : Cache Go
33+ uses : actions/cache@v4
34+ with :
35+ key : ${{ runner.os }}-go-${{ hashfiles('go.mod', 'go.sum') }}
36+ path : |
37+ ~/.cache/go-build
38+ ~/go/pkg/mod
39+ - name : Test
40+ run : |
41+ nix develop ${{ env.CI_NIX_FLAKE }} --command \
42+ go test -v -cover -race ./...
Original file line number Diff line number Diff line change 1+ # https://github.com/github/gitignore/blob/main/Zig.gitignore
2+
3+ .zig-cache /
4+ zig-out /
5+
6+ # https://github.com/github/gitignore/blob/main/C.gitignore
7+
8+ # Prerequisites
9+ * .d
10+
11+ # Object files
12+ * .o
13+ * .ko
14+ * .obj
15+ * .elf
16+
17+ # Linker output
18+ * .ilk
19+ * .map
20+ * .exp
21+
22+ # Precompiled Headers
23+ * .gch
24+ * .pch
25+
26+ # Libraries
27+ * .lib
28+ * .a
29+ * .la
30+ * .lo
31+
32+ # Shared objects (inc. Windows DLLs)
33+ * .dll
34+ * .so
35+ * .so. *
36+ * .dylib
37+
38+ # Executables
39+ * .exe
40+ * .out
41+ * .app
42+ * .i * 86
43+ * .x86_64
44+ * .hex
45+
46+ # Debug files
47+ * .dSYM /
48+ * .su
49+ * .idb
50+ * .pdb
51+
52+ # Kernel Module Compile Results
53+ * .mod *
54+ * .cmd
55+ .tmp_versions /
56+ modules.order
57+ Module.symvers
58+ Mkfile.old
59+ dkms.conf
Original file line number Diff line number Diff line change 1+ nixpkgs/update :
2+ @nix flake lock --override-input nixpkgs github:NixOS/nixpkgs/$(rev )
3+
4+ .PHONY : build test run clean
5+
6+ run :
7+ @zig build run
Original file line number Diff line number Diff line change 1+ # C Project
Original file line number Diff line number Diff line change 1+ const std = @import ("std" );
2+
3+ pub fn build (b : * std.Build ) void {
4+ const target = b .standardTargetOptions (.{});
5+ const optimize = b .standardOptimizeOption (.{});
6+
7+ const run = b .step ("run" , "Run the app" );
8+ {
9+ const exe = b .addExecutable (.{
10+ .name = "cproject" ,
11+ .root_module = b .createModule (.{
12+ .target = target ,
13+ .optimize = optimize ,
14+ }),
15+ });
16+ exe .addCSourceFile (.{ .file = b .path ("main.c" ) });
17+ exe .linkLibC ();
18+ run .dependOn (& b .addRunArtifact (exe ).step );
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments