diff options
author | Dmitry Kalinkin <dmitry.kalinkin@gmail.com> | 2021-12-18 10:18:14 -0500 |
---|---|---|
committer | Dmitry Kalinkin <dmitry.kalinkin@gmail.com> | 2021-12-18 10:18:14 -0500 |
commit | da8f155b2a5d481770172e25bfdc6e9fc2da8c1b (patch) | |
tree | 23aaf94336fd9c120f904374afbe19547b08cf03 /doc/languages-frameworks | |
parent | f7775a4c2c9cd5b24890194a4644ae06a4d4fd1c (diff) | |
parent | da4ef05326bce443effc500b33a97a2f370a54ff (diff) |
Merge branch 'master' into staging-next
Conflicts: pkgs/development/python-modules/sphinxext-opengraph/default.nix
Diffstat (limited to 'doc/languages-frameworks')
-rw-r--r-- | doc/languages-frameworks/dotnet.section.md | 7 | ||||
-rw-r--r-- | doc/languages-frameworks/rust.section.md | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/doc/languages-frameworks/dotnet.section.md b/doc/languages-frameworks/dotnet.section.md index 94d97a970dbb1..159347008e80c 100644 --- a/doc/languages-frameworks/dotnet.section.md +++ b/doc/languages-frameworks/dotnet.section.md @@ -72,7 +72,7 @@ The `dotnetCorePackages.sdk` contains both a runtime and the full sdk of a given To package Dotnet applications, you can use `buildDotnetModule`. This has similar arguments to `stdenv.mkDerivation`, with the following additions: * `projectFile` has to be used for specifying the dotnet project file relative to the source root. These usually have `.sln` or `.csproj` file extensions. This can be an array of multiple projects as well. -* `nugetDeps` has to be used to specify the NuGet dependency file. Unfortunately, these cannot be deterministically fetched without a lockfile. This file should be generated using `nuget-to-nix` tool, which is available in nixpkgs. +* `nugetDeps` has to be used to specify the NuGet dependency file. Unfortunately, these cannot be deterministically fetched without a lockfile. A script to fetch these is available as `passthru.fetch-deps`. This file can also be generated manually using `nuget-to-nix` tool, which is available in nixpkgs. * `packNupkg` is used to pack project as a `nupkg`, and installs it to `$out/share`. If set to `true`, the derivation can be used as a dependency for another dotnet project by adding it to `projectReferences`. * `projectReferences` can be used to resolve `ProjectReference` project items. Referenced projects can be packed with `buildDotnetModule` by setting the `packNupkg = true` attribute and passing a list of derivations to `projectReferences`. Since we are sharing referenced projects as NuGets they must be added to csproj/fsproj files as `PackageReference` as well. For example, your project has a local dependency: @@ -99,6 +99,8 @@ To package Dotnet applications, you can use `buildDotnetModule`. This has simila * `dotnetPackFlags` can be used to pass flags to `dotnet pack`. Used only if `packNupkg` is set to `true`. * `dotnetFlags` can be used to pass flags to all of the above phases. +When packaging a new application, you need to fetch it's dependencies. You can set `nugetDeps` to an empty string to make the derivation temporarily evaluate, and then run `nix-build -A package.passthru.fetch-deps` to generate it's dependency fetching script. After running the script, you should have the location of the generated lockfile printed to the console. This can be copied to a stable directory. Note that if either `projectFile` or `nugetDeps` are unset, this script cannot be generated! + Here is an example `default.nix`, using some of the previously discussed arguments: ```nix { lib, buildDotnetModule, dotnetCorePackages, ffmpeg }: @@ -112,7 +114,8 @@ in buildDotnetModule rec { src = ./.; projectFile = "src/project.sln"; - nugetDeps = ./deps.nix; # File generated with `nuget-to-nix path/to/src > deps.nix`. + nugetDeps = ./deps.nix; # File generated with `nix-build -A package.passthru.fetch-deps`. + projectReferences = [ referencedProject ]; # `referencedProject` must contain `nupkg` in the folder structure. dotnet-sdk = dotnetCorePackages.sdk_3_1; diff --git a/doc/languages-frameworks/rust.section.md b/doc/languages-frameworks/rust.section.md index 7959685af6d50..56faf636df10e 100644 --- a/doc/languages-frameworks/rust.section.md +++ b/doc/languages-frameworks/rust.section.md @@ -293,7 +293,7 @@ Test flags, e.g., `--package foo`, can be passed to `cargo test` via the Another attribute, called `checkFlags`, is used to pass arguments to the test binary itself, as stated -(here)[https://doc.rust-lang.org/cargo/commands/cargo-test.html]. +[here](https://doc.rust-lang.org/cargo/commands/cargo-test.html). #### Tests relying on the structure of the `target/` directory {#tests-relying-on-the-structure-of-the-target-directory} |