!bxVOQwsVoHhZcmNDGw:nixos.org

Nix + dotnet

114 Members
23 Servers

Load older messages


SenderMessageTime
14 Aug 2025
@corngood:corngood.comCorngood There's no more csproj bit. I don't think we need to check for multiple files because dotnet itself will just fail 20:17:34
@gggkiller:matrix.orgGGG yeah, but if there's .slnx and .slnf it'll fail, and to not duplicate that logic, wouldn't it be better to just explicitly demand a specific file? 20:18:24
@corngood:corngood.comCorngood I'll add slnx/f there as well. I'd rather not require an explicit file because I feel like if you set up a project where dotnet build works, you should be okay. Along the lines of Makefile. 20:21:08
@gggkiller:matrix.orgGGGthat'll just add more maintenance churn for us though, and usually building the whole solution is the wrong path anyways because for solutions where there are external tools and etc, projects just build the CLI/UI and its dependencies20:21:53
@gggkiller:matrix.orgGGGI have stumbled upon packages in nixpkgs before where people where restoring and building the whole solution unnecessarily when building the csproj for only the CLI/UI would've sufficed20:22:25
@oatmealraisin:matrix.orgoatmealraisin ok, now I'm getting an unrelated error? error NETSDK1152: Found multiple publish output files with the same relative path: /build/bshmhbaaawknnvv0bnrm5sk2zvprrdq3-source/src/WebUI/deps.json, /build/bshmhbaaawknnvv0bnrm5sk2zvprrdq3-source/src/API/deps.json. [/build/bshmhbaaawknnvv0bnrm5sk2zvprrdq3-source/src/API/API.csproj] 20:22:39
@oatmealraisin:matrix.orgoatmealraisin`{ pkgs ? import <nixpkgs> {} }: let Application = import ../Application { pkgs = pkgs; }; DataMatrixGenerator = import ../../utils/DataMatrixGenerator { pkgs = pkgs; }; Infrastrcture = import ../Infrastructure { pkgs = pkgs; }; WebUI = import ../WebUI { pkgs = pkgs; }; in pkgs.buildDotnetModule { pname = "API.csproj"; version = "0.1"; src = ../..; projectFile = "src/API/API.csproj"; buildInputs = [ Application DataMatrixGenerator Infrastrcture WebUI ]; dotnetPackFlags = [ "-p:RuntimeIdentifier=linux-x64" ]; nugetDeps = ./deps.json; packNupkg = false; } `20:24:21
@oatmealraisin:matrix.orgoatmealraisinhow 2 into matrix markdown20:24:31
@oatmealraisin:matrix.orgoatmealraisin *

let
  Application = import ../Application { pkgs = pkgs; };
  DataMatrixGenerator = import ../../utils/DataMatrixGenerator { pkgs = pkgs; };
  Infrastrcture = import ../Infrastructure { pkgs = pkgs; };
  WebUI = import ../WebUI { pkgs = pkgs; };
in
pkgs.buildDotnetModule {
  pname = "API.csproj";
  version = "0.1";

  src = ../..;

  projectFile = "src/API/API.csproj";

  buildInputs = \[
    Application
    DataMatrixGenerator
    Infrastrcture
    WebUI
  \];

  dotnetPackFlags = \[ "-p:RuntimeIdentifier=linux-x64" \];
  nugetDeps = ./deps.json;
  packNupkg = false;
}
20:24:45
@corngood:corngood.comCorngoodI hope maintenance would be on the order of the number of new solution file extensions they add, and we'd still need to check if they're building a solution, so it would only slightly simplify the logic20:25:07
@gggkiller:matrix.orgGGG that's because you're including the deps.json into your project, you should exclude it from the projects by editing the .csproj or by filtering them out of src 20:25:35
@oatmealraisin:matrix.orgoatmealraisin *

let
  Application = import ../Application { pkgs = pkgs; };
  DataMatrixGenerator = import ../../utils/DataMatrixGenerator { pkgs = pkgs; };
  Infrastrcture = import ../Infrastructure { pkgs = pkgs; };
  WebUI = import ../WebUI { pkgs = pkgs; };
in
pkgs.buildDotnetModule {
  pname = "API.csproj";
  version = "0.1";

  src = ../..;

  projectFile = "src/API/API.csproj";

  buildInputs = [
    Application
    DataMatrixGenerator
    Infrastrcture
    WebUI
  ];

  dotnetPackFlags = [ "-p:RuntimeIdentifier=linux-x64" ];
  nugetDeps = ./deps.json;
  packNupkg = false;
}
20:25:36
@gggkiller:matrix.orgGGGI don't recommend embedding the nix files into your source like that, I'd put them into a separate directory where they don't mix with the code20:26:15
@corngood:corngood.comCorngood Hmm, maybe we can use dotnet sln list to check for a solution 20:34:22
@oatmealraisin:matrix.orgoatmealraisin It's kinda hard to find info on conventions around projects instead of nixos, where do you normally put your *.nix files? 20:36:04
@whovian9369:matrix.orgWhovian9369 Speaking from personal experience when looking around, I commonly see flake.nix and flake.lock in the root of the repository, while extra files (package.nix/default.nix, deps.json, etc) being relegated to /nix/ 20:39:25
@whovian9369:matrix.orgWhovian9369 * Speaking from personal experience when looking around, I commonly see flake.nix and flake.lock in the root of the repository, while extra files (package.nix/default.nix, deps.json, etc) being relegated to a repo's /nix/ 20:39:47
@oatmealraisin:matrix.orgoatmealraisinAlright, I'll start moving everything over there and try this again20:47:58
@oatmealraisin:matrix.orgoatmealraisinThese builds take a pretty ridiculous amount of time, rough stuff20:48:15
@corngood:corngood.comCorngoodWhy is it picking up deps.json? Is that a special filename in dotnet?20:56:52
@whovian9369:matrix.orgWhovian9369

So because my computer needs replaced: I had to do an unplanned power down, my WSL filesystem seems to have corrupted, and it looks like e2fsck basically destroyed the filesystem as WSL now refuses to boot it. 🙃

I may not be able to do the build test in the near future. 😅

21:15:27
@corngood:corngood.comCorngoodOh brutal :(21:41:23
@whovian9369:matrix.orgWhovian9369I'll see what I can easily recover from it and see how quickly I can spin back up21:41:43
@corngood:corngood.comCorngood src = ../..; seems strange to me. Why don't you set it to the root of each project? 21:44:20
@oatmealraisin:matrix.orgoatmealraisinBecause then I get issues during build saying the referenced projects don't exist22:12:39
@oatmealraisin:matrix.orgoatmealraisinIdk if I can replicate at this point, a lot has changed22:12:52
@corngood:corngood.comCorngoodWell in that case the projectFile would just be `API.csproj`, or you could probably just omit it.22:13:37
@oatmealraisin:matrix.orgoatmealraisinYes, but projectReferences would be missing, I don't have error logs but it would complain about the csproj files for project references being missing22:15:49
@oatmealraisin:matrix.orgoatmealraisinIt's very possible I was doing something else wrong, but now all the nix stuff is in a different directory22:20:04
@corngood:corngood.comCorngood

Yeah, you can't do it with ProjectReference. You need to use PackageReference. There are basically two ways to do what you're trying to do, and you're sort of in-between them:

  1. one nix derivation with an assortment of projects linked together with ProjectReference, one deps.json

  2. one nix derivation per nuget package with packNupkg = true, using PackageReference

22:24:38

Show newer messages


Back to Room ListRoom Version: 9