Skip to content

Commit 06ad00e

Browse files
template: add lua project
1 parent a743f06 commit 06ad00e

File tree

11 files changed

+177
-0
lines changed

11 files changed

+177
-0
lines changed

flake.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
path = ./template/java;
5858
description = "Setup Java Project";
5959
};
60+
lua = {
61+
path = ./template/lua;
62+
description = "Setup Lua Project";
63+
};
6064
zig = {
6165
path = ./template/zig;
6266
description = "Setup Zig Project";

template/lua/.editorconfig

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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,json}]
17+
indent_style = space
18+
indent_size = 2
19+
20+
[*.md]
21+
indent_style = space
22+
indent_size = 2
23+
24+
[*.lua]
25+
indent_style = space
26+
indent_size = 2
27+
quote_style = single
28+
trailing_table_separator = smart
29+
call_arg_parentheses = remove
30+
end_statement_with_semicolon = never

template/lua/.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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/flakehub-cache-action@main
19+
- name: Lint
20+
run: |
21+
nix develop ${{ env.CI_NIX_FLAKE }} --command \
22+
editorconfig-checker && echo "ok"

template/lua/.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# https://github.com/github/gitignore/blob/main/Lua.gitignore
2+
3+
# Compiled Lua sources
4+
luac.out
5+
6+
# luarocks build files
7+
*.src.rock
8+
*.zip
9+
*.tar.gz
10+
11+
# Object files
12+
*.o
13+
*.os
14+
*.ko
15+
*.obj
16+
*.elf
17+
18+
# Precompiled Headers
19+
*.gch
20+
*.pch
21+
22+
# Libraries
23+
*.lib
24+
*.a
25+
*.la
26+
*.lo
27+
*.def
28+
*.exp
29+
30+
# Shared objects (inc. Windows DLLs)
31+
*.dll
32+
*.so
33+
*.so.*
34+
*.dylib
35+
36+
# Executables
37+
*.exe
38+
*.out
39+
*.app
40+
*.i*86
41+
*.x86_64
42+
*.hex

template/lua/.luarc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"runtime": {
3+
"version": "Lua 5.1"
4+
},
5+
"workspace": {
6+
"checkThirdParty": "Disable"
7+
}
8+
}

template/lua/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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+
@lua main.lua

template/lua/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Lua Project

template/lua/flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

template/lua/flake.nix

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
description = "Lua Project";
3+
4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
5+
6+
outputs =
7+
{ nixpkgs, ... }:
8+
let
9+
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
10+
in
11+
{
12+
devShells = forAllSystems (
13+
system:
14+
let
15+
pkgs = nixpkgs.legacyPackages.${system};
16+
in
17+
{
18+
default = pkgs.mkShell {
19+
name = "lua-project";
20+
shellHook = ''
21+
git rev-parse --is-inside-work-tree >/dev/null 2>&1 || git init
22+
git config pull.rebase true
23+
${pkgs.neo-cowsay}/bin/cowsay -f sage "Lua Project"
24+
'';
25+
buildInputs = with pkgs; [
26+
editorconfig-checker
27+
luajit
28+
lua-language-server
29+
];
30+
};
31+
}
32+
);
33+
};
34+
}

0 commit comments

Comments
 (0)