From 852ae835d16fbc58f08f7c8ad2fa272eb6feff10 Mon Sep 17 00:00:00 2001 From: Kyle J Turpin Date: Sun, 27 Sep 2026 10:12:18 -0500 Subject: [PATCH] Add initial project structure with configuration and sample files - Create .envrc for Direnv configuration - Add .pre-commit-config.yaml for pre-commit hooks - Include CONTRIBUTING.md with contribution guidelines - Implement Makefile for build, run, and clean commands - Set up Program.cs with a basic Hello World message - Define SampleApp.csproj for .NET project configuration - Add agents.md for coding agent instructions - Create default.nix for Nix flake setup - Initialize deps.nix for NuGet dependencies - Configure Flatpak app with app.flatpak.json - Implement install-templates.sh for installing .NET templates - Define project.toml for project metadata - Set up shell.nix for development shell environment - Add SampleTest.cs for basic unit testing --- .envrc | 2 + .pre-commit-config.yaml | 8 + CONTRIBUTING.md | 9 + Makefile | 16 ++ Program.cs | 9 + SampleApp.csproj | 12 ++ agents.md | 16 ++ default.nix | 27 +++ deps.nix | 2 + flatpak/app.flatpak.json | 22 +++ install-templates.sh | 155 ++++++++++++++++++ ...CoreApp,Version=v8.0.AssemblyAttributes.cs | 4 + obj/Debug/net8.0/SampleApp.AssemblyInfo.cs | 22 +++ .../net8.0/SampleApp.AssemblyInfoInputs.cache | 1 + ....GeneratedMSBuildEditorConfig.editorconfig | 13 ++ obj/Debug/net8.0/SampleApp.GlobalUsings.g.cs | 8 + obj/Debug/net8.0/SampleApp.assets.cache | Bin 0 -> 151 bytes obj/SampleApp.csproj.nuget.dgspec.json | 67 ++++++++ obj/SampleApp.csproj.nuget.g.props | 15 ++ obj/SampleApp.csproj.nuget.g.targets | 2 + obj/project.assets.json | 72 ++++++++ obj/project.nuget.cache | 8 + project.toml | 7 + shell.nix | 11 ++ tests/SampleTest.cs | 9 + 25 files changed, 517 insertions(+) create mode 100644 .envrc create mode 100644 .pre-commit-config.yaml create mode 100644 CONTRIBUTING.md create mode 100644 Makefile create mode 100644 Program.cs create mode 100644 SampleApp.csproj create mode 100644 agents.md create mode 100644 default.nix create mode 100644 deps.nix create mode 100644 flatpak/app.flatpak.json create mode 100644 install-templates.sh create mode 100644 obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs create mode 100644 obj/Debug/net8.0/SampleApp.AssemblyInfo.cs create mode 100644 obj/Debug/net8.0/SampleApp.AssemblyInfoInputs.cache create mode 100644 obj/Debug/net8.0/SampleApp.GeneratedMSBuildEditorConfig.editorconfig create mode 100644 obj/Debug/net8.0/SampleApp.GlobalUsings.g.cs create mode 100644 obj/Debug/net8.0/SampleApp.assets.cache create mode 100644 obj/SampleApp.csproj.nuget.dgspec.json create mode 100644 obj/SampleApp.csproj.nuget.g.props create mode 100644 obj/SampleApp.csproj.nuget.g.targets create mode 100644 obj/project.assets.json create mode 100644 obj/project.nuget.cache create mode 100644 project.toml create mode 100644 shell.nix create mode 100644 tests/SampleTest.cs diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..ea35353 --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +# Direnv configuration for Nix flakes +use flake \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..93d696f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a94fcb9 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,9 @@ +# Contributing + +Thank you for considering contributing! + +- Please follow the project coding style and directory structure. +- Submit issues or pull requests for bugs, features, or improvements. +- Add tests for new features where possible. +- Ensure your code builds and passes tests before submitting. +- Contributions are licensed under CC BY-SA 4.0. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..654705b --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +# Makefile for .NET template +.PHONY: build run clean + +build: + dotnet build + +run: + dotnet run + +clean: + dotnet clean + + +# Flatpak build target +.PHONY: flatpak-build: + flatpak-builder --force-clean build-flatpak flatpak/app.flatpak.json diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..69b3e52 --- /dev/null +++ b/Program.cs @@ -0,0 +1,9 @@ +using System; + +class Program +{ + static void Main(string[] args) + { + Console.WriteLine("Hello from .NET skeletal app. Edit Program.cs to get started!"); + } +} diff --git a/SampleApp.csproj b/SampleApp.csproj new file mode 100644 index 0000000..35f1b43 --- /dev/null +++ b/SampleApp.csproj @@ -0,0 +1,12 @@ + + + Exe + net8.0 + enable + enable + + + + + + diff --git a/agents.md b/agents.md new file mode 100644 index 0000000..6dbad2a --- /dev/null +++ b/agents.md @@ -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 (project root) 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. diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..fb4288d --- /dev/null +++ b/default.nix @@ -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; + }; + }; +} diff --git a/deps.nix b/deps.nix new file mode 100644 index 0000000..2d56c10 --- /dev/null +++ b/deps.nix @@ -0,0 +1,2 @@ +# Generated by nuget-to-nix (empty template for projects without external NuGet dependencies) +[] diff --git a/flatpak/app.flatpak.json b/flatpak/app.flatpak.json new file mode 100644 index 0000000..f86f76d --- /dev/null +++ b/flatpak/app.flatpak.json @@ -0,0 +1,22 @@ +{ + "app-id": "org.example.dotnetdevshell", + "runtime": "org.freedesktop.Platform", + "runtime-version": "23.08", + "sdk": "org.freedesktop.Sdk", + "command": "dotnetdevshell-app", + "modules": [ + { + "name": "dotnetdevshell-app", + "buildsystem": "simple", + "build-commands": [ + "dotnet publish -c Release -o out" + ], + "sources": [ + { + "type": "dir", + "path": ".." + } + ] + } + ] +} \ No newline at end of file diff --git a/install-templates.sh b/install-templates.sh new file mode 100644 index 0000000..cbf32a7 --- /dev/null +++ b/install-templates.sh @@ -0,0 +1,155 @@ +#!/usr/bin/env bash +# Helper script to install popular .NET templates from NuGet + +set -e + +echo "🔧 .NET Template Installer" +echo "==========================" +echo "" + +# Function to install a template +install_template() { + local name="$1" + local package="$2" + echo "📦 Installing $name..." + dotnet new install "$package" || echo "⚠️ Failed to install $name" + echo "" +} + +# Parse arguments +if [ "$#" -eq 0 ]; then + echo "Usage: $0 [all|web|cloud|testing|mobile|list]" + echo "" + echo "Categories:" + echo " all - Install all popular templates" + echo " web - Web development templates" + echo " cloud - Cloud & AWS templates" + echo " testing - Testing frameworks" + echo " mobile - Mobile development" + echo " list - Show available categories" + echo "" + echo "Individual templates:" + echo " aws - AWS Lambda templates" + echo " blazor - Blazor templates" + echo " nunit - NUnit 3 test templates" + echo " xunit - xUnit test templates" + echo " reqnroll - Reqnroll BDD templates" + echo " avalonia - Avalonia UI (cross-platform)" + echo " boxed - ASP.NET Core Boxed templates" + echo " clean - Clean Architecture templates" + echo " giraffe - Giraffe F# web framework" + echo " safe - SAFE Stack (F#)" + exit 0 +fi + +case "$1" in + all) + echo "Installing all popular templates..." + install_template "AWS Lambda" "Amazon.Lambda.Templates" + install_template "NUnit 3" "NUnit3.DotNetNew.Template" + install_template "Reqnroll" "Reqnroll.Templates.DotNet" + install_template ".NET Boxed" "Boxed.Templates" + install_template "Avalonia UI" "Avalonia.Templates" + install_template "Clean Architecture (Manga)" "Paulovich.Manga" + ;; + + web) + echo "Installing web development templates..." + install_template ".NET Boxed" "Boxed.Templates" + install_template "Carter" "CarterTemplate" + install_template "Giraffe (F#)" "giraffe-template" + ;; + + cloud) + echo "Installing cloud templates..." + install_template "AWS Lambda" "Amazon.Lambda.Templates" + install_template "Azure Functions" "Microsoft.Azure.Functions.Templates" + ;; + + testing) + echo "Installing testing templates..." + install_template "NUnit 3" "NUnit3.DotNetNew.Template" + install_template "Reqnroll" "Reqnroll.Templates.DotNet" + install_template "NSpec" "dotnet-new-nspec" + install_template "Expecto (F#)" "Expecto.Template" + ;; + + mobile) + echo "Installing mobile development templates..." + install_template "Avalonia UI" "Avalonia.Templates" + install_template "Fabulous Xamarin.Forms" "Fabulous.XamarinForms.Templates" + ;; + + aws) + install_template "AWS Lambda" "Amazon.Lambda.Templates" + ;; + + blazor) + install_template "Blazor" "Microsoft.AspNetCore.Blazor.Templates::3.0.0-*" + ;; + + nunit) + install_template "NUnit 3" "NUnit3.DotNetNew.Template" + ;; + + xunit) + install_template "xUnit Test File" "GatewayProgrammingSchool.xUnit.CSharp" + ;; + + reqnroll) + install_template "Reqnroll" "Reqnroll.Templates.DotNet" + ;; + + avalonia) + install_template "Avalonia UI" "Avalonia.Templates" + ;; + + boxed) + install_template ".NET Boxed" "Boxed.Templates" + ;; + + clean) + install_template "Clean Architecture (Manga)" "Paulovich.Manga" + install_template "Clean Architecture (Caju)" "Paulovich.Caju" + ;; + + giraffe) + install_template "Giraffe (F#)" "giraffe-template" + ;; + + safe) + install_template "SAFE Stack (F#)" "SAFE.Template" + ;; + + list) + echo "Available categories and templates:" + echo "" + echo "Categories:" + echo " all - Install all popular templates" + echo " web - Web development (Boxed, Carter, Giraffe)" + echo " cloud - Cloud platforms (AWS Lambda, Azure Functions)" + echo " testing - Testing frameworks (NUnit, Reqnroll, NSpec)" + echo " mobile - Mobile development (Avalonia, Fabulous)" + echo "" + echo "Individual templates:" + echo " aws - AWS Lambda templates" + echo " blazor - Blazor templates" + echo " nunit - NUnit 3 test templates" + echo " xunit - xUnit test templates" + echo " reqnroll - Reqnroll BDD templates" + echo " avalonia - Avalonia UI (cross-platform)" + echo " boxed - ASP.NET Core Boxed templates" + echo " clean - Clean Architecture templates" + echo " giraffe - Giraffe F# web framework" + echo " safe - SAFE Stack (F#)" + ;; + + *) + echo "❌ Unknown option: $1" + echo "Run '$0' without arguments to see usage." + exit 1 + ;; +esac + +echo "" +echo "✅ Done! List installed templates with: dotnet new list" diff --git a/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs b/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs new file mode 100644 index 0000000..2217181 --- /dev/null +++ b/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] diff --git a/obj/Debug/net8.0/SampleApp.AssemblyInfo.cs b/obj/Debug/net8.0/SampleApp.AssemblyInfo.cs new file mode 100644 index 0000000..5fa0c31 --- /dev/null +++ b/obj/Debug/net8.0/SampleApp.AssemblyInfo.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("SampleApp")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+bf1ee307c4685b53b646d2fe5262a387f7f4436b")] +[assembly: System.Reflection.AssemblyProductAttribute("SampleApp")] +[assembly: System.Reflection.AssemblyTitleAttribute("SampleApp")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/obj/Debug/net8.0/SampleApp.AssemblyInfoInputs.cache b/obj/Debug/net8.0/SampleApp.AssemblyInfoInputs.cache new file mode 100644 index 0000000..bff2148 --- /dev/null +++ b/obj/Debug/net8.0/SampleApp.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +edc3f47facf5fd644d86f80cd978eaba671a3b1162e7912252145921f18c4a43 diff --git a/obj/Debug/net8.0/SampleApp.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net8.0/SampleApp.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..db05bea --- /dev/null +++ b/obj/Debug/net8.0/SampleApp.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,13 @@ +is_global = true +build_property.TargetFramework = net8.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = SampleApp +build_property.ProjectDir = /home/gooba42/Documents/Projects/Coding/dotnet/flaky/ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = diff --git a/obj/Debug/net8.0/SampleApp.GlobalUsings.g.cs b/obj/Debug/net8.0/SampleApp.GlobalUsings.g.cs new file mode 100644 index 0000000..8578f3d --- /dev/null +++ b/obj/Debug/net8.0/SampleApp.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/obj/Debug/net8.0/SampleApp.assets.cache b/obj/Debug/net8.0/SampleApp.assets.cache new file mode 100644 index 0000000000000000000000000000000000000000..15c89b7f3074258d5cde730a366039515d597424 GIT binary patch literal 151 zcmWIWc6a1qU|{fyWwUaM*sv~jOO#S|Y2xDPyxG2A?n&e=ytvCwb++TH$qd8;Mg|53 mIsJ_M+*JMa{QRUu6C-`Sywdd468(b2/nuget/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + }, + "restoreAuditProperties": { + "enableAudit": "true", + "auditLevel": "low", + "auditMode": "direct" + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "/nix/store/z9k3zizjvnvc7la71zlm7amz7fyz5wi4-dotnet-sdk-8.0.424/share/dotnet/sdk/8.0.424/PortableRuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/obj/SampleApp.csproj.nuget.g.props b/obj/SampleApp.csproj.nuget.g.props new file mode 100644 index 0000000..cee78f7 --- /dev/null +++ b/obj/SampleApp.csproj.nuget.g.props @@ -0,0 +1,15 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + /home/gooba42/.nuget/packages/ + /home/gooba42/.nuget/packages/ + PackageReference + 6.11.2 + + + + + \ No newline at end of file diff --git a/obj/SampleApp.csproj.nuget.g.targets b/obj/SampleApp.csproj.nuget.g.targets new file mode 100644 index 0000000..3dc06ef --- /dev/null +++ b/obj/SampleApp.csproj.nuget.g.targets @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/obj/project.assets.json b/obj/project.assets.json new file mode 100644 index 0000000..16090d5 --- /dev/null +++ b/obj/project.assets.json @@ -0,0 +1,72 @@ +{ + "version": 3, + "targets": { + "net8.0": {} + }, + "libraries": {}, + "projectFileDependencyGroups": { + "net8.0": [] + }, + "packageFolders": { + "/home/gooba42/.nuget/packages/": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "/home/gooba42/Documents/Projects/Coding/dotnet/flaky/SampleApp.csproj", + "projectName": "SampleApp", + "projectPath": "/home/gooba42/Documents/Projects/Coding/dotnet/flaky/SampleApp.csproj", + "packagesPath": "/home/gooba42/.nuget/packages/", + "outputPath": "/home/gooba42/Documents/Projects/Coding/dotnet/flaky/obj/", + "projectStyle": "PackageReference", + "configFilePaths": [ + "/home/gooba42/.nuget/NuGet/NuGet.Config" + ], + "originalTargetFrameworks": [ + "net8.0" + ], + "sources": { + "https://api.nuget.org/v3/index.json": {}, + "https://git.moturpin.com/api/packages//nuget/index.json": {} + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + }, + "restoreAuditProperties": { + "enableAudit": "true", + "auditLevel": "low", + "auditMode": "direct" + } + }, + "frameworks": { + "net8.0": { + "targetAlias": "net8.0", + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "/nix/store/z9k3zizjvnvc7la71zlm7amz7fyz5wi4-dotnet-sdk-8.0.424/share/dotnet/sdk/8.0.424/PortableRuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/obj/project.nuget.cache b/obj/project.nuget.cache new file mode 100644 index 0000000..0917461 --- /dev/null +++ b/obj/project.nuget.cache @@ -0,0 +1,8 @@ +{ + "version": 2, + "dgSpecHash": "YHNJGPxTJZ8=", + "success": true, + "projectFilePath": "/home/gooba42/Documents/Projects/Coding/dotnet/flaky/SampleApp.csproj", + "expectedPackageFiles": [], + "logs": [] +} \ No newline at end of file diff --git a/project.toml b/project.toml new file mode 100644 index 0000000..8d08708 --- /dev/null +++ b/project.toml @@ -0,0 +1,7 @@ +# Project metadata for .NET template +[project] +name = "dotnet-template" +description = "Nix flake template for .NET projects" +authors = ["Your Name "] +version = "0.1.0" +license = "MIT" diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..a85ff25 --- /dev/null +++ b/shell.nix @@ -0,0 +1,11 @@ +# Legacy shell.nix for .NET template +{pkgs ? import {}}: +pkgs.mkShell { + buildInputs = [ + pkgs.dotnet-sdk + pkgs.git + ]; + shellHook = "" " +echo 'Welcome to the .NET devShell!' +" ""; +} diff --git a/tests/SampleTest.cs b/tests/SampleTest.cs new file mode 100644 index 0000000..58b0163 --- /dev/null +++ b/tests/SampleTest.cs @@ -0,0 +1,9 @@ +using Xunit; +public class SampleTest +{ + [Fact] + public void TestSample() + { + Assert.Equal(1, 1); + } +}