···123123* `dotnetPackFlags` can be used to pass flags to `dotnet pack`. Used only if `packNupkg` is set to `true`.
124124* `dotnetFlags` can be used to pass flags to all of the above phases.
125125126126-When packaging a new application, you need to fetch its dependencies. You can run `nix-build -A package.fetch-deps` to generate a script that will build a lockfile for you. After running the script you should have the location of the generated lockfile printed to the console, which can be copied to a stable directory. Then set `nugetDeps = ./deps.nix` and you're ready to build the derivation.
126126+When packaging a new application, you need to fetch its dependencies. Create an empty `deps.nix`, set `nugetDeps = ./deps.nix`, then run `nix-build -A package.fetch-deps` to generate a script that will build the lockfile for you.
127127128128Here is an example `default.nix`, using some of the previously discussed arguments:
129129```nix
+72
maintainers/scripts/update-dotnet-lockfiles.nix
···11+/*
22+ To run:
33+44+ nix-shell maintainers/scripts/update-dotnet-lockfiles.nix
55+66+ This script finds all the derivations in nixpkgs that have a 'fetch-deps'
77+ attribute, and runs all of them sequentially. This is useful to test changes
88+ to 'fetch-deps', 'nuget-to-nix', or other changes to the dotnet build
99+ infrastructure. Regular updates should be done through the individual packages
1010+ update scripts.
1111+ */
1212+let
1313+ pkgs = import ../.. {};
1414+1515+ inherit (pkgs) lib;
1616+1717+ packagesWith = cond: pkgs:
1818+ let
1919+ packagesWithInner = attrs:
2020+ lib.unique (
2121+ lib.concatLists (
2222+ lib.mapAttrsToList (name: elem:
2323+ let
2424+ result = builtins.tryEval elem;
2525+ in
2626+ if result.success then
2727+ let
2828+ value = result.value;
2929+ in
3030+ if lib.isDerivation value then
3131+ lib.optional (cond value) value
3232+ else
3333+ if lib.isAttrs value && (value.recurseForDerivations or false || value.recurseForRelease or false) then
3434+ packagesWithInner value
3535+ else []
3636+ else []) attrs));
3737+ in
3838+ packagesWithInner pkgs;
3939+4040+ packages =
4141+ packagesWith (pkgs: pkgs ? fetch-deps) pkgs;
4242+4343+ helpText = ''
4444+ Please run:
4545+4646+ % nix-shell maintainers/scripts/update-dotnet-lockfiles.nix
4747+ '';
4848+4949+ fetchScripts = map (p: p.fetch-deps) packages;
5050+5151+in pkgs.stdenv.mkDerivation {
5252+ name = "nixpkgs-update-dotnet-lockfiles";
5353+ buildCommand = ''
5454+ echo ""
5555+ echo "----------------------------------------------------------------"
5656+ echo ""
5757+ echo "Not possible to update packages using \`nix-build\`"
5858+ echo ""
5959+ echo "${helpText}"
6060+ echo "----------------------------------------------------------------"
6161+ exit 1
6262+ '';
6363+ shellHook = ''
6464+ unset shellHook # do not contaminate nested shells
6565+ set -e
6666+ for x in $fetchScripts; do
6767+ $x
6868+ done
6969+ exit
7070+ '';
7171+ inherit fetchScripts;
7272+}
···99trap 'echo "Error at ${BASH_SOURCE[0]}:$LINENO"' ERR
10101111pkgName=$1
1212-depsFile=$2
13121413: ${getVersionFromTags:=}
1514: ${refetch:=}
···4140if [[ $newVersion == $oldVersion && ! $refetch ]]; then
4241 echo "nixpkgs already has the latest version $newVersion"
4342 echo "Run this script with env var refetch=1 to re-verify the content hash via GPG"
4444- echo "and to recreate $(basename "$depsFile"). This is useful for reviewing a version update."
4343+ echo "and to recreate deps.nix. This is useful for reviewing a version update."
4544 exit 0
4645fi
4746···7473echo
75747675# Create deps file
7777-$(nix-build "$nixpkgs" -A $pkgName.fetch-deps --no-out-link) "$depsFile"
7676+$(nix-build "$nixpkgs" -A $pkgName.fetch-deps --no-out-link)
+1-3
pkgs/applications/emulators/ryujinx/updater.sh
···33set -euo pipefail
44cd "$(dirname "${BASH_SOURCE[0]}")"
5566-DEPS_FILE="$(realpath "./deps.nix")"
77-86# provide a github token so you don't get rate limited
97# if you use gh cli you can use:
108# `export GITHUB_TOKEN="$(cat ~/.config/gh/config.yml | yq '.hosts."github.com".oauth_token' -r)"`
···75737674echo "building Nuget lockfile"
77757878-$(nix-build -A ryujinx.fetch-deps --no-out-link) "$DEPS_FILE"
7676+$(nix-build -A ryujinx.fetch-deps --no-out-link)