Artturi
bde196dde9
Merge pull request #245957 from amjoseph-nixpkgs/pr/lib/customization/makeScopeWithSplicing2
2023-08-20 18:57:05 +03:00
Adam Joseph
a1fdbae706
lib.customisation: add uncurried form of makeScopeWithSplicing
...
Deeply-curried functions are pretty error-prone in untyped languages
like Nix. This is a particularly bad case because
`top-level/splice.nix` *also* declares a makeScopeWithSplicing, but
it takes *two fewer arguments*.
Let's add a version that uses attrset-passing form, to provide some
minimal level of sanity-checking.
This also provides defaults for keep and extra (these are often
unneeded by the user).
2023-08-14 02:50:32 +03:00
Sefa Eyeoglu
3036465760
lib/meta.nix: introduce getExe'
...
getExe' can be used to get a binary other than the mainProgram from a
derivation.
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2023-08-13 15:45:37 +02:00
pennae
7542a1aa8f
lib/options: remove literalDocBook
...
no longer supported. warning when used would not be appropriate, and
docbook has been on the way out for long enough that throwing an error
should not be necessary either.
2023-06-13 16:56:30 +02:00
Silvan Mosberger
c701a4dd29
lib.sources.pathType and co.: Move to lib.filesystem
...
These functions only work with the filesystem, they don't import
anything as sources
2023-04-05 17:18:10 +02:00
hsjobeki
15a8d05ba5
init: lib.foldlAttrs
...
- provide comprehensive example
- add unit test
2023-03-11 10:42:00 +01:00
pennae
61852b7faa
lib: remove deprecated functions
...
all of these have been deprecated and raising warnings since 18.09. it's
about time we actually made good on "will be removed in the next release".
2023-03-08 03:57:38 +01:00
Patrick Widmer
7089294f10
strings: add escapeQuery for url encoding
2023-03-03 20:48:55 +01:00
Silvan Mosberger
0a60663e67
Merge pull request #206611 from h7x4/lib-lists-add-repeat
...
lib.lists: add `replicate`
2023-02-07 06:16:09 +01:00
h7x4
7c4abbf80e
lib.lists: add replicate
...
`replicate` returns n copies of an element as a list.
Co-Authored-By: Silvan Mosberger <contact@infinisil.com>
2023-02-06 20:40:47 +01:00
Silvan Mosberger
50e4dbf35b
Merge pull request #205557 from ncfavier/concatLines
...
lib/strings: add `concatLines`
2023-01-31 18:05:53 +01:00
Silvan Mosberger
d35cae9696
Merge pull request #208674 from YoshiRulz/yoshi-lib-docs
...
lib: Fix mismatched quotes in `lib.*` doc comments
2023-01-05 19:00:38 +01:00
pennae
9da5f12ecf
modules: add mkPackageOptionMD
...
another transitional option factory, like mkAliasOptionModuleMD.
2023-01-05 02:33:13 +01:00
pennae
4c1cfbdb84
modules: add mkAliasOptionModuleMD
...
mkAliasOptionModule should not default to mdDoc descriptions because
that can break out-of-tree users of documentation infrastructure. add an
explicitly-MD variant for now, to be removed some time after the MD
transition is complete.
2023-01-05 02:33:13 +01:00
Robert Hensing
f61d4d346b
Merge pull request #205190 from NixOS/lib.path.relativeNormalise
...
lib.path.subpath.{isValid,normalise}: init
2023-01-03 13:46:11 +01:00
Silvan Mosberger
98fbcf1788
lib.path.subpath.isValid: init
...
The first path library function
2023-01-03 13:20:36 +01:00
YoshiRulz
7fba83890c
lib: Fix mismatched quotes in lib.*
doc comments
...
caused problems for automated rich text generation such as
https://teu5us.github.io/nix-lib.html#customisation-functions
2023-01-02 08:25:17 +10:00
Robert Hensing
cb98e26aaf
lib: Add isStringLike
2022-12-31 01:47:28 +01:00
Robert Hensing
d0d0f7d0aa
lib: Add isPath
...
Available since Nix 2.3, which is the Nixpkgs minimum version.
Thanks zimbatm!
2022-12-31 01:33:47 +01:00
Naïm Favier
ed0b8c26f1
lib/strings: add concatLines
...
Like `unlines` from Haskell.
The aim is to replace the `concatStringsSep "\n"` pattern for generated
files, which doesn't add a final newline.
2022-12-10 15:56:30 +01:00
AndersonTorres
85b6175ccb
lib/default.nix: include mesonOption-related functions
...
To bring them to the scope when calling `lib`.
2022-12-06 23:09:36 -03:00
figsoda
f993f8a186
lib/attrsets: add concatMapAttrs
2022-11-17 10:41:53 -05:00
Jacob Abel
39a4ab78a1
lib/strings: Refactor toInt into toInt and toIntBase10
2022-10-23 17:50:24 -04:00
Robert Hensing
fce8b018f0
lib: Add lazyDerivation
2022-09-21 10:55:07 +01:00
Robert Hensing
89b4bd8b24
lib/options: Add showOptionWithDefLocs
2022-06-21 14:22:33 +02:00
pennae
320aa2a791
treewide: attempt at markdown option docs
2022-06-12 12:44:38 +02:00
Robert Hensing
b37801bc3f
Merge pull request #157480 from MatthewCroughan/in-pure-eval-mode
...
lib: add inPureEvalMode
2022-06-10 16:31:31 +02:00
Robert Scott
da9162f667
add mechanism for handling meta.sourceProvenance attributes
...
heavily based on patterns used by licenses infrastructure, so may
appear overengineered for its initial level of use
2022-05-30 16:27:34 +08:00
adisbladis
161776ec1e
Revert "lib: init flakes.nix"
...
This reverts commit PR #167947 .
Flakes aren't standardised and the `lib` namespace shouldn't be
polluted with utilities that serve only experimental uses.
2022-05-15 22:39:46 +12:00
matthewcroughan
4d9801a78f
lib: add inPureEvalMode
...
This makes a value that is true if builtins does not contain the
currentSystem function, but false if it does.
2022-05-06 15:42:52 +01:00
Artturi
a5357d06e4
Merge pull request #167947 from MatthewCroughan/mc/callLocklessFlake
...
lib: add callLocklessFlake
2022-05-01 23:06:17 +03:00
Robert Hensing
5f8cb21011
Merge pull request #170583 from ncfavier/mkShellVars
...
lib/strings: add toShellVars
2022-04-27 23:33:28 +02:00
Naïm Favier
226bc99659
lib/strings: add toShellVars
...
A straightforward piece of plumbing to safely inject Nix variables into
shell scripts:
''
${lib.toShellVars { inherit foo bar; }}
cmd "$foo" --bar "$bar"
''
2022-04-27 16:04:17 +02:00
Artturin
379b9c8be3
lib/meta: add getExe to get the main program of a drv
2022-04-24 04:19:49 +03:00
matthewcroughan
cad8bbe589
lib: init flakes.nix
...
This commit creates flakes.nix, which is a library containing functions
which relate to interacting with flakes. It also moves related functions
from trivial.nix into it.
2022-04-12 19:28:23 +01:00
matthewcroughan
c190b08bb7
lib: add callLocklessFlake
...
This is essentially a copy of the function of the same name, from
flake-compat. callLocklessFlake is useful when trying to utilise a
flake.nix without a lock file, often for when you want to create a
subflake from within a parent flake.
Co-authored-by: Tom Bereknyei <tomberek@gmail.com>
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2022-04-12 19:27:24 +01:00
Naïm Favier
9f5796be49
lib/trivial: actually expose warnIfNot and throwIf
2022-03-27 16:48:33 +02:00
Robert Hensing
6c469679f6
Merge remote-tracking branch 'upstream/master' into tests-restrict-arguments
2022-03-21 23:17:17 +01:00
Robert Hensing
84274cbc95
lib: Add toFunction
2022-03-21 23:14:10 +01:00
Robert Hensing
6a0b24b276
lib: applyIfFunction -> applyModuleArgsIfFunction
2022-03-21 23:14:10 +01:00
Kevin Cox
8ce16fcf62
Merge pull request #163451 from hercules-ci/stop-premature-warnings
...
Stop premature warnings, including `nix.settings` migration
2022-03-21 10:10:40 -04:00
Silvan Mosberger
85003ecdbb
lib.attrsets: Introduce updateManyAttrsByPath
2022-03-18 00:08:29 +01:00
Silvan Mosberger
71b130c581
lib.attrsets: Introduce showAttrPath
2022-03-18 00:05:08 +01:00
Robert Hensing
7377ea57ff
lib: Add mkRenamedOptionModuleWith
...
Adds support for sinceRelease
2022-03-09 14:50:51 +01:00
0x4A6F
3362ff0f7b
Merge pull request #157301 from pennae/lib-add-mkPackageOption
...
lib: add mkPackageOption to default.nix
2022-02-28 20:37:59 +01:00
pennae
1c0918d828
lib: add mkPackageOption to default.nix
...
this was forgotten in #155669
2022-01-29 18:28:20 +01:00
Naïm Favier
5a07097772
lib/modules: introduce setDefaultModuleLocation
...
Wraps a module with a default location for reporting errors.
2022-01-27 22:12:53 +01:00
Robert Hensing
ba3e91ed43
lib.types: Add unique like uniq, but custom errors
...
Couldn't extend types.uniq and it had a silly name anyway.
Now we can have better error messages.
2022-01-24 16:14:55 +01:00
José Romildo
4fc67da841
lib.checkListOfEnum: init
2022-01-09 19:21:08 -03:00
Robert Hensing
f2c5c706f4
lib.throwIfNot: init
2021-12-22 13:13:50 +01:00