about summary refs log tree commit diff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2023-09-11Merge pull request #250220Robert Helgesson2-3/+56
lib.generators.toGitINI: escape string values in configuration
2023-09-08nixpkgs/systems: Add ucrt64 as MinGW libcMoritz Angermann1-0/+5
The Minimalist Gnu for Windows distribution comes with support for the traditional msvcrt libc, as well as ucrt64 libc. The latter being the newer universal compiler runtime. We follow the msys2 environment naming convention[1]: | name | toolchain | arch | libc | libc++ | |------------|-----------|---------|--------|-----------| | mingw32 | gcc | i686 | msvcrt | libstdc++ | | mingw64 | gcc | x86_64 | msvcrt | libstdc++ | | ucrt64 | gcc | x86_64 | ucrt | libstdc++ | | clang32 | llvm | i686 | ucrt | libc++ | | clang64 | llvm | x86_64 | ucrt | libc++ | | clangarm64 | llvm | aarch64 | ucrt | libc++ | For now nixpkgs only supports the first three with this commit. -- [1]: https://www.msys2.org/docs/environments/
2023-09-08lib/systems: disable pipewireSupport in qemu-userArtturin1-0/+1
Option added in 5b0ed68c106c1cbe3b573f3d1ca8c73eb203e346 it causes infinite recursion in cross builds There's a another inf rec that needs 6946977de0de845e69a805f179b96a87d17640fa which is in staging
2023-09-02Merge pull request #245623 from tweag/fileset.toSourceSilvan Mosberger9-1/+1067
File set combinators base: `lib.fileset.toSource`
2023-09-01lib.fileset.toSource: initSilvan Mosberger9-1/+1067
2023-08-28Merge pull request #234615 from linsui/dconfJan Tojnar4-0/+392
nixos/dconf: support generating from attrs
2023-08-21makeScopeWithSplicing: fix `makeScopeWithSplicing'` callArtturin1-4/+4
makeScopeWithSplicing: fix comment
2023-08-21lib.generators.toGitINI: added testVwCSXg1-0/+45
Added basic generators.toGitINI test. Mostly taken from https://github.com/nix-community/home-manager/blob/958c06303f43cf0625694326b7f7e5475b1a2d5c/tests/modules/programs/git/git.nix. The ${"\t} escape is used so that the lines aren't recognized as "Wrong indent style".
2023-08-20Merge pull request #245957 from ↵Artturi2-9/+22
amjoseph-nixpkgs/pr/lib/customization/makeScopeWithSplicing2
2023-08-19lib.generators.toGitINI: escape string values in configurationRobert Helgesson1-3/+11
This should handle the special characters that typically occur. Upstreaming of https://github.com/nix-community/home-manager/commit/642d9ffe24eec1290e94d70e8129ba74922fddf2
2023-08-18lib/modules: Report a better error when option tree has bare typeRobert Hensing2-6/+6
Improves on 0d472a62012364d064f0b75f1da491242c6ae9c6 - https://github.com/NixOS/nixpkgs/pull/242339 We actually do have the file name. Thanks Shawn8901 for the [feedback]! feedback: https://github.com/NixOS/nixpkgs/pull/242339#issuecomment-1683107055
2023-08-16Merge pull request #238509 from amjoseph-nixpkgs/pr/knuth/respectJohn Ericson1-0/+2
lib/systems/parse.nix: show respect where deserved
2023-08-16Merge pull request #248895 from Scrumplex/getExe2Silvan Mosberger2-6/+21
2023-08-15nixos/dconf: add settings supportlinsui1-0/+8
2023-08-15lib/gvariant: initlinsui3-0/+384
2023-08-15lib/meta.nix: recommend use of getExe' in getExe warningSefa Eyeoglu1-1/+1
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
2023-08-14lib.removePrefix: OptimiseSilvan Mosberger1-2/+2
2023-08-14lib.removePrefix: Add testsSilvan Mosberger1-0/+21
2023-08-14Merge pull request #243511 from tweag/lib.lists.hasPrefixSilvan Mosberger2-0/+72
`lib.lists.{hasPrefix,removePrefix}`: init
2023-08-14Merge pull request #242339 from hercules-ci/modules-catch-bare-typeSilvan Mosberger5-1/+54
lib/modules: Report a good error when option tree has bare type
2023-08-14lib.customisation.makeScope: Make `overrideScope` consistent with ↵Artturin1-4/+5
`makeScopeWithSplicing` Right now converting `makeScope` to `makeScopeWithSplicing` is not transparent to users and requires adding a warning for `overrideScope'` in the set itself. Warning and `overrideScope'` were added in 2018 b9dce11712d2bfc8cd367df5a7f737a5cec1e252 and there should be no users left after 5 years.
2023-08-14lib/modules: Report a good error when option tree has bare typeRobert Hensing5-1/+54
Note that this removes the possibility of declaring an option named `_type`.
2023-08-14lib.customisation: add uncurried form of makeScopeWithSplicingAdam Joseph2-9/+22
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-13lib/meta.nix: introduce getExe'Sefa Eyeoglu2-6/+21
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-12Merge pull request #247825 from tweag/lib.path-mdSilvan Mosberger1-157/+163
Minor `lib.path` documentation consistency improvements
2023-08-11lib/path/tests: Fix test setup on darwinRobert Hensing1-1/+8
These statements are taken from the `lib/test/release.nix` tests, which previously also worked on darwin. Unblocks https://github.com/NixOS/nix/pull/8569 when backported
2023-08-10Merge pull request #248278 from infinisil/revert-strings-errorSilvan Mosberger1-1/+6
Change `types.string` error to a warning instead
2023-08-10Merge pull request #235625 from ShamrockLee/lib-doc-tidySilvan Mosberger1-2/+2
2023-08-10lib.types.string: Use lib.warn instead of deprecationMessageSilvan Mosberger1-4/+6
This will cause a poorer error message without option location information, but it will catch all uses of its use.
2023-08-10Revert "lib.types.string: Deprecation error instead of warning"Silvan Mosberger1-1/+4
This reverts commit c59c6b1c57da542b6b4af5d2ac27d1b99e7f0c5e. This was a bit too ambitious, because no warnings were previously triggered when `string` was nested e.g. `attrsOf string`, `nullOr string`, etc. Support for nested type deprecation warnings was introduced in 4b54aedee5e05aaf2838f6d951508b83e33d2baa, but had to be reverted in a36e6760e9be0ec260b637a06d751d39e2a78e4e because it caused infinite recursion for some users, and I couldn't remember that it was reverted.
2023-08-08lib.types.string: Deprecation error instead of warningSilvan Mosberger1-4/+1
The type has given a warning on use since [4 years ago](03392cd336b128a1639c648baf0f6c1a1271e0d2), I think it's safe to move the deprecation to the next stage: An error instead of a warning.
2023-08-08lib.path: Add argument docs when missingSilvan Mosberger1-1/+4
2023-08-08lib.path: Indent comments the sameSilvan Mosberger1-146/+150
2023-08-08lib.path: Make documentation more uniformSilvan Mosberger1-27/+26
- Always have a trailing dot after sentences - Link more things - Fix some formatting - Use `append` instead of `+ ("/"`
2023-08-04treewide: update mainProgram docsArtturin1-3/+2
2023-08-04Merge pull request #242695 from tweag/lib.path.subpath.componentsRobert Hensing3-0/+65
`lib.path.subpath.components`: init
2023-08-02Merge pull request #243139 from hercules-ci/modules-test-default-argumentRobert Hensing2-0/+31
lib/tests/modules: Test that _module.args works when a default argume…
2023-07-31lib.getExe: Do not make assumptions about the main programRobert Hensing1-1/+5
Before this commit, getExe assumes that if `meta.mainProgram` is unset, it has a main program that's named after the package name. While this is probable, it leads to a bad error when the assumption does not hold. If the user called `getExe` themselves, they might narrow down the location of the assumption quite easily, but if that's not the case, they'll have to go down the rabbit hole to figure out what went wrong. For example, a NixOS module may use `lib.getExe` on a package-typed option which is then used in the system configuration. This then typically leads to a failure *after* deployment, which is bad, and it's quite likely that the user will debug the package output contents before digging through the NixOS module, which is bad. Furthermore the `getExe` call is rather inconspicuous as it does not contain something like "/bin/foo", which is bad. Also modules can be hard to read for a newbie, which is bad. All of this can be avoided by requiring `meta.mainProgram`. Many packages already have the attribute, and I would expect 80% of `getExe` usages to be covered by 20% of packages, because plenty of packages aren't used with `getExe` anyway. Finally we could make an effort to set `mainProgram` semi-automatically using `nix-index`.
2023-07-28Revert "lib.customisation: uncurry makeScopeWithSplicing"Silvan Mosberger1-14/+8
2023-07-28lib.makeScopeWithSplicing: provide default for keep,extraArtturin1-1/+9
These are often unneeded by the user.
2023-07-27lib.customisation: uncurry makeScopeWithSplicingAdam Joseph1-8/+6
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 switch to attrset-passing form, to provide some minimal level of sanity-checking.
2023-07-27Merge pull request #244358 from tweag/lib.path.partsRobert Hensing2-1/+67
`lib.path.splitRoot`: init
2023-07-27Merge pull request #245271 from sternenseemann/module-system-merge-no-typeRobert Hensing3-1/+29
lib/modules: handle typeless options in mergeModules
2023-07-26lib/modules: handle typeless options in mergeModulessternenseemann3-1/+29
mkOption does not require a `type` argument and does not set the resulting attribute if it is not given. Consequently, we need to be prepared to merge options that have no type information.
2023-07-26lib/path/README.md: Justify returning subpathsSilvan Mosberger1-0/+21
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-07-26lib.path.subpath.components: initSilvan Mosberger2-0/+44
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-26lib.path.subpath.isValid: Add definition of a subpathSilvan Mosberger1-0/+3
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-26lib.path.splitRoot: initSilvan Mosberger2-1/+64
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-26Merge pull request #243520 from tweag/lib.lists.commonPrefixSilvan Mosberger2-29/+124
`lib.lists.{findFirstIndex,commonPrefix}`: init
2023-07-25Merge pull request #244819 from ncfavier/toKeyValue-indentNaïm Favier1-2/+3
lib/generators/toKeyValue: add `indent` parameter