Initial commit after template instantiation
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
end_of_line = lf
|
||||||
|
|
||||||
|
[*.{c,h,cpp,hpp,cc,hh,cxx,hxx}]
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.{java,scala,cs,fs,rs,go,py}]
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
|
[*.go]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
+10
-62
@@ -1,65 +1,13 @@
|
|||||||
# ---> Lua
|
# Lua artifacts
|
||||||
# Compiled Lua sources
|
*.luac
|
||||||
luac.out
|
*.log
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
|
||||||
# luarocks build files
|
# IDE
|
||||||
*.src.rock
|
.vscode/
|
||||||
*.zip
|
.idea/
|
||||||
*.tar.gz
|
|
||||||
|
|
||||||
# Object files
|
# Nix
|
||||||
*.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
|
|
||||||
|
|
||||||
|
|
||||||
# ---> VisualStudioCode
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
!.vscode/*.code-snippets
|
|
||||||
|
|
||||||
# Local History for Visual Studio Code
|
|
||||||
.history/
|
|
||||||
|
|
||||||
# Built Visual Studio Code Extensions
|
|
||||||
*.vsix
|
|
||||||
|
|
||||||
# ---> Nix
|
|
||||||
# Ignore build outputs from performing a nix-build or `nix build` command
|
|
||||||
result
|
result
|
||||||
result-*
|
.direnv/
|
||||||
|
|
||||||
# Ignore automatically generated direnv output
|
|
||||||
.direnv
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# Makefile
|
||||||
|
.PHONY: build run clean
|
||||||
|
|
||||||
|
build:
|
||||||
|
@echo 'Add build steps here'
|
||||||
|
|
||||||
|
run:
|
||||||
|
lua src/main.lua
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo 'Add clean steps here'
|
||||||
|
|
||||||
|
# Standardized code quality targets
|
||||||
|
fmt format:
|
||||||
|
stylua .
|
||||||
|
|
||||||
|
lint:
|
||||||
|
luacheck . 2>/dev/null || true
|
||||||
|
|
||||||
|
check: fmt lint
|
||||||
@@ -1,2 +1,52 @@
|
|||||||
# IsaacMod
|
|
||||||
|
|
||||||
|
# Lua Dev Flake
|
||||||
|
|
||||||
|
Find the latest version of this template at:
|
||||||
|
<https://git.moturpin.com/Moturpin_Manor/nix-devshells/src/branch/master/lua-dev>
|
||||||
|
|
||||||
|
A Nix flake template for Lua development. Provides a dev shell and a minimal Lua project.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Lua interpreter and dev shell
|
||||||
|
- Example project: `src/main.lua` (hello world)
|
||||||
|
- Ready for extension with additional Lua modules
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
### Enter the Dev Shell
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix develop git+https://git.moturpin.com/Moturpin_Manor/nix-devshells.git?dir=lua-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Initialize a New Project from Template
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix flake init -t git+https://git.moturpin.com/Moturpin_Manor/nix-devshells.git?dir=lua-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Run the Example
|
||||||
|
|
||||||
|
```bash
|
||||||
|
lua src/main.lua
|
||||||
|
```
|
||||||
|
|
||||||
|
## Packaging for nixpkgs
|
||||||
|
|
||||||
|
This template is structured for easy packaging in nixpkgs:
|
||||||
|
|
||||||
|
- All sources in `src/`
|
||||||
|
- `flake.nix` provides a devShell and template
|
||||||
|
- Add a `default.nix` or package expression as needed for nixpkgs
|
||||||
|
|
||||||
|
See [nixpkgs Lua packaging docs](https://nixos.org/manual/nixpkgs/stable/#lua) for more details.
|
||||||
|
|
||||||
|
## Included Project Layout
|
||||||
|
|
||||||
|
```
|
||||||
|
src/
|
||||||
|
main.lua
|
||||||
|
```
|
||||||
|
|
||||||
|
You can use this as a starting point for your own Lua project.
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# Coding Agent Instructions
|
||||||
|
|
||||||
|
This project is intended for educational purposes. To support this, please adhere to the following guidelines:
|
||||||
|
|
||||||
|
## Allowed Actions
|
||||||
|
- **Environment Maintenance:** Feel free to update Nix flakes, shell configurations, or other environment-related setup.
|
||||||
|
- **Project Housekeeping:** Maintain a standard project layout, keep `README.md` up-to-date, and clean up temporary or build-related files.
|
||||||
|
- **Documentation:** Add comments, manage project documentation, and add links to relevant external resources.
|
||||||
|
|
||||||
|
## Restricted Actions
|
||||||
|
- **Source Code Editing:** You are NOT allowed to edit the executable source code (`src/` directory) except to improve documentation..
|
||||||
|
- **Code Generation:** Do not provide example code unless explicitly asked by the user.
|
||||||
|
|
||||||
|
## Communication Guidelines
|
||||||
|
- **Educational Focus:** When asked about code, prioritize explaining the concepts and providing advice over writing code.
|
||||||
|
- **Documentation Links:** Always include links to official language or library documentation for references.
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
{pkgs}: let
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
templateName = builtins.baseNameOf (toString ./.);
|
||||||
|
in {
|
||||||
|
${templateName} = pkgs.stdenvNoCC.mkDerivation {
|
||||||
|
pname = templateName;
|
||||||
|
version = "0.1.0";
|
||||||
|
src = ./.;
|
||||||
|
dontBuild = true;
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/share/${templateName}
|
||||||
|
if [ -d src ]; then
|
||||||
|
cp -r src $out/share/${templateName}/
|
||||||
|
fi
|
||||||
|
for f in README.md project.toml flake.nix default.nix shell.nix Makefile .editorconfig .gitignore; do
|
||||||
|
if [ -f "$f" ]; then
|
||||||
|
cp "$f" $out/share/${templateName}/
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Template project: ${templateName}";
|
||||||
|
license = licenses.unfreeRedistributable;
|
||||||
|
platforms = platforms.all;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Generated
+26
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1792251743,
|
||||||
|
"narHash": "sha256-fGkUuXD8g/MCxvVp6jPAXvGSrqCzkVvloOfPtltKJjE=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "3e341de5657a149d3fd9ad0a6fcc211333ffbec3",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
# flakes/lua-dev/flake.nix — Lua dev flake
|
||||||
|
{
|
||||||
|
description = "Dev shell and template for Lua projects";
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
}: let
|
||||||
|
supportedSystems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
forEachSupportedSystem = f:
|
||||||
|
nixpkgs.lib.genAttrs supportedSystems (
|
||||||
|
system:
|
||||||
|
f {
|
||||||
|
pkgs = import nixpkgs {inherit system;};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in {
|
||||||
|
formatter = forEachSupportedSystem ({pkgs, ...}: pkgs.stylua);
|
||||||
|
|
||||||
|
devShells = forEachSupportedSystem (
|
||||||
|
{pkgs}: {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
lua
|
||||||
|
stylua
|
||||||
|
nix
|
||||||
|
alejandra
|
||||||
|
statix
|
||||||
|
deadnix
|
||||||
|
git
|
||||||
|
gnumake
|
||||||
|
|
||||||
|
editorconfig-checker
|
||||||
|
|
||||||
|
pre-commit
|
||||||
|
];
|
||||||
|
shellHook = ''
|
||||||
|
if [ ! -d .git ]; then
|
||||||
|
git init
|
||||||
|
echo "✓ Initialized git repository"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[lua-dev-template] Welcome to the Lua dev shell!"
|
||||||
|
echo "Tools: lua, stylua, alejandra, statix, deadnix, git
|
||||||
|
gnumake"
|
||||||
|
echo "See README.md for usage."
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
packages = forEachSupportedSystem (
|
||||||
|
{pkgs}: {
|
||||||
|
default = pkgs.writeShellScriptBin "sample-lua-app" ''
|
||||||
|
exec ${pkgs.lua}/bin/lua ${./src/main.lua}
|
||||||
|
'';
|
||||||
|
|
||||||
|
dev-helper = pkgs.writeShellScriptBin "dev-helper" ''
|
||||||
|
echo "Lua Development Environment"
|
||||||
|
echo "====================================="
|
||||||
|
echo "Lua version: $(lua -v 2>&1 || echo not found)"
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
apps = forEachSupportedSystem (
|
||||||
|
{pkgs}: {
|
||||||
|
default = {
|
||||||
|
type = "app";
|
||||||
|
program = pkgs.lib.getExe self.packages.${pkgs.system}.default;
|
||||||
|
};
|
||||||
|
dev-helper = {
|
||||||
|
type = "app";
|
||||||
|
program = pkgs.lib.getExe self.packages.${pkgs.system}.dev-helper;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
templates.default = {
|
||||||
|
path = ./.;
|
||||||
|
description = "Minimal Lua project";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"app-id": "org.example.luadevshell",
|
||||||
|
"runtime": "org.freedesktop.Platform",
|
||||||
|
"runtime-version": "23.08",
|
||||||
|
"sdk": "org.freedesktop.Sdk",
|
||||||
|
"command": "lua-app",
|
||||||
|
"modules": [
|
||||||
|
{
|
||||||
|
"name": "lua-app",
|
||||||
|
"buildsystem": "simple",
|
||||||
|
"build-commands": [
|
||||||
|
"lua src/main.lua"
|
||||||
|
],
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"type": "dir",
|
||||||
|
"path": ".."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- src/main.lua
|
||||||
|
-- Minimal Lua project for Nix flake template
|
||||||
|
|
||||||
|
print("Hello from Lua flake template!")
|
||||||
Reference in New Issue
Block a user