72 lines
1.8 KiB
Nix
72 lines
1.8 KiB
Nix
{
|
|
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"
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
}
|