···73737474* `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.7575* `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.7676+* `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`.7777+* `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.7878+ For example, your project has a local dependency:7979+ ```xml8080+ <ProjectReference Include="../foo/bar.fsproj" />8181+ ```8282+ To enable discovery through `projectReferences` you would need to add:8383+ ```xml8484+ <ProjectReference Include="../foo/bar.fsproj" />8585+ <PackageReference Include="bar" Version="*" Condition=" '$(ContinuousIntegrationBuild)'=='true' "/>8686+ ```7687* `executables` is used to specify which executables get wrapped to `$out/bin`, relative to `$out/lib/$pname`. If this is unset, all executables generated will get installed. If you do not want to install any, set this to `[]`.7788* `runtimeDeps` is used to wrap libraries into `LD_LIBRARY_PATH`. This is how dotnet usually handles runtime dependencies.7889* `buildType` is used to change the type of build. Possible values are `Release`, `Debug`, etc. By default, this is set to `Release`.···9483* `disabledTests` is used to disable running specific unit tests. This gets passed as: `dotnet test --filter "FullyQualifiedName!={}"`, to ensure compatibility with all unit test frameworks.9584* `dotnetRestoreFlags` can be used to pass flags to `dotnet restore`.9685* `dotnetBuildFlags` can be used to pass flags to `dotnet build`.9797-* `dotnetTestFlags` can be used to pass flags to `dotnet test`.8686+* `dotnetTestFlags` can be used to pass flags to `dotnet test`. Used only if `doCheck` is set to `true`.9887* `dotnetInstallFlags` can be used to pass flags to `dotnet install`.8888+* `dotnetPackFlags` can be used to pass flags to `dotnet pack`. Used only if `packNupkg` is set to `true`.9989* `dotnetFlags` can be used to pass flags to all of the above phases.1009010191Here is an example `default.nix`, using some of the previously discussed arguments:10292```nix10393{ lib, buildDotnetModule, dotnetCorePackages, ffmpeg }:10494105105-buildDotnetModule rec {9595+let9696+ referencedProject = import ../../bar { ... };9797+in buildDotnetModule rec {10698 pname = "someDotnetApplication";10799 version = "0.1";108100···11399114100 projectFile = "src/project.sln";115101 nugetDeps = ./deps.nix; # File generated with `nuget-to-nix path/to/src > deps.nix`.102102+ projectReferences = [ referencedProject ]; # `referencedProject` must contain `nupkg` in the folder structure.116103117104 dotnet-sdk = dotnetCorePackages.sdk_3_1;118105 dotnet-runtime = dotnetCorePackages.net_5_0;···121106122107 executables = [ "foo" ]; # This wraps "$out/lib/$pname/foo" to `$out/bin/foo`.123108 executables = []; # Don't install any executables.109109+110110+ packNupkg = true; # This packs the project as "foo-0.1.nupkg" at `$out/share`.124111125112 runtimeDeps = [ ffmpeg ]; # This will wrap ffmpeg's library path into `LD_LIBRARY_PATH`.126113}
+2-1
nixos/lib/make-options-doc/default.nix
···118118 # The actual generation of the xml file is done in nix purely for the convenience119119 # of not having to generate the xml some other way120120 optionsXML = pkgs.runCommand "options.xml" {} ''121121+ export NIX_STORE_DIR=$TMPDIR/store122122+ export NIX_STATE_DIR=$TMPDIR/state121123 ${pkgs.nix}/bin/nix-instantiate \122122- --store dummy:// \123124 --eval --xml --strict ${./optionsJSONtoXML.nix} \124125 --argstr file ${optionsJSON}/share/doc/nixos/options.json \125126 > "$out"
+13-3
nixos/modules/services/databases/couchdb.nix
···43434444 package = mkOption {4545 type = types.package;4646- default = pkgs.couchdb;4747- defaultText = literalExpression "pkgs.couchdb";4646+ default = pkgs.couchdb3;4747+ defaultText = literalExpression "pkgs.couchdb3";4848 description = ''4949 CouchDB package to use.5050 '';···150150 '';151151 };152152153153+ argsFile = mkOption {154154+ type = types.path;155155+ default = "${cfg.package}/etc/vm.args";156156+ description = ''157157+ vm.args configuration. Overrides Couchdb's Erlang VM parameters file.158158+ '';159159+ };160160+153161 configFile = mkOption {154162 type = types.path;155163 description = ''···194186 '';195187196188 environment = {197197- # we are actually specifying 4 configuration files:189189+ # we are actually specifying 5 configuration files:198190 # 1. the preinstalled default.ini199191 # 2. the module configuration200192 # 3. the extraConfig from the module options201193 # 4. the locally writable config file, which couchdb itself writes to202194 ERL_FLAGS= ''-couch_ini ${cfg.package}/etc/default.ini ${configFile} ${pkgs.writeText "couchdb-extra.ini" cfg.extraConfig} ${cfg.configFile}'';195195+ # 5. the vm.args file196196+ COUCHDB_ARGS_FILE=''${cfg.argsFile}'';203197 };204198205199 serviceConfig = {
···1414, dotnetTestFlags ? []1515# Flags to pass to `dotnet install`.1616, dotnetInstallFlags ? []1717+# Flags to pass to `dotnet pack`.1818+, dotnetPackFlags ? []1719# Flags to pass to dotnet in all phases.1820, dotnetFlags ? []1921···2321# Unfortunately, dotnet has no method for doing this automatically.2422# If unset, all executables in the projects root will get installed. This may cause bloat!2523, executables ? null2424+# Packs a 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`.2525+, packNupkg ? false2626# The packages project file, which contains instructions on how to compile it. This can be an array of multiple project files as well.2727, projectFile ? null2828# The NuGet dependency file. This locks all NuGet dependency versions, as otherwise they cannot be deterministically fetched.2929# This can be generated using the `nuget-to-nix` tool.3030, nugetDeps ? null3131+# A list of derivations containing nupkg packages for local project references.3232+# Referenced derivations can be built with `buildDotnetModule` with `packNupkg=true` flag.3333+# Since we are sharing them as nugets they must be added to csproj/fsproj files as `PackageReference` as well.3434+# For example, your project has a local dependency:3535+# <ProjectReference Include="../foo/bar.fsproj" />3636+# To enable discovery through `projectReferences` you would need to add a line:3737+# <ProjectReference Include="../foo/bar.fsproj" />3838+# <PackageReference Include="bar" Version="*" Condition=" '$(ContinuousIntegrationBuild)'=='true' "/>3939+, projectReferences ? []3140# Libraries that need to be available at runtime should be passed through this.3241# These get wrapped into `LD_LIBRARY_PATH`.3342, runtimeDeps ? []···7360 inherit sha256;7461 };7562 });6363+ _localDeps = linkFarmFromDrvs "${name}-local-nuget-deps" projectReferences;76647765 nuget-source = stdenvNoCC.mkDerivation rec {7866 name = "${args.pname}-nuget-source";···86728773 nuget sources Add -Name nixos -Source "$out/lib"8874 nuget init "${_nugetDeps}" "$out/lib"7575+ ${lib.optionalString (projectReferences != [])7676+ "nuget init \"${_localDeps}\" \"$out/lib\""}89779078 # Generates a list of all unique licenses' spdx ids.9179 find "$out/lib" -name "*.nuspec" -exec sh -c \···183167 "''${dotnetInstallFlags[@]}" \184168 "''${dotnetFlags[@]}"185169 done186186- '' + (if executables != null then ''170170+ '' + (lib.optionalString packNupkg ''171171+ for project in ''${projectFile[@]}; do172172+ dotnet pack "$project" \173173+ -p:ContinuousIntegrationBuild=true \174174+ -p:Deterministic=true \175175+ --output $out/share \176176+ --configuration "$buildType" \177177+ --no-build \178178+ "''${dotnetPackFlags[@]}" \179179+ "''${dotnetFlags[@]}"180180+ done181181+ '') + (if executables != null then ''187182 for executable in $executables; do188183 execPath="$out/lib/${args.pname}/$executable"189184