···829830 See [git sparse-checkout](https://git-scm.com/docs/git-sparse-checkout) for more information.
8310000832Some additional parameters for niche use-cases can be found listed in the function parameters in the declaration of `fetchgit`: `pkgs/build-support/fetchgit/default.nix`.
833Future parameters additions might also happen without immediately being documented here.
834
···829830 See [git sparse-checkout](https://git-scm.com/docs/git-sparse-checkout) for more information.
831832+*`rootDir`* (String)
833+834+: When not empty, copy only contents of the subdirectory of the repository to the result. Automatically sets `sparseCheckout` and `nonConeMode` to avoid checking out any extra pieces. Incompatible with `leaveDotGit`.
835+836Some additional parameters for niche use-cases can be found listed in the function parameters in the declaration of `fetchgit`: `pkgs/build-support/fetchgit/default.nix`.
837Future parameters additions might also happen without immediately being documented here.
838
+1
doc/release-notes/rl-2511.section.md
···106 * `$debug/lib/debug/.build-id/48/3bd7f7229bdb06462222e1e353e4f37e15c293.sourceoverlay` is a symlink to a directory with the same structure as the expanded `$sourceRoot` but containing only a copy of files which were patched during the build
107 * `$debug/lib/debug/.build-id/48/3bd7f7229bdb06462222e1e353e4f37e15c293.debug` is the file containing debug symbols (like before).
1080109110## Nixpkgs Library {#sec-nixpkgs-release-25.11-lib}
111
···106 * `$debug/lib/debug/.build-id/48/3bd7f7229bdb06462222e1e353e4f37e15c293.sourceoverlay` is a symlink to a directory with the same structure as the expanded `$sourceRoot` but containing only a copy of files which were patched during the build
107 * `$debug/lib/debug/.build-id/48/3bd7f7229bdb06462222e1e353e4f37e15c293.debug` is the file containing debug symbols (like before).
108109+- `fetchgit`: Add `rootDir` argument to limit the resulting source to one subdirectory of the whole Git repository. Corresponding `--root-dir` option added to `nix-prefetch-git`.
110111## Nixpkgs Library {#sec-nixpkgs-release-25.11-lib}
112
+4-1
nixos/modules/config/system-path.nix
···8889 corePackages = lib.mkOption {
90 type = lib.types.listOf lib.types.package;
91- default = corePackages;
92 defaultText = lib.literalMD ''
93 these packages, with their `meta.priority` numerically increased
94 (thus lowering their installation priority):
···179 };
180181 config = {
0000182183 environment.systemPackages = config.environment.corePackages ++ config.environment.defaultPackages;
184
···8889 corePackages = lib.mkOption {
90 type = lib.types.listOf lib.types.package;
091 defaultText = lib.literalMD ''
92 these packages, with their `meta.priority` numerically increased
93 (thus lowering their installation priority):
···178 };
179180 config = {
181+182+ # Set this here so that it has the right priority and allows ergonomic
183+ # merging.
184+ environment.corePackages = corePackages;
185186 environment.systemPackages = config.environment.corePackages ++ config.environment.defaultPackages;
187
···67 # we can also run non-NixOS guests during tests. This, however, is
68 # mostly futureproofing as the test instrumentation is still very
69 # tightly coupled to NixOS.
70- PS1="" exec ${pkgs.coreutils}/bin/env bash --norc /dev/hvc0
71 '';
72 serviceConfig.KillSignal = "SIGHUP";
73 };
···67 # we can also run non-NixOS guests during tests. This, however, is
68 # mostly futureproofing as the test instrumentation is still very
69 # tightly coupled to NixOS.
70+ PS1="" exec ${pkgs.bashNonInteractive}/bin/bash --norc /dev/hvc0
71 '';
72 serviceConfig.KillSignal = "SIGHUP";
73 };
···89let
10 urlToName =
11- url: rev:
000012 let
13 shortRev = lib.sources.shortRev rev;
14 appendShort = lib.optionalString ((builtins.match "[a-f0-9]*" rev) != null) "-${shortRev}";
15 in
16- "${lib.sources.urlToName url}${appendShort}";
17in
1819lib.makeOverridable (
···24 url,
25 tag ? null,
26 rev ? null,
27- name ? urlToName url (lib.revOrTag rev tag),
0000028 leaveDotGit ? deepClone || fetchTags,
29 outputHash ? lib.fakeHash,
30 outputHashAlgo ? null,
31 fetchSubmodules ? true,
32 deepClone ? false,
33 branchName ? null,
34- sparseCheckout ? [ ],
35- nonConeMode ? false,
36 nativeBuildInputs ? [ ],
37 # Shell code executed before the file has been fetched. This, in
38 # particular, can do things like set NIX_PREFETCH_GIT_CHECKOUT_HOOK to
···53 allowedRequisites ? null,
54 # fetch all tags after tree (useful for git describe)
55 fetchTags ? false,
0056 }:
5758 /*
···8081 assert nonConeMode -> (sparseCheckout != [ ]);
82 assert fetchTags -> leaveDotGit;
08384 let
85 revWithTag =
···135 preFetch
136 postFetch
137 fetchTags
0138 ;
139 rev = revWithTag;
140
···89let
10 urlToName =
11+ {
12+ url,
13+ rev,
14+ append,
15+ }:
16 let
17 shortRev = lib.sources.shortRev rev;
18 appendShort = lib.optionalString ((builtins.match "[a-f0-9]*" rev) != null) "-${shortRev}";
19 in
20+ "${lib.sources.urlToName url}${if append == "" then appendShort else append}";
21in
2223lib.makeOverridable (
···28 url,
29 tag ? null,
30 rev ? null,
31+ name ? urlToName {
32+ inherit url;
33+ rev = lib.revOrTag rev tag;
34+ # when rootDir is specified, avoid invalidating the result when rev changes
35+ append = if rootDir != "" then "-${lib.strings.sanitizeDerivationName rootDir}" else "";
36+ },
37 leaveDotGit ? deepClone || fetchTags,
38 outputHash ? lib.fakeHash,
39 outputHashAlgo ? null,
40 fetchSubmodules ? true,
41 deepClone ? false,
42 branchName ? null,
43+ sparseCheckout ? lib.optional (rootDir != "") rootDir,
44+ nonConeMode ? rootDir != "",
45 nativeBuildInputs ? [ ],
46 # Shell code executed before the file has been fetched. This, in
47 # particular, can do things like set NIX_PREFETCH_GIT_CHECKOUT_HOOK to
···62 allowedRequisites ? null,
63 # fetch all tags after tree (useful for git describe)
64 fetchTags ? false,
65+ # make this subdirectory the root of the result
66+ rootDir ? "",
67 }:
6869 /*
···9192 assert nonConeMode -> (sparseCheckout != [ ]);
93 assert fetchTags -> leaveDotGit;
94+ assert rootDir != "" -> !leaveDotGit;
9596 let
97 revWithTag =
···147 preFetch
148 postFetch
149 fetchTags
150+ rootDir
151 ;
152 rev = revWithTag;
153
+45-17
pkgs/build-support/fetchgit/nix-prefetch-git
···59 --fetch-submodules Fetch submodules.
60 --fetch-tags Fetch all tags (useful for git describe).
61 --builder Clone as fetchgit does, but url, rev, and out option are mandatory.
062 --quiet Only print the final json summary.
63"
64 exit 1
···90 --fetch-submodules) fetchSubmodules=true;;
91 --fetch-tags) fetchTags=true;;
92 --builder) builder=true;;
093 -h|--help) usage; exit;;
94 *)
95 : $((++argi))
···155 local base
156 base=$(basename "$url" .git | cut -d: -f2)
157158- if [[ $ref =~ ^[a-z0-9]+$ ]]; then
159- echo "$base-${ref:0:7}"
00160 else
161- echo "$base"
0000162 fi
163}
164···351 make_deterministic_repo "$(readlink -f "$(dirname "$gitdir")")"
352 done
353 fi
00000000000000000354}
355356exit_handlers=()
···418 "fetchSubmodules": $([[ -n "$fetchSubmodules" ]] && echo true || echo false),
419 "deepClone": $([[ -n "$deepClone" ]] && echo true || echo false),
420 "fetchTags": $([[ -n "$fetchTags" ]] && echo true || echo false),
421- "leaveDotGit": $([[ -n "$leaveDotGit" ]] && echo true || echo false)
0422}
423EOF
424 fi
···456457if test -n "$builder"; then
458 test -n "$out" -a -n "$url" -a -n "$rev" || usage
459- mkdir -p "$out"
460- clone_user_rev "$out" "$url" "$rev"
00000461else
462 if test -z "$hashType"; then
463 hashType=sha256
···476 # If we don't know the hash or a path with that hash doesn't exist,
477 # download the file and add it to the store.
478 if test -z "$finalPath"; then
479- # nix>=2.20 rejects adding symlinked paths to the store, so use realpath
480- # to resolve to a physical path. https://github.com/NixOS/nix/issues/11941
481- tmpPath="$(realpath "$(mktemp -d --tmpdir git-checkout-tmp-XXXXXXXX)")"
482- exit_handlers+=(remove_tmpPath)
483484- tmpFile="$tmpPath/$storePathName"
485- mkdir -p "$tmpFile"
486-487- # Perform the checkout.
488- clone_user_rev "$tmpFile" "$url" "$rev"
489490 # Compute the hash.
491- hash=$(nix-hash --type $hashType --base32 "$tmpFile")
492493 # Add the downloaded file to the Nix store.
494- finalPath=$(nix-store --add-fixed --recursive "$hashType" "$tmpFile")
495496 if test -n "$expHash" -a "$expHash" != "$hash"; then
497 echo "hash mismatch for URL \`$url'. Got \`$hash'; expected \`$expHash'." >&2
···59 --fetch-submodules Fetch submodules.
60 --fetch-tags Fetch all tags (useful for git describe).
61 --builder Clone as fetchgit does, but url, rev, and out option are mandatory.
62+ --root-dir dir Directory in the repository that will be copied to the output instead of the full repository.
63 --quiet Only print the final json summary.
64"
65 exit 1
···91 --fetch-submodules) fetchSubmodules=true;;
92 --fetch-tags) fetchTags=true;;
93 --builder) builder=true;;
94+ --root-dir) argfun=set_rootDir;;
95 -h|--help) usage; exit;;
96 *)
97 : $((++argi))
···157 local base
158 base=$(basename "$url" .git | cut -d: -f2)
159160+ if test -n "$rootDir"; then
161+ # Sanitize by removing leading dots and replacing all invalid character sequences with dashes.
162+ # See sanitizeDerivationName in ../../../lib/strings.nix for reference.
163+ echo "$base-$(sed -E 's/^\.+//;s/[^[:alnum:]+._?=-]+/-/g' <<< $rootDir)"
164 else
165+ if [[ $ref =~ ^[a-z0-9]+$ ]]; then
166+ echo "$base-${ref:0:7}"
167+ else
168+ echo "$base"
169+ fi
170 fi
171}
172···359 make_deterministic_repo "$(readlink -f "$(dirname "$gitdir")")"
360 done
361 fi
362+}
363+364+clone_user_rev_to_tmpfile(){
365+ local url="$1"
366+ local rev="${2:-HEAD}"
367+368+ # nix>=2.20 rejects adding symlinked paths to the store, so use realpath
369+ # to resolve to a physical path. https://github.com/NixOS/nix/issues/11941
370+ tmpPath="$(realpath "$(mktemp -d --tmpdir git-checkout-tmp-XXXXXXXX)")"
371+ exit_handlers+=(remove_tmpPath)
372+373+ tmpOut="$tmpPath/out/$storePathName"
374+ tmpClone="$tmpPath/clone"
375+ mkdir -p "$tmpPath/out" "$tmpClone"
376+377+ # Perform the checkout.
378+ clone_user_rev "$tmpClone" "$url" "$rev"
379}
380381exit_handlers=()
···443 "fetchSubmodules": $([[ -n "$fetchSubmodules" ]] && echo true || echo false),
444 "deepClone": $([[ -n "$deepClone" ]] && echo true || echo false),
445 "fetchTags": $([[ -n "$fetchTags" ]] && echo true || echo false),
446+ "leaveDotGit": $([[ -n "$leaveDotGit" ]] && echo true || echo false),
447+ "rootDir": "$(json_escape "$rootDir")"
448}
449EOF
450 fi
···482483if test -n "$builder"; then
484 test -n "$out" -a -n "$url" -a -n "$rev" || usage
485+ if test -n "$rootDir"; then
486+ clone_user_rev_to_tmpfile "$url" "$rev"
487+ mv "$tmpClone/$rootDir" "$out"
488+ else
489+ mkdir -p "$out"
490+ clone_user_rev "$out" "$url" "$rev"
491+ fi
492else
493 if test -z "$hashType"; then
494 hashType=sha256
···507 # If we don't know the hash or a path with that hash doesn't exist,
508 # download the file and add it to the store.
509 if test -z "$finalPath"; then
510+ clone_user_rev_to_tmpfile "$url" "$rev"
000511512+ if test -z "$rootDir"; then
513+ mv "$tmpClone" "$tmpOut"
514+ else
515+ mv "$tmpClone/$rootDir" "$tmpOut"
516+ fi
517518 # Compute the hash.
519+ hash=$(nix-hash --type $hashType --base32 "$tmpOut")
520521 # Add the downloaded file to the Nix store.
522+ finalPath=$(nix-store --add-fixed --recursive "$hashType" "$tmpOut")
523524 if test -n "$expHash" -a "$expHash" != "$hash"; then
525 echo "hash mismatch for URL \`$url'. Got \`$hash'; expected \`$expHash'." >&2
···122 checkPath="$(dirname "$checkPath")"
123done
12400000000125# Verify that user is not trying to use attribute building and flake
126# at the same time
127if [[ -z $buildingAttribute && -n $flake ]]; then
···122 checkPath="$(dirname "$checkPath")"
123done
124125+# Check if the mount point root directory is owned by root
126+if [[ "$(stat -c '%u:%g' "$mountPoint")" != "0:0" ]]; then
127+ echo "$0: $mountPoint is not owned by root:root (owned by $(stat -c '%U:%G' "$mountPoint"))"
128+ echo "$0: installation root directory must be owned by root to avoid system issues"
129+ echo "$0: run 'sudo chown root:root $mountPoint' to fix this"
130+ exit 1
131+fi
132+133# Verify that user is not trying to use attribute building and flake
134# at the same time
135if [[ -z $buildingAttribute && -n $flake ]]; then
···15 };
1617 meta = {
18- description = "Switch the preview pane between hidden and shown";
19 license = lib.licenses.mit;
20 maintainers = with lib.maintainers; [ khaneliman ];
21 };
···15 };
1617 meta = {
18+ description = "Vim-like f<char>, jump to the next file whose name starts with <char>.";
19 license = lib.licenses.mit;
20 maintainers = with lib.maintainers; [ khaneliman ];
21 };
···23grafanaPlugin {
4 pname = "volkovlabs-variable-panel";
5- version = "4.0.0";
6- zipHash = "sha256-fHOo/Au8yPQXIkG/BupNcMpFNgDLRrqpwRpmbq6xYhM=";
7 meta = with lib; {
8 description = "Variable panel allows you to have dashboard filters in a separate panel which you can place anywhere on the dashboard";
9 license = licenses.asl20;
···23grafanaPlugin {
4 pname = "volkovlabs-variable-panel";
5+ version = "4.1.0";
6+ zipHash = "sha256-3AkCebT9KcQdsi+T3+0XMhwZaEmqlOmY90RidcVqUb4=";
7 meta = with lib; {
8 description = "Variable panel allows you to have dashboard filters in a separate panel which you can place anywhere on the dashboard";
9 license = licenses.asl20;
···230 dogpile_cache = dogpile-cache; # added 2021-10-28
231 dogpile-core = throw "dogpile-core is no longer maintained, use dogpile-cache instead"; # added 2021-11-20
232 dugong = throw "dugong is unmaintained since 2022 and has therefore been removed"; # added 2024-12-12
0233 eebrightbox = throw "eebrightbox is unmaintained upstream and has therefore been removed"; # added 2022-02-03
234 EasyProcess = easyprocess; # added 2023-02-19
235 email_validator = email-validator; # added 2022-06-22
···349 ipdbplugin = throw "ipdbplugin has been removed because it has no longer maintained for 6 years"; # added 2024-05-21
350 ipython_genutils = ipython-genutils; # added 2023-10-12
351 influxgraph = throw "influxgraph has been removed because it is no longer maintained"; # added 2022-07-10
0352 itanium_demangler = itanium-demangler; # added 2022-10-17
353 jaeger-client = throw "jaeger-client was removed because it is deprecated upstream. OpenTelemetry is recommended instead."; # Added 2024-12-09
354 jaraco_classes = jaraco-classes; # added 2023-07-14
···230 dogpile_cache = dogpile-cache; # added 2021-10-28
231 dogpile-core = throw "dogpile-core is no longer maintained, use dogpile-cache instead"; # added 2021-11-20
232 dugong = throw "dugong is unmaintained since 2022 and has therefore been removed"; # added 2024-12-12
233+ editdistance-s = throw "editdistance-s has been removed since it was added solely for the identity package, which has moved on to ukkonen"; # added 2025-08-04
234 eebrightbox = throw "eebrightbox is unmaintained upstream and has therefore been removed"; # added 2022-02-03
235 EasyProcess = easyprocess; # added 2023-02-19
236 email_validator = email-validator; # added 2022-06-22
···350 ipdbplugin = throw "ipdbplugin has been removed because it has no longer maintained for 6 years"; # added 2024-05-21
351 ipython_genutils = ipython-genutils; # added 2023-10-12
352 influxgraph = throw "influxgraph has been removed because it is no longer maintained"; # added 2022-07-10
353+ inlinestyler = throw "inlinestyler has been removed because it is no longer maintained"; # added 2025-08-09
354 itanium_demangler = itanium-demangler; # added 2022-10-17
355 jaeger-client = throw "jaeger-client was removed because it is deprecated upstream. OpenTelemetry is recommended instead."; # Added 2024-12-09
356 jaraco_classes = jaraco-classes; # added 2023-07-14