Deploy .net app on NixOS from MacOS using Docker

I didn’t find a way to do what I wanted with NixOS docker image, but since all I wanted was Nix package manager, I could just install it on Ubuntu or some other distro quite easily.
I followed How to use nix only in docker for a project? - #16 by rkochar and for my .NET app it looked something like this:

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG TARGETARCH
WORKDIR /src
COPY --link *.csproj .
RUN dotnet restore -a $TARGETARCH
COPY --link . .
RUN dotnet publish -a $TARGETARCH --no-restore -c Release -o /app/publish

FROM mcr.microsoft.com/dotnet/aspnet:9.0

RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
    xz-utils \
    sudo \
    passwd 

RUN useradd -m -s /bin/sh myuser

USER myuser

ENV USER=myuser
ENV PATH="/home/myuser/.nix-profile/bin:${PATH}"
RUN curl -sL https://nixos.org/nix/install | sh -s -- --no-daemon

RUN nix-channel --add https://nixos.org/channels/nixpkgs-unstable && \
    nix-channel --update && \
    nix-env -iA nixpkgs.gcc14 \
.....