···7676 inherit pkgs fmt;
7777 requestReviews = pkgs.callPackage ./request-reviews { };
7878 codeownersValidator = pkgs.callPackage ./codeowners-validator { };
7979- eval = pkgs.callPackage ./eval { };
7979+8080+ # FIXME(lf-): it might be useful to test other Nix implementations
8181+ # (nixVersions.stable and Lix) here somehow at some point to ensure we don't
8282+ # have eval divergence.
8383+ eval = pkgs.callPackage ./eval {
8484+ nix = pkgs.nixVersions.latest;
8585+ };
80868187 # CI jobs
8288 lib-tests = import ../lib/tests/release.nix { inherit pkgs; };
+11-5
ci/eval/default.nix
···11+# Evaluates all the accessible paths in nixpkgs.
22+# *This only builds on Linux* since it requires the Linux sandbox isolation to
33+# be able to write in various places while evaluating inside the sandbox.
44+#
55+# This file is used by nixpkgs CI (see .github/workflows/eval.yml) as well as
66+# being used directly as an entry point in Lix's CI (in `flake.nix` in the Lix
77+# repo).
88+#
99+# If you know you are doing a breaking API change, please ping the nixpkgs CI
1010+# maintainers and the Lix maintainers (`nix eval -f . lib.teams.lix`).
111{
212 callPackage,
313 lib,
414 runCommand,
515 writeShellScript,
66- writeText,
716 symlinkJoin,
817 time,
918 procps,
1010- nixVersions,
1919+ nix,
1120 jq,
1212- python3,
1321}:
14221523let
···3038 ]
3139 );
3240 };
3333-3434- nix = nixVersions.latest;
35413642 supportedSystems = builtins.fromJSON (builtins.readFile ../supportedSystems.json);
3743
···3344# Tested in lib/tests/sources.sh
55let
66- inherit (builtins)
66+ inherit (lib.strings)
77 match
88 split
99 storeDir
···403403 };
404404 };
405405406406+ # urlToName : (URL | Path | String) -> String
407407+ #
408408+ # Transform a URL (or path, or string) into a clean package name.
409409+ urlToName =
410410+ url:
411411+ let
412412+ inherit (lib.strings) stringLength;
413413+ base = baseNameOf (lib.removeSuffix "/" (lib.last (lib.splitString ":" (toString url))));
414414+ # chop away one git or archive-related extension
415415+ removeExt =
416416+ name:
417417+ let
418418+ matchExt = match "(.*)\\.(git|tar|zip|gz|tgz|bz|tbz|bz2|tbz2|lzma|txz|xz|zstd)$" name;
419419+ in
420420+ if matchExt != null then lib.head matchExt else name;
421421+ # apply function f to string x while the result shrinks
422422+ shrink =
423423+ f: x:
424424+ let
425425+ v = f x;
426426+ in
427427+ if stringLength v < stringLength x then shrink f v else x;
428428+ in
429429+ shrink removeExt base;
430430+431431+ # shortRev : (String | Integer) -> String
432432+ #
433433+ # Given a package revision (like "refs/tags/v12.0"), produce a short revision ("12.0").
434434+ shortRev =
435435+ rev:
436436+ let
437437+ baseRev = baseNameOf (toString rev);
438438+ matchHash = match "[a-f0-9]+" baseRev;
439439+ matchVer = match "([A-Za-z]+[-_. ]?)*(v)?([0-9.]+.*)" baseRev;
440440+ in
441441+ if matchHash != null then
442442+ builtins.substring 0 7 baseRev
443443+ else if matchVer != null then
444444+ lib.last matchVer
445445+ else
446446+ baseRev;
447447+448448+ # revOrTag : String -> String -> String
449449+ #
450450+ # Turn git `rev` and `tag` pair into a revision usable in `repoRevToName*`.
451451+ revOrTag =
452452+ rev: tag:
453453+ if tag != null then
454454+ tag
455455+ else if rev != null then
456456+ rev
457457+ else
458458+ "HEAD";
459459+460460+ # repoRevToNameFull : (URL | Path | String) -> (String | Integer | null) -> (String | null) -> String
461461+ #
462462+ # See `repoRevToName` below.
463463+ repoRevToNameFull =
464464+ repo_: rev_: suffix_:
465465+ let
466466+ repo = urlToName repo_;
467467+ rev = if rev_ != null then "-${shortRev rev_}" else "";
468468+ suffix = if suffix_ != null then "-${suffix_}" else "";
469469+ in
470470+ "${repo}${rev}${suffix}-source";
471471+472472+ # repoRevToName : String -> (URL | Path | String) -> (String | Integer | null) -> String -> String
473473+ #
474474+ # Produce derivation.name attribute for a given repository URL/path/name and (optionally) its revision/version tag.
475475+ #
476476+ # This is used by fetch(zip|git|FromGitHub|hg|svn|etc) to generate discoverable
477477+ # /nix/store paths.
478478+ #
479479+ # This uses a different implementation depending on the `pretty` argument:
480480+ # "source" -> name everything as "source"
481481+ # "versioned" -> name everything as "${repo}-${rev}-source"
482482+ # "full" -> name everything as "${repo}-${rev}-${fetcher}-source"
483483+ repoRevToName =
484484+ kind:
485485+ # match on `kind` first to minimize the thunk
486486+ if kind == "source" then
487487+ (
488488+ repo: rev: suffix:
489489+ "source"
490490+ )
491491+ else if kind == "versioned" then
492492+ (
493493+ repo: rev: suffix:
494494+ repoRevToNameFull repo rev null
495495+ )
496496+ else if kind == "full" then
497497+ repoRevToNameFull
498498+ else
499499+ throw "repoRevToName: invalid kind";
500500+406501in
407502{
408503···430525 cleanSourceFilter
431526 pathHasContext
432527 canCleanSource
528528+529529+ urlToName
530530+ shortRev
531531+ revOrTag
532532+ repoRevToName
433533434534 sourceByRegex
435535 sourceFilesBySuffices
+2-1
lib/tests/test-with-nix.nix
···3344 IMPORTANT:
55 This is used by the github.com/NixOS/nix CI.
66+ This is used by Lix's CI (see flake.nix in the Lix repo).
6778 Try not to change the interface of this file, or if you need to, ping the
88- Nix maintainers for help. Thank you!
99+ Nix AND Lix maintainers (`nix eval -f . lib.teams.lix`) for help. Thank you!
910*/
1011{
1112 pkgs,
···14481448 openssl_3_0 = openssl_3; # Added 2022-06-27
14491449 opensycl = lib.warnOnInstantiate "'opensycl' has been renamed to 'adaptivecpp'" adaptivecpp; # Added 2024-12-04
14501450 opensyclWithRocm = lib.warnOnInstantiate "'opensyclWithRocm' has been renamed to 'adaptivecppWithRocm'" adaptivecppWithRocm; # Added 2024-12-04
14511451+ opentofu-ls = lib.warnOnInstantiate "'opentofu-ls' has been renamed to 'tofu-ls'" tofu-ls; # Added 2025-06-10
14511452 openvdb_11 = throw "'openvdb_11' has been removed in favor of the latest version'"; # Added 2025-05-03
14521453 opera = throw "'opera' has been removed due to lack of maintenance in nixpkgs"; # Added 2025-05-19
14531454 orchis = throw "'orchis' has been renamed to/replaced by 'orchis-theme'"; # Converted to throw 2024-10-17
···5959 default = false;
6060 };
61616262+ fetchedSourceNameDefault = mkOption {
6363+ type = types.uniq (
6464+ types.enum [
6565+ "source"
6666+ "versioned"
6767+ "full"
6868+ ]
6969+ );
7070+ default = "source";
7171+ description = ''
7272+ This controls the default derivation `name` attribute set by the
7373+ `fetch*` (`fetchzip`, `fetchFromGitHub`, etc) functions.
7474+7575+ Possible values and the resulting `.name`:
7676+7777+ - `"source"` -> `"source"`
7878+ - `"versioned"` -> `"''${repo}-''${rev}-source"`
7979+ - `"full"` -> `"''${repo}-''${rev}-''${fetcherName}-source"`
8080+8181+ The default `"source"` is the best choice for minimal rebuilds, it
8282+ will ignore any non-hash changes (like branches being renamed, source
8383+ URLs changing, etc) at the cost of `/nix/store` being easily
8484+ cache-poisoned (see [NixOS/nix#969](https://github.com/NixOS/nix/issues/969)).
8585+8686+ Setting this to `"versioned"` greatly helps with discoverability of
8787+ sources in `/nix/store` and makes cache-poisoning of `/nix/store` much
8888+ harder, at the cost of a single mass-rebuild for all `src`
8989+ derivations, and an occasional rebuild when a source changes some of
9090+ its non-hash attributes.
9191+9292+ Setting this to `"full"` is similar to setting it to `"versioned"`,
9393+ but the use of `fetcherName` in the derivation name will force a
9494+ rebuild when `src` switches between `fetch*` functions, thus forcing
9595+ `nix` to check new derivation's `outputHash`, which is useful for
9696+ debugging.
9797+9898+ Also, `"full"` is useful for easy collection and tracking of
9999+ statistics of where the packages you use are hosted.
100100+101101+ If you are a developer, you should probably set this to at
102102+ least`"versioned"`.
103103+104104+ Changing the default will cause a mass rebuild.
105105+ '';
106106+ };
107107+62108 doCheckByDefault = mkMassRebuild {
63109 feature = "run `checkPhase` by default";
64110 };
···150196 };
151197152198 cudaSupport = mkMassRebuild {
153153- type = types.bool;
154154- default = false;
155199 feature = "build packages with CUDA support by default";
156200 };
157201···184228 };
185229186230 rocmSupport = mkMassRebuild {
187187- type = types.bool;
188188- default = false;
189231 feature = "build packages with ROCm support by default";
190232 };
191233