commit 85b00618c15594aba4c5045b67678dc3d43760a4 Author: Frank LoTurco Date: Wed May 20 08:53:22 2026 -0400 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7a0795f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin/** +obj/** diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..3751555 --- /dev/null +++ b/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/dotnet-systemd.csproj b/dotnet-systemd.csproj new file mode 100644 index 0000000..a0c3cca --- /dev/null +++ b/dotnet-systemd.csproj @@ -0,0 +1,11 @@ + + + + Exe + net10.0 + dotnet_systemd + enable + enable + + + diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..088cb18 --- /dev/null +++ b/flake.nix @@ -0,0 +1,71 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + }; + + outputs = + inputs@{ + self, + flake-parts, + nixpkgs, + }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + + perSystem = + { pkgs, ... }: + let + dotnetRuntime = pkgs.dotnet-runtime_10; + in + { + packages.default = pkgs.buildDotnetModule rec { + pname = "dotnet-systemd"; + version = "0.1.0"; + src = "./"; + + nugetDeps = ./deps.nix; + + dotnet-sdk = pkgs.dotnet-sdk_10; + dotnet-runtime = dotnetRuntime; + + nativeBuildInputs = [ pkgs.makeWrapper ]; + + buildPhase = '' + dotnet build --configuration Release --no-restore + ''; + + installPhase = '' + mkdir -p $out/bin + cp -r bin/Release/net10.0/* $out/bin/ + + makeWrapper ${dotnetRuntime}/bin/dotnet $out/bin/dotnet-systemd \ + --add-flags "exec $out/bin/dotnet-systemd.dll" \ + --prefix LD_LIBRARY_PATH : "${ + pkgs.lib.makeLibraryPath [ + pkgs.stdenv.cc.cc.lib + pkgs.openssl + ] + }" + ''; + }; + + devShells.default = pkgs.mkShell { + packages = [ + pkgs.dotnet-sdk_10 + pkgs.omnisharp-roslyn + pkgs.nuget-to-nix + ]; + + shellHook = '' + export DOTNET_ROOT=${pkgs.dotnet-sdk_10} + mkdir -p .nuget-packages + export NUGET_PACKAGES="$PWD/.nuget-packages" + ''; + }; + }; + }; +}