I am struggling to include a project reference in my c# application when building the nix package.
buildInputs
can be used to resolveProjectReference
project items. Referenced projects can be packed withbuildDotnetModule
by setting thepackNupkg = true
attribute and passing a list of derivations tobuildInputs
. Since we are sharing referenced projects as NuGets they must be added to csproj/fsproj files asPackageReference
as well.
Do I have to package the referenced project as a separate nix package? Or as a derivation? I tried adding:
<ProjectReference Include="../foo/mydependeny.csproj" />
<PackageReference Include="mydependeny" Version="*" Condition=" '$(ContinuousIntegrationBuild)'=='true' "/>
But it did not work by itself. If I exclude the project reference alltoghether (build/package my app using only Nuget packages) it works fine.
Current package.nix:
{
lib,
stdenvNoCC,
buildDotnetModule,
fetchFromGitHub,
dotnetCorePackages,
makeDesktopItem,
copyDesktopItems,
makeWrapper,
alsa-lib,
lttng-ust,
numactl,
xorg,
udev,
nativeWayland ? false,
}:
buildDotnetModule rec {
pname = "my-project";
version = "0.1.1";
src = ./proj-root;
packNupkg = true;
projectFile = "./qufx/qufx.csproj";
nugetDeps = ./deps.json;
dotnet-sdk = dotnetCorePackages.sdk_9_0;
dotnet-runtime = dotnetCorePackages.runtime_9_0;
nativeBuildInputs = [
copyDesktopItems
makeWrapper
];
runtimeDeps = [
yt-dlp
alsa-lib
lttng-ust
numactl
xorg.libXi
udev
];
executables = [ "qufx" ];
meta = {
description = "qufx";
homepage = "https://github.com/";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ neurofibromin ];
platforms = [ "x86_64-linux" ];
mainProgram = "qufx";
};
}