···121121122122in /* No rec! Add dependencies on this file at the top. */ {
123123124124- /* Append a subpath string to a path.
124124+ /*
125125+ Append a subpath string to a path.
125126126127 Like `path + ("/" + string)` but safer, because it errors instead of returning potentially surprising results.
127128 More specifically, it checks that the first argument is a [path value type](https://nixos.org/manual/nix/stable/language/values.html#type-path"),
128128- and that the second argument is a valid subpath string (see `lib.path.subpath.isValid`).
129129+ and that the second argument is a [valid subpath string](#function-library-lib.path.subpath.isValid).
129130130131 Laws:
131132132132- - Not influenced by subpath normalisation
133133+ - Not influenced by subpath [normalisation](#function-library-lib.path.subpath.normalise):
133134134134- append p s == append p (subpath.normalise s)
135135+ append p s == append p (subpath.normalise s)
135136136137 Type:
137138 append :: Path -> String -> Path
···175176 path + ("/" + subpath);
176177177178 /*
178178- Whether the first path is a component-wise prefix of the second path.
179179+ Whether the first path is a component-wise prefix of the second path.
179180180180- Laws:
181181+ Laws:
181182182182- - `hasPrefix p q` is only true if `q == append p s` for some subpath `s`.
183183+ - `hasPrefix p q` is only true if [`q == append p s`](#function-library-lib.path.append) for some [subpath](#function-library-lib.path.subpath.isValid) `s`.
183184184184- - `hasPrefix` is a [non-strict partial order](https://en.wikipedia.org/wiki/Partially_ordered_set#Non-strict_partial_order) over the set of all path values
185185+ - `hasPrefix` is a [non-strict partial order](https://en.wikipedia.org/wiki/Partially_ordered_set#Non-strict_partial_order) over the set of all path values.
185186186186- Type:
187187- hasPrefix :: Path -> Path -> Bool
187187+ Type:
188188+ hasPrefix :: Path -> Path -> Bool
188189189189- Example:
190190- hasPrefix /foo /foo/bar
191191- => true
192192- hasPrefix /foo /foo
193193- => true
194194- hasPrefix /foo/bar /foo
195195- => false
196196- hasPrefix /. /foo
197197- => true
190190+ Example:
191191+ hasPrefix /foo /foo/bar
192192+ => true
193193+ hasPrefix /foo /foo
194194+ => true
195195+ hasPrefix /foo/bar /foo
196196+ => false
197197+ hasPrefix /. /foo
198198+ => true
198199 */
199200 hasPrefix =
200201 path1:
···219220 take (length path1Deconstructed.components) path2Deconstructed.components == path1Deconstructed.components;
220221221222 /*
222222- Remove the first path as a component-wise prefix from the second path.
223223- The result is a normalised subpath string, see `lib.path.subpath.normalise`.
223223+ Remove the first path as a component-wise prefix from the second path.
224224+ The result is a [normalised subpath string](#function-library-lib.path.subpath.normalise).
224225225225- Laws:
226226+ Laws:
226227227227- - Inverts `append` for normalised subpaths:
228228+ - Inverts [`append`](#function-library-lib.path.append) for [normalised subpath string](#function-library-lib.path.subpath.normalise):
228229229229- removePrefix p (append p s) == subpath.normalise s
230230+ removePrefix p (append p s) == subpath.normalise s
230231231231- Type:
232232- removePrefix :: Path -> Path -> String
232232+ Type:
233233+ removePrefix :: Path -> Path -> String
233234234234- Example:
235235- removePrefix /foo /foo/bar/baz
236236- => "./bar/baz"
237237- removePrefix /foo /foo
238238- => "./."
239239- removePrefix /foo/bar /foo
240240- => <error>
241241- removePrefix /. /foo
242242- => "./foo"
235235+ Example:
236236+ removePrefix /foo /foo/bar/baz
237237+ => "./bar/baz"
238238+ removePrefix /foo /foo
239239+ => "./."
240240+ removePrefix /foo/bar /foo
241241+ => <error>
242242+ removePrefix /. /foo
243243+ => "./foo"
243244 */
244245 removePrefix =
245246 path1:
···272273 joinRelPath components;
273274274275 /*
275275- Split the filesystem root from a [path](https://nixos.org/manual/nix/stable/language/values.html#type-path).
276276- The result is an attribute set with these attributes:
277277- - `root`: The filesystem root of the path, meaning that this directory has no parent directory.
278278- - `subpath`: The [normalised subpath string](#function-library-lib.path.subpath.normalise) that when [appended](#function-library-lib.path.append) to `root` returns the original path.
276276+ Split the filesystem root from a [path](https://nixos.org/manual/nix/stable/language/values.html#type-path).
277277+ The result is an attribute set with these attributes:
278278+ - `root`: The filesystem root of the path, meaning that this directory has no parent directory.
279279+ - `subpath`: The [normalised subpath string](#function-library-lib.path.subpath.normalise) that when [appended](#function-library-lib.path.append) to `root` returns the original path.
279280280280- Laws:
281281- - [Appending](#function-library-lib.path.append) the `root` and `subpath` gives the original path:
281281+ Laws:
282282+ - [Appending](#function-library-lib.path.append) the `root` and `subpath` gives the original path:
282283283283- p ==
284284- append
285285- (splitRoot p).root
286286- (splitRoot p).subpath
284284+ p ==
285285+ append
286286+ (splitRoot p).root
287287+ (splitRoot p).subpath
287288288288- - Trying to get the parent directory of `root` using [`readDir`](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-readDir) returns `root` itself:
289289+ - Trying to get the parent directory of `root` using [`readDir`](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-readDir) returns `root` itself:
289290290290- dirOf (splitRoot p).root == (splitRoot p).root
291291+ dirOf (splitRoot p).root == (splitRoot p).root
291292292292- Type:
293293- splitRoot :: Path -> { root :: Path, subpath :: String }
293293+ Type:
294294+ splitRoot :: Path -> { root :: Path, subpath :: String }
294295295295- Example:
296296- splitRoot /foo/bar
297297- => { root = /.; subpath = "./foo/bar"; }
296296+ Example:
297297+ splitRoot /foo/bar
298298+ => { root = /.; subpath = "./foo/bar"; }
298299299299- splitRoot /.
300300- => { root = /.; subpath = "./."; }
300300+ splitRoot /.
301301+ => { root = /.; subpath = "./."; }
301302302302- # Nix neutralises `..` path components for all path values automatically
303303- splitRoot /foo/../bar
304304- => { root = /.; subpath = "./bar"; }
303303+ # Nix neutralises `..` path components for all path values automatically
304304+ splitRoot /foo/../bar
305305+ => { root = /.; subpath = "./bar"; }
305306306306- splitRoot "/foo/bar"
307307- => <error>
307307+ splitRoot "/foo/bar"
308308+ => <error>
308309 */
309309- splitRoot = path:
310310+ splitRoot =
311311+ # The path to split the root off of
312312+ path:
310313 assert assertMsg
311314 (isPath path)
312315 "lib.path.splitRoot: Argument is of type ${typeOf path}, but a path was expected";
···317320 subpath = joinRelPath deconstructed.components;
318321 };
319322320320- /* Whether a value is a valid subpath string.
323323+ /*
324324+ Whether a value is a valid subpath string.
321325322322- A subpath string points to a specific file or directory within an absolute base directory.
323323- It is a stricter form of a relative path that excludes `..` components, since those could escape the base directory.
326326+ A subpath string points to a specific file or directory within an absolute base directory.
327327+ It is a stricter form of a relative path that excludes `..` components, since those could escape the base directory.
324328325325- - The value is a string
329329+ - The value is a string.
326330327327- - The string is not empty
331331+ - The string is not empty.
328332329329- - The string doesn't start with a `/`
333333+ - The string doesn't start with a `/`.
330334331331- - The string doesn't contain any `..` path components
335335+ - The string doesn't contain any `..` path components.
332336333333- Type:
334334- subpath.isValid :: String -> Bool
337337+ Type:
338338+ subpath.isValid :: String -> Bool
335339336336- Example:
337337- # Not a string
338338- subpath.isValid null
339339- => false
340340+ Example:
341341+ # Not a string
342342+ subpath.isValid null
343343+ => false
340344341341- # Empty string
342342- subpath.isValid ""
343343- => false
345345+ # Empty string
346346+ subpath.isValid ""
347347+ => false
344348345345- # Absolute path
346346- subpath.isValid "/foo"
347347- => false
349349+ # Absolute path
350350+ subpath.isValid "/foo"
351351+ => false
348352349349- # Contains a `..` path component
350350- subpath.isValid "../foo"
351351- => false
353353+ # Contains a `..` path component
354354+ subpath.isValid "../foo"
355355+ => false
352356353353- # Valid subpath
354354- subpath.isValid "foo/bar"
355355- => true
357357+ # Valid subpath
358358+ subpath.isValid "foo/bar"
359359+ => true
356360357357- # Doesn't need to be normalised
358358- subpath.isValid "./foo//bar/"
359359- => true
361361+ # Doesn't need to be normalised
362362+ subpath.isValid "./foo//bar/"
363363+ => true
360364 */
361365 subpath.isValid =
362366 # The value to check
···364368 subpathInvalidReason value == null;
365369366370367367- /* Join subpath strings together using `/`, returning a normalised subpath string.
371371+ /*
372372+ Join subpath strings together using `/`, returning a normalised subpath string.
368373369374 Like `concatStringsSep "/"` but safer, specifically:
370375371371- - All elements must be valid subpath strings, see `lib.path.subpath.isValid`
376376+ - All elements must be [valid subpath strings](#function-library-lib.path.subpath.isValid).
372377373373- - The result gets normalised, see `lib.path.subpath.normalise`
378378+ - The result gets [normalised](#function-library-lib.path.subpath.normalise).
374379375375- - The edge case of an empty list gets properly handled by returning the neutral subpath `"./."`
380380+ - The edge case of an empty list gets properly handled by returning the neutral subpath `"./."`.
376381377382 Laws:
378383···386391 subpath.join [ (subpath.normalise p) "./." ] == subpath.normalise p
387392 subpath.join [ "./." (subpath.normalise p) ] == subpath.normalise p
388393389389- - Normalisation - the result is normalised according to `lib.path.subpath.normalise`:
394394+ - Normalisation - the result is [normalised](#function-library-lib.path.subpath.normalise):
390395391396 subpath.join ps == subpath.normalise (subpath.join ps)
392397393393- - For non-empty lists, the implementation is equivalent to normalising the result of `concatStringsSep "/"`.
394394- Note that the above laws can be derived from this one.
398398+ - For non-empty lists, the implementation is equivalent to [normalising](#function-library-lib.path.subpath.normalise) the result of `concatStringsSep "/"`.
399399+ Note that the above laws can be derived from this one:
395400396401 ps != [] -> subpath.join ps == subpath.normalise (concatStringsSep "/" ps)
397402···439444 ) 0 subpaths;
440445441446 /*
442442- Split [a subpath](#function-library-lib.path.subpath.isValid) into its path component strings.
443443- Throw an error if the subpath isn't valid.
444444- Note that the returned path components are also valid subpath strings, though they are intentionally not [normalised](#function-library-lib.path.subpath.normalise).
447447+ Split [a subpath](#function-library-lib.path.subpath.isValid) into its path component strings.
448448+ Throw an error if the subpath isn't valid.
449449+ Note that the returned path components are also [valid subpath strings](#function-library-lib.path.subpath.isValid), though they are intentionally not [normalised](#function-library-lib.path.subpath.normalise).
445450446446- Laws:
451451+ Laws:
447452448448- - Splitting a subpath into components and [joining](#function-library-lib.path.subpath.join) the components gives the same subpath but [normalised](#function-library-lib.path.subpath.normalise):
453453+ - Splitting a subpath into components and [joining](#function-library-lib.path.subpath.join) the components gives the same subpath but [normalised](#function-library-lib.path.subpath.normalise):
449454450450- subpath.join (subpath.components s) == subpath.normalise s
455455+ subpath.join (subpath.components s) == subpath.normalise s
451456452452- Type:
453453- subpath.components :: String -> [ String ]
457457+ Type:
458458+ subpath.components :: String -> [ String ]
454459455455- Example:
456456- subpath.components "."
457457- => [ ]
460460+ Example:
461461+ subpath.components "."
462462+ => [ ]
458463459459- subpath.components "./foo//bar/./baz/"
460460- => [ "foo" "bar" "baz" ]
464464+ subpath.components "./foo//bar/./baz/"
465465+ => [ "foo" "bar" "baz" ]
461466462462- subpath.components "/foo"
463463- => <error>
467467+ subpath.components "/foo"
468468+ => <error>
464469 */
465470 subpath.components =
471471+ # The subpath string to split into components
466472 subpath:
467473 assert assertMsg (isValid subpath) ''
468474 lib.path.subpath.components: Argument is not a valid subpath string:
469475 ${subpathInvalidReason subpath}'';
470476 splitRelPath subpath;
471477472472- /* Normalise a subpath. Throw an error if the subpath isn't valid, see
473473- `lib.path.subpath.isValid`
478478+ /*
479479+ Normalise a subpath. Throw an error if the subpath isn't [valid](#function-library-lib.path.subpath.isValid).
474480475475- - Limit repeating `/` to a single one
481481+ - Limit repeating `/` to a single one.
476482477477- - Remove redundant `.` components
483483+ - Remove redundant `.` components.
478484479479- - Remove trailing `/` and `/.`
485485+ - Remove trailing `/` and `/.`.
480486481481- - Add leading `./`
487487+ - Add leading `./`.
482488483483- Laws:
489489+ Laws:
484490485485- - Idempotency - normalising multiple times gives the same result:
491491+ - Idempotency - normalising multiple times gives the same result:
486492487487- subpath.normalise (subpath.normalise p) == subpath.normalise p
493493+ subpath.normalise (subpath.normalise p) == subpath.normalise p
488494489489- - Uniqueness - there's only a single normalisation for the paths that lead to the same file system node:
495495+ - Uniqueness - there's only a single normalisation for the paths that lead to the same file system node:
490496491491- subpath.normalise p != subpath.normalise q -> $(realpath ${p}) != $(realpath ${q})
497497+ subpath.normalise p != subpath.normalise q -> $(realpath ${p}) != $(realpath ${q})
492498493493- - Don't change the result when appended to a Nix path value:
499499+ - Don't change the result when [appended](#function-library-lib.path.append) to a Nix path value:
494500495495- base + ("/" + p) == base + ("/" + subpath.normalise p)
501501+ append base p == append base (subpath.normalise p)
496502497497- - Don't change the path according to `realpath`:
503503+ - Don't change the path according to `realpath`:
498504499499- $(realpath ${p}) == $(realpath ${subpath.normalise p})
505505+ $(realpath ${p}) == $(realpath ${subpath.normalise p})
500506501501- - Only error on invalid subpaths:
507507+ - Only error on [invalid subpaths](#function-library-lib.path.subpath.isValid):
502508503503- builtins.tryEval (subpath.normalise p)).success == subpath.isValid p
509509+ builtins.tryEval (subpath.normalise p)).success == subpath.isValid p
504510505505- Type:
506506- subpath.normalise :: String -> String
511511+ Type:
512512+ subpath.normalise :: String -> String
507513508508- Example:
509509- # limit repeating `/` to a single one
510510- subpath.normalise "foo//bar"
511511- => "./foo/bar"
514514+ Example:
515515+ # limit repeating `/` to a single one
516516+ subpath.normalise "foo//bar"
517517+ => "./foo/bar"
512518513513- # remove redundant `.` components
514514- subpath.normalise "foo/./bar"
515515- => "./foo/bar"
519519+ # remove redundant `.` components
520520+ subpath.normalise "foo/./bar"
521521+ => "./foo/bar"
516522517517- # add leading `./`
518518- subpath.normalise "foo/bar"
519519- => "./foo/bar"
523523+ # add leading `./`
524524+ subpath.normalise "foo/bar"
525525+ => "./foo/bar"
520526521521- # remove trailing `/`
522522- subpath.normalise "foo/bar/"
523523- => "./foo/bar"
527527+ # remove trailing `/`
528528+ subpath.normalise "foo/bar/"
529529+ => "./foo/bar"
524530525525- # remove trailing `/.`
526526- subpath.normalise "foo/bar/."
527527- => "./foo/bar"
531531+ # remove trailing `/.`
532532+ subpath.normalise "foo/bar/."
533533+ => "./foo/bar"
528534529529- # Return the current directory as `./.`
530530- subpath.normalise "."
531531- => "./."
535535+ # Return the current directory as `./.`
536536+ subpath.normalise "."
537537+ => "./."
532538533533- # error on `..` path components
534534- subpath.normalise "foo/../bar"
535535- => <error>
539539+ # error on `..` path components
540540+ subpath.normalise "foo/../bar"
541541+ => <error>
536542537537- # error on empty string
538538- subpath.normalise ""
539539- => <error>
543543+ # error on empty string
544544+ subpath.normalise ""
545545+ => <error>
540546541541- # error on absolute path
542542- subpath.normalise "/foo"
543543- => <error>
547547+ # error on absolute path
548548+ subpath.normalise "/foo"
549549+ => <error>
544550 */
545551 subpath.normalise =
546552 # The subpath string to normalise
+10
nixos/doc/manual/release-notes/rl-2311.section.md
···140140141141- The Cinnamon module now enables XDG desktop integration by default. If you are experiencing collisions related to xdg-desktop-portal-gtk you can safely remove `xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];` from your NixOS configuration.
142142143143+- GNOME module no longer forces Qt applications to use Adwaita style since it was buggy and is no longer maintained upstream. If you still want it, you can add the following options to your configuration but it will probably be eventually removed:
144144+145145+ ```nix
146146+ qt = {
147147+ enable = true;
148148+ platformTheme = "gnome";
149149+ style = "adwaita";
150150+ };
151151+ ```
152152+143153- `fontconfig` now defaults to using greyscale antialiasing instead of subpixel antialiasing because of a [recommendation from one of the downstreams](https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/337). You can change this value by configuring [](#opt-fonts.fontconfig.subpixel.rgba) accordingly.
144154145155- The latest available version of Nextcloud is v27 (available as `pkgs.nextcloud27`). The installation logic is as follows:
···1038103810391039 # > CONFIG_KUNIT should not be enabled in a production environment. Enabling KUnit disables Kernel Address-Space Layout Randomization (KASLR), and tests may affect the state of the kernel in ways not suitable for production.
10401040 # https://www.kernel.org/doc/html/latest/dev-tools/kunit/start.html
10411041- KUNIT = no;
10411041+ KUNIT = whenAtLeast "5.5" no;
10421042 } // optionalAttrs (stdenv.hostPlatform.system == "x86_64-linux" || stdenv.hostPlatform.system == "aarch64-linux") {
10431043 # Enable CPU/memory hotplug support
10441044 # Allows you to dynamically add & remove CPUs/memory to a VM client running NixOS without requiring a reboot