about summary refs log tree commit diff
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2021-09-17lib.cleanSource: ignore socketsAlyssa Ross1-1/+3
I'm working on a project that involves running a virtual machine monitor program, which creates a control socket in the project directory (because it doesn't make sense to put it anywhere else). This obviously isn't part of the source of my program, so I think cleanSource should filter it out.
2021-09-12lib.generators.toINI: serialize derivations to stringzimbatm1-0/+2
This is the common case when passing a derivation, we want to access the store path.
2021-09-12lib.generators.toGitINI: don't traverse derivationszimbatm1-1/+1
Consider a derivation a value to be serialized. nix-repl> lib.generators.toGitINI { hello = { drv = pkgs.hello; }; } error: evaluation aborted with the following error message: 'generators.mkValueStringDefault: attrsets not supported: <derivation /nix/store/533q15q67sl6dl0272dyi7m7w5pwkkjh-hello-2.10.drv>' Fixes #137390
2021-09-09lib/systems: add minimal s390x-linux cross-compile supportSergei Trofimovich5-3/+10
Tested basic functionality as: $ nix-build --arg crossSystem '{ config = "s390x-unknown-linux-gnu"; }' -A re2c $ file ./result/bin/re2c $ ./result/bin/re2c: ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV), dynamically linked, interpreter ...-gnu-2.33-50/lib/ld64.so.1, for GNU/Linux 2.6.32, not stripped $ qemu-s390x ./result/bin/re2c --version re2c 2.2
2021-08-26lib/strings: fix infinite recursion on concatStringsSep fallbackpolykernel1-1/+1
The current implementation of the concatStringsSep fallback references concatStrings whcih is just a partial application of concatStringsSep, forming a circular dependency. Although this will almost never be encountered as (assuming the user does not explicitly trigger it): 1. the or operator will short circuit both in lazy and strict evaluation 2. this can only occur in Nix versions prior to 1.10 which is not compatible with various nix operations as of 2.3.15 However it is still important if scopedImport is used or the builtins have been overwritten. lib.foldl' is used instead of builtins.foldl' as the foldl' primops was introduced in the same release as concatStringsSep.
2021-08-26Merge pull request #135794 from shlevy/composeManyFlakeCompatRobert Hensing1-5/+5
lib.compose{Many,}Extensions: Make compatible with nix flake check
2021-08-26replace dead linksPaul-Nicolas Madelaine1-2/+2
2021-08-26lib.compose{Many,}Extensions: Make compatible with nix flake checkShea Levy1-5/+5
2021-08-23lib: optimize setAttrByPath and cleaup importspolykernel1-6/+9
- Remove inheritance of `lists.fold` as it isn't used anywhere. - Inherit `foldl'` for consistency as only `cartesianProductOfSets` explicitly reference lib. - Inline `foldr` to generate nested attrs instead of using `listToAttrs` and `tail`.
2021-08-22lib: export strings/escapeRegexHarrison Houghton1-1/+1
I see no reason why I should be disallowed from using it.
2021-08-21Merge pull request #134763 from r-burns/fix-scalewayLuke Granger-Brown1-1/+1
lib/systems: fix scaleway-c1 platform
2021-08-19lib.systems.inspect.patterns.isGnu: initAlyssa Ross1-0/+1
This allows checking e.g. stdenv.hostPlatform.isGnu, just like isMusl or isUClibc. It was already possible to check for glibc with stdenv.hostPlatform.libc == "glibc", but when that doesn't line up with how every other platform check works, this is apparently sufficiently non-obvious that we've ended up with stuff like adding glibc.static if !isMusl, which is obviously wrong.
2021-08-18lib/systems: fix scaleway-c1 platformRyan Burns1-1/+1
This regressed in 9c213398b312e0f0bb9cdf05090fd20223a82ad0 The recursiveUpdate gave the platform both gcc.cpu and gcc.arch attrs instead of only gcc.cpu. This is invalid; gcc configuration fails with: ``` Switch "--with-arch" may not be used with switch "--with-cpu" ``` So we revert to using `//` to retain only gcc.cpu (which is more specific than the processor arch).
2021-08-18lib: inherit mkImageMediaOverridelassulus1-1/+1
2021-08-17Merge pull request #132583 from ↵Lassulus1-0/+1
blaggacao/fix/soft-force-the-file-system-layout-for-boot-media nixos/boot-media: soft-force entire fs layout
2021-08-15treewide: runCommandNoCC -> runCommandRobert Hensing2-3/+3
This has been synonymous for ~5y.
2021-08-14Fix import path.Victor Borja1-1/+1
Trying to create a simple flake with input: ``` { inputs.nixpkgs-lib.url = "github:NixOS/nixpkgs?dir=lib"; outputs = {nixpkgs-lib, ...}: { }; } ``` Fails when trying to evaluate the nixpkgs-lib flake with an error like: ``` error: getting status of '/nix/store/xxxx-source/lib/lib': No such file or directory (use '--show-trace' to show detailed location information) ```
2021-08-13Merge pull request #133508 from Infinisil/toPretty-no-drvPathRobert Hensing1-1/+1
lib.generators: Handle no drvPath in toPretty
2021-08-11Merge pull request #130862 from Atemu/licenses-redistributable-attrKevin Cox1-140/+158
lib.licenses: cleanup, consistency and redistributable attribute
2021-08-11lib.licenses: mark a few unfree redistributable licenses as suchAtemu1-0/+6
I'm sure there are more but it's not feasible for a single person to check all of them
2021-08-11lib.licenses: introduce `redistributable` attributeAtemu1-0/+2
Allows for distinction of licenses that are unfree overall but do grant the right to redistribute. Defaults to the freeness of the license. Note: Many unfree but are redistributable licenses aren't marked as such. I expect that to be fixed in a distributed manner over time. Closes https://github.com/NixOS/nixpkgs/pull/97789
2021-08-11lib.licenses: make all licenses have `free` and `deprecated` attrsAtemu1-1/+3
This makes them consistent which eases more complex operations on licenses such as filtering etc.
2021-08-11lib.licenses: refactor common attribute applicationAtemu1-140/+148
This is cleaner and makes common attribute application more expandable
2021-08-11lib.generators: Handle no drvPath in toPrettySilvan Mosberger1-1/+1
Previously, if a derivation without a `drvPath` was handled, an error would be thrown: nix-repl> lib.generators.toPretty {} { type = "derivation"; } error: attribute 'drvPath' missing, at /home/infinisil/src/nixpkgs/lib/generators.nix:251:24 With this commit it doesn't anymore: nix-repl> lib.generators.toPretty {} { type = "derivation"; } "<derivation ???>" This matches what `nix repl` outputs: nix-repl> { type = "derivation"; } «derivation ???»
2021-08-10lib/options: Better mergeEqualOption error for uncomparable typesSilvan Mosberger1-1/+2
For an option definition that uses `lib.options.mergeEqualOption` underneath, like `types.anything`, an error is thrown when multiple functions are assigned, indicating that functions can't be compared for equivalence: error: The option `test' has conflicting definition values: - In `xxx': <function> - In `xxx': <function> (use '--show-trace' to show detailed location information) However, the error message didn't use the correct files. While above error indicates that both definitions are in the xxx file, that's in fact not true. Above error was generated with options.test = lib.mkOption { type = lib.types.anything; }; imports = [ { _file = "yyy"; test = y: y; } { _file = "xxx"; test = x: x; } ]; With this change, the error uses the correct file locations: error: The option `test' has conflicting definition values: - In `xxx': <function> - In `yyy': <function> (use '--show-trace' to show detailed location information)
2021-08-03lib/modules: add mkImageMediaOverrideDavid Arnold1-0/+1
so the underlaying use case of the preceding commit is so generic, that we gain a lot in reasoning to give it an appropriate name. As the comment states: image media needs to override host config short of mkForce
2021-08-04Merge pull request #131267 from blaggacao/fix-functionArgsSilvan Mosberger2-1/+14
lib: fix functionArgs for functors
2021-08-03lib: fix functionArgs for functorsDavid Arnold2-1/+14
`functionArgs` should give valid results on functions that have been identified with `lib.isFunction` instead of erroring out.
2021-08-01lib.systems: add m68k-netbsd supportAlyssa Ross3-6/+7
m68k was recently added for Linux and none, but NetBSD also supports m68k. Nothing will build yet, but I want to make sure we at least encode the existence of NetBSD support for every applicable architecture we support for other operating systems.
2021-08-01lib.systems.doubles: re-sortAlyssa Ross1-6/+6
These were alphabetically sorted until m68k and s390 were added.
2021-07-30lib/systems/platforms: armv7l-hf-multiplatform: fix kernel buildBen Wolsieffer1-0/+6
autoModules triggers a build system bug where ks8851_mll needs to be built-in if ks8851 is also built-in.
2021-07-27Merge pull request #110742 from siraben/deprecate-foldBen Siraphob3-10/+10
2021-07-25Initial implementation of s390 cross-compileBen Siraphob5-3/+11
2021-07-24Merge pull request #131310 from siraben/m86k-crossJohn Ericson5-2/+11
Initial implementation of m68k cross-compile
2021-07-24Initial implementation of m68k cross-compileBen Siraphob5-2/+11
2021-07-23Merge pull request #128032 from Artturin/add-swap-optionsRobert Hensing1-0/+7
nixos/swap: add options option
2021-07-20lib/types.nix: add nonEmptyStrArtturin1-0/+7
2021-07-18Merge pull request #124353 from hercules-ci/small-enum-descriptionRobert Hensing1-1/+11
lib.types.enum: Improve description for lengths 0 and 1
2021-07-12lib.mkFixStrictness: DeprecateRobert Hensing2-4/+2
2021-07-12Partially revert "lib/modules: Drop mkStrict and mkFixStrictness"Robert Hensing2-2/+6
mkFixStrictness was never properly deprecated and should only be removed after warning for some time. This partially reverts commit 8fb9984690c878fcd768e967190957441de05d11.
2021-07-04strings.nix: Fix overly monomorphic type signature commentsNiklas Hambüchen1-2/+2
These functions work on lists of anything, not just lists of strings.
2021-06-28Merge pull request #124875 from hercules-ci/lib-sourcesRobert Hensing3-17/+163
lib.sources: docs, tests, refactoring
2021-06-23Merge master into staging-nextgithub-actions[bot]2-6/+2
2021-06-23Merge pull request #125991 from helsinki-systems/drop/mkStrictSilvan Mosberger2-6/+2
lib/modules: Drop mkStrict and mkFixStrictness
2021-06-22Merge branch 'master' into staging-nextMartin Weinelt1-1/+1
2021-06-20treewide: use quotes for urlPavol Rusnak1-1/+1
2021-06-12mesaPlatforms: Welcome riscv64-linux to the familyZhaofeng Li1-1/+1
2021-06-07Merge pull request #125942 from musfay/rlottietomberek1-0/+5
rlottie: 0.1 -> 0.2
2021-06-06lib/modules: Drop mkStrict and mkFixStrictnessJanne Heß2-6/+2
This was deprecated in 2014 and is not used anywhere in the tree.
2021-06-06lib.systems.parsed: add "elf" for some NetBSD archsAlyssa Ross1-1/+13
In Autoconf, some old NetBSD targets like "i686-unknown-netbsd" are interpreted as a.out, not elf, and virtually nothing supports it. We need to specify e.g. "i686-unknown-netbsdelf" to get the right behaviour.