about summary refs log tree commit diff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
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
2023-07-24Merge pull request #244330 from thillux/bluefield2-remove-cpuAdam Joseph1-1/+0
lib.systems.bluefield2: remove cpu profile
2023-07-23Merge pull request #242035 from Icy-Thought/zsh-abbrSandro1-0/+7
zsh-abbr: init at 5.1.0
2023-07-22lib/generators/toKeyValue: add `indent` parameterNaïm Favier1-2/+3
toKeyValue is generic enough that it is sometimes used as part of other format generators, where it might be useful to specify the indentation level.
2023-07-20lib.lists.commonPrefix: initSilvan Mosberger2-1/+60
2023-07-20Merge pull request #244118 from amjoseph-nixpkgs/pr/fix/244045Adam Joseph1-5/+6
lib.systems.extensions.sharedLibrary: do not `throw`
2023-07-19lib.lists.findFirstIndex: initSilvan Mosberger2-28/+64
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-19Merge pull request #238013 from tweag/lib.path.removePrefixRobert Hensing2-1/+71
`lib.path.removePrefix`: init
2023-07-19Merge pull request #244044 from tweag/lib-readmeRobert Hensing5-6/+107
Create a Readme in `lib`
2023-07-19lib.systems.bluefield2: remove cpu profileMarkus Theil1-1/+0
Some software, e.g. systemd, failed to build with set cpu profile. Signed-off-by: Markus Theil <theil.markus@gmail.com>
2023-07-18lib.attrsets.mergeAttrsList: initSilvan Mosberger2-0/+61
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-18lib/tests: Unify documentation of individual testable filesSilvan Mosberger4-6/+34
2023-07-18lib: Add READMESilvan Mosberger1-0/+73
Co-authored-by: Alexander Groleau <alex@proof.construction> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io> Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-07-14lib.systems.bluefield2: initMarkus Theil2-0/+12
Add support for Nvidia's Bluefield 2 plattform as a compilation target. There exists a version with and without crypto support, while the crypto supported version is the most common one. Support for the non-crypto version can be easily added in the future, if needed. For a datasheet of the hardware, see: https://www.nvidia.com/content/dam/en-zz/Solutions/Data-Center/documents/datasheet-nvidia-bluefield-2-dpu.pdf Signed-off-by: Markus Theil <theil.markus@gmail.com>
2023-07-12Merge pull request #238154 from amjoseph-nixpkgs/pr/gcc/crossStageStaticAdam Joseph1-1/+20
gccCrossStageStatic: enable dynamic libraries, rename it
2023-07-12lib/tests/modules: Test that _module.args works when a default argument is setRobert Hensing2-0/+31
2023-07-11lib.mergeModules: Add context to error messageRobert Hensing2-2/+5
2023-07-11lib/modules.nix: FormatRobert Hensing1-19/+28
2023-07-11lib/modules.nix: Inline single-use `subtree` bindingsRobert Hensing1-4/+4
2023-07-11lib/modules.nix: Make entire definition list strict in config checkRobert Hensing1-24/+21
This is a non-trivial refactor that slightly changes the semantics of the internal definition lists. Whereas previously only individual list items would trigger the exception, now the error is promoted to the whole list. This is mostly ok, because we compute the value, it is wrong to ignore a definition. However, we don't always compute the value. For instance `readOnly` only needs to count definitions. That won't be possible anymore when the error is raised for one of the items. As a consequence, an error will be raised for the errant definition instead of the number of definitions.
2023-07-11lib/modules.nix: Rename defnsByName -> pushedDownDefinitionsByNameRobert Hensing1-2/+2
2023-07-11lib/modules.nix: Rename defnsByName' -> rawDefinitionsByNameRobert Hensing1-3/+3
2023-07-11lib/modules.nix: Apply argument `module` of old fRobert Hensing1-9/+9
2023-07-11lib/modules.nix: Apply argument `modules` of old old old byNameRobert Hensing1-6/+6
2023-07-11lib/modules.nix: Apply argument `f` of old old byNameRobert Hensing1-15/+21
2023-07-11lib/modules.nix: Apply argument `attr` of old byNameRobert Hensing1-31/+15
2023-07-11lib/modules.nix: Inline byNameRobert Hensing1-27/+43
byName is not an abstraction. This is the first commit in a series that refactors it away.
2023-07-10lib.path.removePrefix: initSilvan Mosberger2-1/+71
2023-07-08doc: Render lib.fixedPointsRobert Hensing1-81/+115
2023-07-07licenses: add Hippocratic License v3.0Icy-Thought1-0/+7
2023-07-05Merge pull request #240825 from r-burns/mips-embeddedRyan Burns3-2/+12
lib.platforms.mips{,64}-embedded: init
2023-07-05Merge pull request #241645 from ncfavier/lib-no-hashesNaïm Favier2-6/+6
lib/tests: invalidate hashes
2023-07-05lib/tests: invalidate hashesNaïm Favier2-6/+6
Having the current bash hash present in the nixpkgs tree makes Nix detect bash as a runtime dependency of nixpkgs, which in turns messes up `fetchFromGitHub` due to https://github.com/NixOS/nix/issues/6660
2023-07-05Merge pull request #239120 from LibreCybernetics/arch-stuffArtturi1-11/+28
2023-07-04lib.systems.extensions.sharedLibrary: do not `throw`Adam Joseph1-5/+6
Because downstream code expects to use `==` on platform attrsets, we are unfortunately not able to throw a useful error message when the `sharedLibrary` attribute is accessed. When users do a comparison like: stdenv.hostPlatform == pkgsStatic.stdenv.hostPlatform ... in a situation where `stdenv.hostPlatform.hasSharedLibraries`, they expect this to return `false`. Unfortunately Nix does a deep equality comparison here, and ends up forcing the `pkgsStatic.stdenv.hostPlatform.extensions.sharedLibrary` attribute, which throws the error. Rather than returning `null`, this commit instead simply omits the `extensions.sharedLibrary` attribute. This provides the user with a more-useful error message: instead of waiting until the `null` is used (and hoping that produces an error), the user will get an error about the `extensions.sharedLibrary` attribute being missing, at the position where it was referenced. Big thanks to @trofi for his PR to add `NIX_VALIDATE_EVAL_NONDETERMINISM` to Nix, which I am now using. It made tracking this down really easy! Fixes #244045
2023-07-04Merge pull request #240555 from Artturin/iniglobsecneedArtturi1-1/+1