Unverified Commit eb517115 authored by github-actions[bot]'s avatar github-actions[bot] Committed by GitHub
Browse files

Merge release-24.11 into staging-next-24.11

parents 7c57e4c3 09512b97
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -754,10 +754,6 @@ This creates a derivation with a directory structure like the following:
...
```

## `writeReferencesToFile` {#trivial-builder-writeReferencesToFile}

Deprecated. Use [`writeClosure`](#trivial-builder-writeClosure) instead.

## `writeClosure` {#trivial-builder-writeClosure}

Given a list of [store paths](https://nixos.org/manual/nix/stable/glossary#gloss-store-path) (or string-like expressions coercible to store paths), write their collective [closure](https://nixos.org/manual/nix/stable/glossary#gloss-closure) to a text file.
+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ let
      scrubOptionValue literalExpression literalExample
      showOption showOptionWithDefLocs showFiles
      unknownModule mkOption mkPackageOption mkPackageOptionMD
      mdDoc literalMD;
      literalMD;
    inherit (self.types) isType setType defaultTypeMerge defaultFunctor
      isOptionType mkOptionType;
    inherit (self.asserts)
+0 −7
Original line number Diff line number Diff line
@@ -399,13 +399,6 @@ rec {

  literalExample = lib.warn "lib.literalExample is deprecated, use lib.literalExpression instead, or use lib.literalMD for a non-Nix description." literalExpression;

  /* Transition marker for documentation that's already migrated to markdown
     syntax. Has been a no-op for some while and been removed from nixpkgs.
     Kept here to alert downstream users who may not be aware of the migration's
     completion that it should be removed from modules.
  */
  mdDoc = lib.warn "lib.mdDoc will be removed from nixpkgs in 24.11. Option descriptions are now in Markdown by default; you can remove any remaining uses of lib.mdDoc.";

  /* For use in the `defaultText` and `example` option attributes. Causes the
     given MD text to be inserted verbatim in the documentation, for when
     a `literalExpression` would be too hard to read.
+9 −66
Original line number Diff line number Diff line
@@ -9,68 +9,11 @@
  infrastructure. Regular updates should be done through the individual packages
  update scripts.
*/
{ startWith ? null }:
let
  pkgs = import ../.. { config.allowAliases = false; };

  inherit (pkgs) lib;

  packagesWith = cond: pkgs:
    let
      packagesWithInner = attrs:
        lib.concatLists (
          lib.mapAttrsToList (name: elem:
            let
              result = builtins.tryEval elem;
            in
              if result.success then
                let
                  value = result.value;
                in
                  if lib.isDerivation value then
                    lib.optional (cond value) value
                  else
                    if lib.isAttrs value && (value.recurseForDerivations or false || value.recurseForRelease or false) then
                      packagesWithInner value
                    else []
              else []) attrs);
    in
      packagesWithInner pkgs;

  packages = lib.unique
    (lib.filter (p:
      (builtins.tryEval p.outPath).success ||
      builtins.trace "warning: skipping ${p.name} because it failed to evaluate" false)
    ((pkgs: (lib.drop (lib.lists.findFirstIndex (p: p.name == startWith) 0 pkgs) pkgs))
    (packagesWith (p: p ? fetch-deps) pkgs)));

  helpText = ''
    Please run:

        % nix-shell maintainers/scripts/update-dotnet-lockfiles.nix
  '';

  fetchScripts = map (p: p.fetch-deps) packages;

in pkgs.stdenv.mkDerivation {
  name = "nixpkgs-update-dotnet-lockfiles";
  buildCommand = ''
    echo ""
    echo "----------------------------------------------------------------"
    echo ""
    echo "Not possible to update packages using \`nix-build\`"
    echo ""
    echo "${helpText}"
    echo "----------------------------------------------------------------"
    exit 1
  '';
  shellHook = ''
    unset shellHook # do not contaminate nested shells
    set -e
    for x in $fetchScripts; do
      $x
    done
    exit
  '';
  inherit fetchScripts;
{ ... }@args:
import ./update.nix (
  {
    predicate = _: _: true;
    get-script = pkg: pkg.fetch-deps or null;
  }
  // args
)
+12 −10
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
{ package ? null
, maintainer ? null
, predicate ? null
, get-script ? pkg: pkg.updateScript or null
, path ? null
, max-workers ? null
, include-overlays ? false
@@ -17,13 +18,13 @@
}:

let
  pkgs = import ./../../default.nix (
  pkgs = import ./../../default.nix ((
    if include-overlays == false then
      { overlays = []; }
    else if include-overlays == true then
      { } # Let Nixpkgs include overlays impurely.
    else { overlays = include-overlays; }
  );
  ) // { config.allowAliases = false; });

  inherit (pkgs) lib;

@@ -56,7 +57,7 @@ let

          somewhatUniqueRepresentant =
            { package, attrPath }: {
              inherit (package) updateScript;
              updateScript = (get-script package);
              # Some updaters use the same `updateScript` value for all packages.
              # Also compare `meta.description`.
              position = package.meta.position or null;
@@ -89,7 +90,7 @@ let
  /* Recursively find all packages in `pkgs` with updateScript matching given predicate.
   */
  packagesWithUpdateScriptMatchingPredicate = cond:
    packagesWith (path: pkg: builtins.hasAttr "updateScript" pkg && cond path pkg);
    packagesWith (path: pkg: (get-script pkg != null) && cond path pkg);

  /* Recursively find all packages in `pkgs` with updateScript by given maintainer.
   */
@@ -121,7 +122,7 @@ let
      if pathContent == null then
        builtins.throw "Attribute path `${path}` does not exist."
      else
        packagesWithPath prefix (path: pkg: builtins.hasAttr "updateScript" pkg)
        packagesWithPath prefix (path: pkg: (get-script pkg != null))
                       pathContent;

  /* Find a package under `path` in `pkgs` and require that it has an updateScript.
@@ -132,7 +133,7 @@ let
    in
      if package == null then
        builtins.throw "Package with an attribute name `${path}` does not exist."
      else if ! builtins.hasAttr "updateScript" package then
      else if get-script package == null then
        builtins.throw "Package with an attribute name `${path}` does not have a `passthru.updateScript` attribute defined."
      else
        { attrPath = path; inherit package; };
@@ -193,13 +194,13 @@ let

  /* Transform a matched package into an object for update.py.
   */
  packageData = { package, attrPath }: {
  packageData = { package, attrPath }: let updateScript = get-script package; in {
    name = package.name;
    pname = lib.getName package;
    oldVersion = lib.getVersion package;
    updateScript = map builtins.toString (lib.toList (package.updateScript.command or package.updateScript));
    supportedFeatures = package.updateScript.supportedFeatures or [];
    attrPath = package.updateScript.attrPath or attrPath;
    updateScript = map builtins.toString (lib.toList (updateScript.command or updateScript));
    supportedFeatures = updateScript.supportedFeatures or [];
    attrPath = updateScript.attrPath or attrPath;
  };

  /* JSON file with data for update.py.
@@ -230,4 +231,5 @@ in pkgs.stdenv.mkDerivation {
    unset shellHook # do not contaminate nested shells
    exec ${pkgs.python3.interpreter} ${./update.py} ${builtins.concatStringsSep " " args}
  '';
  nativeBuildInputs = [ pkgs.git pkgs.nix pkgs.cacert ];
}
Loading