about summary refs log tree commit diff
path: root/lib/trivial.nix
AgeCommit message (Collapse)AuthorFilesLines
2023-08-10Merge pull request #235625 from ShamrockLee/lib-doc-tidySilvan Mosberger1-2/+2
2023-07-04lib/trivial: Bump oldestSupportedReleaseto to 23.05Martin Weinelt1-1/+1
2023-06-03lib: fix nix-doc variable "Type" in commentYueh-Shun Li1-2/+2
Fix documentation of lib.trivial.importJSON and lib.trivial.importTOML
2023-05-2223.11 is Tapir 23.11-preRaito Bezarius1-1/+1
2023-01-01lib/trival: Bump oldestSupportedRelease to 2211Martin Weinelt1-1/+1
2022-11-22Merge pull request #202370 from Artturin/revertpartof1Artturi1-2/+2
Revert "lib/trivial: fix 'error: cannot decode virtual path '/nix/sto…
2022-11-22Revert "lib/trivial: fix 'error: cannot decode virtual path ↵Artturin1-2/+2
'/nix/store/virtual0000000000000000000000005-source''" This reverts commit b67ee6e861903abb04e9024d605dfc7b00922633. https://github.com/NixOS/nixpkgs/issues/202244 error: a string that refers to a store path cannot be appended to a path, at /etc/nixos/nix/nixos-unstable/lib/sources.nix:193:30 appears to happen when there's a nixpkgs git submodule > So one of the things that is different for a git submodule is that the .git folder isn't a folder, it's a textfile that contains (in my case) this: > $ cat nix/nixos-unstable/.git > gitdir: ../../.git/modules/nixpkgs
2022-11-2123.05 is Stoat 23.05-preMartin Weinelt1-1/+1
2022-11-17Merge pull request #199812 from Artturin/removeusagesoftostringonpath1Artturi1-2/+2
lib/sources: remove 2 usages of toString on a path which will be read using fileContents
2022-11-11lib.trivial.toBaseDigits: type checkWeijia Wang1-0/+2
2022-11-06lib/trivial: fix 'error: cannot decode virtual path ↵Artturin1-2/+2
'/nix/store/virtual0000000000000000000000005-source'' happens on lazy-trees branch of Nix (NixOS/nix#6530)
2022-11-05Revert "lib,doc: remove obvious usages of toString on paths"Anderson Torres1-2/+2
2022-11-06lib,doc: remove obvious usages of toString on pathsArtturin1-2/+2
It gives a warning on the lazy-trees branch of Nix (NixOS/nix#6530) one of these was also giving me an error (the one in lib/trivial probably) ``` $ nix build warning: applying 'toString' to path '/home/artturin/nixgits/my-nixpkgs/nixos/modules/installer/sd-card/sd -image-aarch64.nix' and then accessing it is deprecated, at /home/artturin/nixgits/my-nixpkgs/lib/modules. nix:349:99 warning: applying 'toString' to path '/home/artturin/nixgits/my-nixpkgs/.git' and then accessing it is dep recated, at /home/artturin/nixgits/my-nixpkgs/lib/sources.nix:35:32 warning: applying 'toString' to path '/home/artturin/nixgits/my-nixpkgs/nixos/modules/system/etc/etc.nix' and then accessing it is deprecated, at «stdin»:0 warning: applying 'toString' to path '/home/artturin/nixgits/my-nixpkgs/nixos/modules/system/etc/etc-activ ation.nix' and then accessing it is deprecated, at «stdin»:0 warning: applying 'toString' to path '/home/artturin/nixgits/my-nixpkgs/nixos/modules/installer/sd-card/sd -image-aarch64.nix' and then accessing it is deprecated, at «stdin»:0 error: cannot decode virtual path '/nix/store/virtual0000000000000000000000005-source' (use '--show-trace' to show detailed location information) ```
2022-07-04lib/trivial: Update oldestSupportedReleaseJanne Heß1-1/+1
2022-06-10Merge pull request #157480 from MatthewCroughan/in-pure-eval-modeRobert Hensing1-0/+7
lib: add inPureEvalMode
2022-05-2322.11 is RaccoonJanne Heß1-1/+1
2022-05-06lib: add inPureEvalModematthewcroughan1-0/+7
This makes a value that is true if builtins does not contain the currentSystem function, but false if it does.
2022-03-24Merge pull request #164660 from ncfavier/tests-restrict-argumentsRobert Hensing1-0/+19
nixos/testing: restrict arguments to makeTest
2022-03-22Merge pull request #164890 from ncfavier/lib-warn-throwSilvan Mosberger1-1/+15
lib/trivial: add warnIfNot and throwIf
2022-03-21Merge remote-tracking branch 'upstream/master' into tests-restrict-argumentsRobert Hensing1-0/+24
2022-03-21lib: Add toFunctionRobert Hensing1-0/+19
2022-03-19lib/trivial: add warnIfNot and throwIfNaïm Favier1-1/+15
Negated versions of warnIf and throwIfNot.
2022-03-09lib: Add mkRenamedOptionModuleWithRobert Hensing1-0/+24
Adds support for sinceRelease
2022-01-30lib.trivial: Change comment type before concat functionJan Tojnar1-5/+5
C-style comment was being picked up by nixdoc as a documentation comment for the function.
2022-01-09lib.checkListOfEnum: initJosé Romildo1-0/+17
2021-12-22lib.throwIfNot: initRobert Hensing1-0/+22
2021-11-22add release notes for 22.05 and update codenameTimothy DeHerrera1-1/+1
2021-10-13lib.warn: Add NIX_ABORT_ON_WARN for call tracesRobert Hensing1-1/+20
2021-08-03lib: fix functionArgs for functorsDavid Arnold1-1/+4
`functionArgs` should give valid results on functions that have been identified with `lib.isFunction` instead of erroring out.
2021-07-27Merge pull request #110742 from siraben/deprecate-foldBen Siraphob1-1/+1
2021-05-2221.11 is Porcupine!Jonathan Ringer1-1/+1
2021-04-28lib.trivial.warnIf: initAlyssa Ross1-0/+3
It's a common pattern in Nixpkgs to want to emit a warning in certain cases, but not actually change behaviours. This is often expressed as either if cond then lib.warn "Don't do that thing" x else x Or (if cond then lib.warn "Don't do that thing" else lib.id) x Neither of which really expresses the intent here, because it looks like 'x' is being chosen conditionally. To make this clearer, I introduce a "warnIf" function, which makes it clear that the only thing being affected by the condition is whether the warning is generated, not the value being returned.
2021-04-05lib.trivial: fix typo "nixpks" -> "nixpkgs"Alyssa Ross1-1/+1
2021-01-26treewide: fold -> foldrBen Siraphob1-1/+1
2020-09-12lib: add importTOMLzimbatm1-0/+6
Complements the `lib.importJSON`. `builtins.readTOML` has been introduced in Nix 2.1.
2020-09-0721.03 is OkapiJonathan Ringer1-1/+1
* Okapi is an artiodactyl mammal native to Central Africa * https://en.wikipedia.org/wiki/Okapi
2020-07-20lib: toHex -> toHexString & toBase -> toBaseDigitsBas van Dijk1-10/+10
This makes the type of these functions more apparent from the name.
2020-07-20lib: add the toHex and toBase utility functionsBas van Dijk1-0/+51
`toHex` converts the given positive integer to a string of the hexadecimal representation of that integer. For example: ``` toHex 0 => "0" toHex 16 => "10" toHex 250 => "FA" ``` `toBase base i` converts the positive integer `i` to a list of it digits in the given `base`. For example: ``` toBase 10 123 => [ 1 2 3 ] toBase 2 6 => [ 1 1 0 ] toBase 16 250 => [ 15 10 ] ```
2020-02-1020.09 is Nightingaleworldofpeace1-1/+1
2020-01-20nixos/version: fix case where .git is a symlinkFranz Pletz1-1/+1
Before c9214c394b248e1f26e45dbe1be2bd82363af3a6 and 9d396d2e426b9a765de0b8999aa214f1259633e6 if .git is symlink the version would gracefully default to no git revision. With those changes an exception is thrown instead. This introduces a new function `pathIsGitRepo` that checks if `commitIdFromGitRepo` fails without error so we don't have to reimplement this logic again and can fail gracefully.
2020-01-10lib.commitIdFromGitRepo: support git-worktreeelseym1-1/+1
lib.commitIdFromGitRepo now resolves the refs from the parent repository in case the supplied path is a file containing the path to said repository. this adds support for git-worktree and things alike. see gitrepository-layout(5). this also: - adds a new boolean function lib.pathIsRegularFile to check whether a path is a regular file - patches lib.revisionWithDefault and the revision and versionSuffix attributes in config.system.nixos in order to support git-worktrees
2019-10-21lib/trivial: add `pipe` functionProfpatsch1-0/+37
`pipe` is a useful operator for creating pipelines of functions. It works around the usual problem of e.g. string operations becoming deeply nested functions. In principle, there are four different ways this function could be written: pipe val [ f1 .. fn ] pipe val [ fn .. f1 ] compose [ f1 .. fn ] val compose [ fn .. f1 ] val The third and fourth form mirror composition of functions, they would be the same as e.g. `(f1 << f2 << f3 .. << fn) val`. However, it is not clear which direction the list should have (as one can see in the second form, which is the most absurd. In order not to confuse users, we decide for the most “intuitive” form, which mirrors the way unix pipes work (thus the name `pipe`). The flow of data goes from left to right. Co-Authored-By: Silvan Mosberger <infinisil@icloud.com>
2019-09-0920.03 is MarkhorSamuel Leathers1-1/+1
* Markhor is a spiral horned animal that is on the endangered species list * https://en.wikipedia.org/wiki/Markhor
2019-04-29treewide: Remove usage of isNullDaniel Schaefer1-1/+1
isNull "is deprecated; just write e == null instead" says the Nix manual
2019-03-08lib: add `showWarnings`Jan Malakhovski1-1/+2
2019-02-2519.09 is Loris.Linus Heckemann1-1/+1
https://en.wikipedia.org/wiki/Loris
2018-11-15group the release infozimbatm1-0/+7
this makes the codename globally accessible in the repo. The release is not only for NixOS anymore.
2018-10-27lib/trivial: Update function comments for doc generationVincent Ambo1-30/+87
Expands on some of the function comments and add some of the special syntaxes recognised by nixdoc.
2018-10-05version.nix: extract revision-fetching functionGraham Christensen1-0/+10
2018-09-06lib: move assertMsg and assertOneOf to their own library fileProfpatsch1-39/+1
Since the `assertOneOf` uses `lib.generators`, they are not really trivial anymore and should go into their own library file.