add lua; add editorconfig

This commit is contained in:
jmarkin 2025-05-03 21:02:55 +03:00
parent 26f008c0b8
commit b0750a3f20
14 changed files with 392 additions and 51 deletions

28
.editorconfig Normal file
View file

@ -0,0 +1,28 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
max_line_length = 120
[*.md]
trim_trailing_whitespace = false
[{makefile,Makefile}]
indent_style = tab
tab_width = 4
[Makefile.*]
indent_style = tab
tab_width = 4
[*.{tab,tsv}]
indent_style = tab
tab_width = 1
[*.py]
indent_size = 4

View file

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1672057183,
"narHash": "sha256-GN7/10DNNvs1FPj9tlZA2qgNdFuYKKuS3qlHTqAxasQ=",
"lastModified": 1746206129,
"narHash": "sha256-JA4DynBKhY7t4DdJZTuomRLAiXFDUgCGGwxgt+XGiik=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b139e44d78c36c69bcbb825b20dbfa51e7738347",
"rev": "9a7caecf30a0494c88b7daeeed29244cd9a52e7d",
"type": "github"
},
"original": {

View file

@ -43,6 +43,13 @@
Minimal starting project for nix-based rust project development
'';
};
lua = {
path = ./templates/lua;
description = ''
Minimal starting project for nix-based lua project development
'';
};
};
};
}

View file

@ -0,0 +1,28 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
max_line_length = 120
[*.md]
trim_trailing_whitespace = false
[{makefile,Makefile}]
indent_style = tab
tab_width = 4
[Makefile.*]
indent_style = tab
tab_width = 4
[*.{tab,tsv}]
indent_style = tab
tab_width = 1
[*.py]
indent_size = 4

View file

@ -0,0 +1,28 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
max_line_length = 120
[*.md]
trim_trailing_whitespace = false
[{makefile,Makefile}]
indent_style = tab
tab_width = 4
[Makefile.*]
indent_style = tab
tab_width = 4
[*.{tab,tsv}]
indent_style = tab
tab_width = 1
[*.py]
indent_size = 4

28
templates/lua/.envrc Normal file
View file

@ -0,0 +1,28 @@
# vi: ft=bash
# shellcheck shell=bash
use flake;
# If .env missing; restore from .env.example and validate
# See https://github.com/direnv/direnv/wiki/.envrc-Boilerplate
if [[ -f .env.sample ]]; then
if ! command -v createnv > /dev/null; then
echo 'WARN|https://github.com/cuducos/createnv'
fi
fi
if [[ -f .env.example ]]; then
if ! command -v createnv --source .env.example > /dev/null; then
echo 'WARN|https://github.com/cuducos/createnv'
elif [[ ! -f .env ]]; then
createnv --use-default --overwrite \
|| echo 'ERROR|https://github.com/cuducos/createnv'
if command dotenv-linter --version >&/dev/null; then
dotenv-linter .env || echo 'ERROR|https://dotenv-linter.github.io'
fi
fi
fi
export LSP_AUTOSTART=1
dotenv_if_exists || direnv status # https://direnv.net/man/direnv-stdlib.1.html

115
templates/lua/.gitignore vendored Normal file
View file

@ -0,0 +1,115 @@
# Created by https://www.toptal.com/developers/gitignore/api/lua,linux,macos,vim
# Edit at https://www.toptal.com/developers/gitignore?templates=lua,linux,macos,vim
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### Lua ###
# Compiled Lua sources
luac.out
# luarocks build files
*.src.rock
*.zip
*.tar.gz
# Object files
*.o
*.os
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
*.def
*.exp
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
### Vim ###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
# End of https://www.toptal.com/developers/gitignore/api/lua,linux,macos,vim

22
templates/lua/flake.nix Normal file
View file

@ -0,0 +1,22 @@
{
description = "My awesome lua project";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
};
outputs = { self, flake-parts, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
imports = [ ./nix/development.nix ];
perSystem = { system, config, pkgs-dev, ... }: {
formatter = pkgs-dev.nixfmt-classic;
};
};
}

View file

@ -0,0 +1,21 @@
{...}:
{
flake.overlays.dev = nixpkgs.lib.composeManyExtensions [
# NOTE: Put development overlays here.
];
perSystem = { system, pkgs-dev, lib, ... }:
{
_module.args.pkgs-dev = import nixpkgs {
inherit system;
overlays = [ self.overlays.dev ];
};
devShells.default = pkgs-dev.mkShell {
packages = [
pkgs-dev.stylua
pkgs-dev.lua-language-server
];
};
};
}

View file

@ -0,0 +1,28 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
max_line_length = 120
[*.md]
trim_trailing_whitespace = false
[{makefile,Makefile}]
indent_style = tab
tab_width = 4
[Makefile.*]
indent_style = tab
tab_width = 4
[*.{tab,tsv}]
indent_style = tab
tab_width = 1
[*.py]
indent_size = 4

View file

@ -0,0 +1,28 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
max_line_length = 120
[*.md]
trim_trailing_whitespace = false
[{makefile,Makefile}]
indent_style = tab
tab_width = 4
[Makefile.*]
indent_style = tab
tab_width = 4
[*.{tab,tsv}]
indent_style = tab
tab_width = 1
[*.py]
indent_size = 4

View file

@ -0,0 +1,28 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
max_line_length = 120
[*.md]
trim_trailing_whitespace = false
[{makefile,Makefile}]
indent_style = tab
tab_width = 4
[Makefile.*]
indent_style = tab
tab_width = 4
[*.{tab,tsv}]
indent_style = tab
tab_width = 1
[*.py]
indent_size = 4

View file

@ -1,48 +0,0 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1736143030,
"narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1737672001,
"narHash": "sha256-YnHJJ19wqmibLQdUeq9xzE6CjrMA568KN/lFPuSVs4I=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "035f8c0853c2977b24ffc4d0a42c74f00b182cd8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View file

@ -0,0 +1,28 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
max_line_length = 120
[*.md]
trim_trailing_whitespace = false
[{makefile,Makefile}]
indent_style = tab
tab_width = 4
[Makefile.*]
indent_style = tab
tab_width = 4
[*.{tab,tsv}]
indent_style = tab
tab_width = 1
[*.py]
indent_size = 4