Commit Graph

2446 Commits

Author SHA1 Message Date
Silvan Mosberger
5ae3fb2c38
lib/strings: Add floatToString 2020-07-25 21:43:09 +02:00
John Ericson
5c56778efd
Merge pull request #93568 from aaronjanse/aj-redox
Add Redox OS as a target
2020-07-22 12:56:00 -04:00
Aaron Janse
60fd049b65 redox: add as target 2020-07-21 13:11:36 -07:00
Bas van Dijk
6e7822b8f3 lib: toHex -> toHexString & toBase -> toBaseDigits
This makes the type of these functions more apparent from the name.
2020-07-20 13:14:19 +02:00
Bas van Dijk
00022fbeda lib: add the toHex and toBase utility functions
`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-07-20 13:09:26 +02:00
Jan Tojnar
fb7507d068
Merge pull request #92348 from jtojnar/explicit-only-gpl
licenses: Make single-version-only GPL explicit
2020-07-18 06:48:41 +02:00
Jörg Thalheim
d7e89fa661
commitIdFromGitRepo: fix stackoverflow if many branches are used.
If many branches are created than builtins.match stack overflows because
of a bug in libstdc++: see https://github.com/NixOS/nix/issues/2147
2020-07-17 10:44:08 +01:00
Jan Tojnar
13b5ae55cd
licenses: Make single-version-only GPL explicit
I commonly see people use the former when they should use the latter.

Would be also in line with the SPDX change https://www.gnu.org/licenses/identify-licenses-clearly.html
2020-07-05 17:51:30 +02:00
Ryan Mulligan
73019d65bd
Merge pull request #92049 from r-ryantm/auto-update/libvmaf
libvmaf: 1.5.1 -> 1.5.2
2020-07-02 21:42:45 -07:00
Ryan Mulligan
46e4bc8a7d licenses: add bsd2Patent 2020-07-02 21:18:01 -07:00
Daniël de Kok
d4737c93fc licenses: add LGPL For Linguistic Resources 2020-06-27 23:03:39 -07:00
Maximilian Bosch
c0c786c3bd
Merge pull request #91454 from ConradMearns/obsidian
obsidian: init at 0.7.3
2020-06-28 01:21:21 +02:00
Markus Kowalewski
9143be487b
lib/licenses: add SPDX LLVM-exception 2020-06-27 12:51:13 +02:00
Conrad Mearns
e4172776e7 licences: add Obsidian.md EULA 2020-06-25 02:38:06 +02:00
rnhmjoj
986079275b
lib/attrsets: add getMan function 2020-06-18 10:16:57 +02:00
Pierre Allix
106be3f6fe lib/attrsets: fix typo in the comment of mapAttrsRecursiveCond 2020-06-16 13:48:57 +02:00
Markus Kowalewski
d75a478ff2
licenses: add GNU Free Documentation License v1.1 2020-06-11 18:27:34 +02:00
Frederik Rietdijk
43f71029cc Merge master into staging-next 2020-06-05 19:40:53 +02:00
Eelco Dolstra
8f9e4bef4c
Bump minver.nix to 2.2
Note: NixOS 19.03 had Nix 2.2 and 19.09 had 2.3.
2020-06-04 13:43:10 +02:00
Florian Klink
cfb4d0dfe3
Merge pull request #84032 from teto/fix_kernel_merge
Fix kernel configuration merge
2020-05-22 13:32:22 +02:00
Emily
aff9979170 lib.fake{Sri => Hash}: fix and rename
The previous hash was too short and caused evaluation-time errors like:

    invalid SRI hash 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='

Additionally, since the fact that this is broken implies that nobody
could have been using it, "SRI" is a bit of a vague and obscure term,
`fakeSriHash` would be somewhat of a mouthful, and the relevant fetcher
parameters are just called `hash`, rename it to `fakeHash`.
2020-05-11 23:11:12 +01:00
Jörg Thalheim
885f65fbff
Merge pull request #86074 from emilazy/refactor-linux-hardened-update-script 2020-05-11 10:40:42 +01:00
Emily
d6fe0a4e2d linux/hardened: move files into directory 2020-05-08 15:49:35 +01:00
Drew Mullen
448d68c511 fix example for foldl 2020-05-08 08:31:27 -04:00
Silvan Mosberger
a89b773984
lib/tests: Allow overriding pkgs independent of lib being tested 2020-04-25 23:40:20 +02:00
Pavol Rusnak
461a252bee
verifast: change license to MIT
It seems verifast was relicensed to MIT in 2016:
b3c1bce76a

As this was the only package using lib.licenses.msrla I dropped it.
2020-04-23 09:59:33 +00:00
Timo Kaufmann
166bf2314a
Merge pull request #81210 from B4dM4n/ausweisapp2
ausweisapp2: init at 1.20.0
2020-04-20 22:07:40 +00:00
Fabian Möller
592e433496
licenses: add EUPL-1.2 2020-04-18 23:30:03 +02:00
Pavol Rusnak
2c45fa52a4
lib/licenses: use https where possible 2020-04-18 23:26:44 +02:00
Pavol Rusnak
fadcfc3ea4
treewide: per RFC45, remove more unquoted URLs 2020-04-18 14:04:37 +02:00
Daiderd Jordan
964700da44
lib/options: fix showOption example 2020-04-14 20:38:31 +02:00
Daiderd Jordan
31a03daa72
Revert "lib/options: Use escapeNixIdentifier for showOption"
This is used in in the manual generation for option identifiers that can
be linked. This, unike what the example describes, doesn't preserve
quotes which is needed for these identifiers to be valid.

This reverts commit 124cccbe3b.
2020-04-14 20:34:07 +02:00
Jan Tojnar
c652b64a26
lib/options: Relax showOption quoting
124cccbe3b
broke the build of NixOS manual.

It does not make sense to be as strict as with attributes since we
are not limited by the CLI's inability to handle numbers.
Placeholders should not be quoted either as they are not part of Nix
syntax but a meta-level construct.
2020-04-14 04:49:17 +02:00
Silvan Mosberger
f579564062
lib/maintainer-list: Implement validity checks 2020-04-13 17:28:00 +02:00
Silvan Mosberger
a90d8de242
lib/tests/release.nix: Avoid importing nixpkgs into the store
Improves build time by about a factor of two on my system
2020-04-13 17:27:05 +02:00
Silvan Mosberger
0bc7f3440a
lib/tests/modules.sh: Don't depend on $PWD 2020-04-13 17:27:04 +02:00
Silvan Mosberger
124cccbe3b
lib/options: Use escapeNixIdentifier for showOption 2020-04-13 17:27:04 +02:00
Silvan Mosberger
f9eb3d158a
lib/strings: Introduce escapeNixIdentifier 2020-04-13 17:27:04 +02:00
Michael Reilly
84cf00f980
treewide: Per RFC45, remove all unquoted URLs 2020-04-10 17:54:53 +01:00
Tony Olagbaiye
d2ba3fba69 lib: add shortcut for fake SRI hash 2020-04-05 01:48:20 +01:00
Silvan Mosberger
f75c11cfdf
Merge pull request #83241 from Infinisil/valid-drv-name
lib/strings: Add `sanitizeDerivationName` function
2020-04-02 05:58:13 +02:00
Matthieu Coudron
b9a4e6953d kernel: fix config generation
Addresses https://github.com/NixOS/nixpkgs/issues/71803:
Kernel options are not merged as described, especially the "optional"
aspects. The error silences legitimate warnings.
2020-04-01 22:25:57 +02:00
Konrad Borowski
e69e48a1e4 lib.licenses: Add Unicode License Agreement for Data Files and Software 2020-04-01 13:43:41 +00:00
Silvan Mosberger
4b206ac83b
lib/strings: Add sanitizeDerivationName function 2020-03-30 01:15:30 +02:00
Nathan Smyth
e9bec1adf6
mongodb: 3.4.10 -> 4.0.4
fix: Adding libtool to allow darwin compiles

Libtool seems to be required for mongodb to compile on darwin.

fix: Marking MongoDB as broken on aarch64

fix: Adding libtools to the pkg imports

Update mongodb to 4.0.4
2020-03-26 14:02:48 +01:00
zimbatm
d8f0c5407e
Merge pull request #82929 from zimbatm/nixos-gerrit
nixos gerrit module
2020-03-26 12:47:15 +01:00
zimbatm
10c96e5b60
lib.generators: add toGitINI
This code was taken from the home-manager project.
2020-03-26 09:28:13 +01:00
Emery Hemingway
9f91fa02a6 lib/systems: Add Genode platform definitions
Add platform definitions for 64-bit ARM and x86. This is sufficient for
for building Genode where a toolchain is provided as an overlay.

Toolchain: git+https://git.sr.ht/~ehmry/genodepkgs?rev=14fc773ac9ecd2cbb30cb4612b284eee83d83546
2020-03-24 20:41:21 +05:30
Robert Hensing
1484e1acfe
Merge pull request #83201 from michaelpj/imp/sources-unnamed
cleanSourceWith: don't use baseNameOf
2020-03-24 10:05:32 +01:00
Michael Peyton Jones
07f363fae3
cleanSourceWith: don't use baseNameOf
Currently, not providing `name` to `cleanSourceWith` will use the name
of the imported directory. However, a common case is for this to be the
top level of some repository. In that case, the name will be the name of
the checkout on the current machine, which is not necessarily
reproducible across different settings, and can lead to e.g. cache
misses in CI.

This is documented in the comment on `cleanSourceWith`, but this does
not stop it being a subtle trap for users.

There are different tradeoffs in each case:

1. If `cleanSourceWith` defaults to `"source"`, then we may end up with a
user not knowing what directory a source store path corresponds to.
However, it being called "unnamed" may give them a clue that there is a
way for them to name it, and lead them to the definition of the
function, which has a clear `name` parameter.

2. If `cleanSoureWith` defaults to the directory name, then a user may face
occasional loss of caching, which is hard to notice, and hard to track
down. Tracking it down likely requires use of more advanced tools like
`nix-diff`, and reading the source of a lot of nix code.

I think the downside of the status quo is worse.

This is really another iteration of
https://github.com/NixOS/nix/issues/1305: that led to adding the `name`
argument in the first place, this just makes us use a better default
`name`.
2020-03-23 09:53:07 +00:00
John Ericson
19a0b38cbe
Merge pull request #82882 from obsidiansystems/armv6-embedded
Misc fixes for armv6 bare metal cross
2020-03-19 10:38:22 -04:00
Robert Hensing
9b3515eb95
Merge pull request #82897 from Infinisil/fix-recursive-visible-docs
lib/options: Only recurse into visible sub options
2020-03-19 11:24:57 +01:00
Silvan Mosberger
742e3fc002
lib/tests: Check for nested option-dependent definitions 2020-03-19 03:50:47 +01:00
Silvan Mosberger
9eecf2d057
Revert "lib/modules: Throw better error when definitions assign to an option set"
This reverts commit 15c873b486.

This was causing infinite recursion when depending on nested options
2020-03-19 03:50:15 +01:00
Silvan Mosberger
f195625227
lib/options: Only recurse into visible sub options 2020-03-19 01:13:27 +01:00
John Ericson
7c0d3f6f70 lib: Fix systems test for new armv6l-none 2020-03-18 17:43:11 -04:00
Robert Hensing
5f357b20b3
Merge pull request #82751 from Infinisil/minor-module-improvements
Minor module improvements
2020-03-18 10:06:06 +01:00
Silvan Mosberger
e931de58a2
lib/modules: Fix type checks not being done before merging
Co-Authored-By: Robert Hensing <robert@roberthensing.nl>
2020-03-18 04:38:53 +01:00
Silvan Mosberger
15c873b486
lib/modules: Throw better error when definitions assign to an option set 2020-03-18 04:38:50 +01:00
Robert Hensing
31206e44e1 lib/modules: Test the ability for config to depend on options for compatibility 2020-03-17 20:21:10 +01:00
Silvan Mosberger
dcdd232939
lib/modules: Remove internal _module attribute from config
The _module option is added as an internal option set, and it messes up
the results of module evaluations, requiring people to manually filter
_modules out.

If people depend on this, they can still use config._module from inside
the modules, exposing _module as an explicitly declared user option. Or
alternatively with the _module attribute now returned by evalModules.
2020-03-17 19:19:39 +01:00
Silvan Mosberger
eff447b321
Merge pull request #70157 from teto/lib_kernel
Add lib.kernel
2020-03-12 23:53:42 +01:00
John Ericson
00afca0929 lib: Add armv6l-none to doubles list 2020-03-12 09:56:17 -04:00
Vladimír Čunát
4d543ca048
Merge #81713: lib.callPackages(With): guard against a repeated mistake 2020-03-12 09:41:12 +01:00
Vladimír Čunát
b63f684b3d
lib.callPackages(With): guard against a repeated mistake
For example see the parent commit.
2020-03-12 09:40:15 +01:00
Matthew Bauer
acb24b4cc4 lib/systems: Assume newlib when no kernel and no libc is provided
newlib is the default for most tools when no kernel is provided. Other
exist, but this seems like a safe default.

(cherry picked from commit 8009c20711)
2020-03-12 02:22:19 -04:00
Jan Tojnar
8515b703cf
Merge pull request #72125 from jtojnar/maintainer-groups
lib: Add lib.maintainer-groups
2020-03-10 21:09:33 +01:00
Silvan Mosberger
575354babf
lib/generators: Add toINI option for duplicate keys 2020-03-10 16:01:04 +01:00
Robert Hensing
99a2910733
Merge pull request #80919 from hercules-ci/modules-add-file-context
lib/modules.nix: Add file context to unmerged values in mergeDefinitions
2020-03-05 23:21:02 +01:00
Robert Hensing
e38a01db5d
Merge pull request #68491 from roberth/fix-dontRecurseIntoAttrs
Fix dontRecurseIntoAttrs + add to lib + doc
2020-03-01 11:05:34 +01:00
Robert Hensing
9c0ab2f26d lib/modules.nix: Add file context to unmerged values in mergeDefinitions
This helps with troubleshooting exceptions in config values, which were hard
to track down for options with many definitions.
The trace will look like:

    error: while evaluating the attribute 'config.foo' at undefined position:
    [...]
    while evaluating the option `foo':
    [...]
    while evaluating definitions from `/home/user/mymod.nix':
    while evaluating 'dischargeProperties' at /home/user/nixpkgs/lib/modules.nix:464:25, called from /home/user/nixpkgs/lib/modules.nix:392:137:
    while evaluating the attribute 'value' at /home/user/nixpkgs/lib/modules.nix:277:44:
    Value error!

where the `/home/user/mymod.nix` module is

    { lib, ... }: {
      options.foo = lib.mkOption {
        type = lib.types.lines;
      };
      config.foo = builtins.throw "Value error!";
    }
2020-02-24 00:15:36 +01:00
John Ericson
2682170f21
Merge pull request #80814 from matthewbauer/default-newlib-for-none
lib/systems: Assume newlib when no kernel and no libc is provided
2020-02-22 15:36:03 -05:00
Matthew Bauer
8009c20711 lib/systems: Assume newlib when no kernel and no libc is provided
newlib is the default for most tools when no kernel is provided. Other
exist, but this seems like a safe default.
2020-02-22 12:37:46 -05:00
worldofpeace
2ba2b0cf23 20.09 is Nightingale 2020-02-10 14:14:18 -05:00
Eelco Dolstra
0e6ceb8758
Merge pull request #68897 from edolstra/master
Flake support
2020-02-10 16:44:54 +01:00
Eelco Dolstra
5c389f84d4 lib/tests/misc.nix: Don't make a copy on Nixpkgs 2020-02-10 16:21:04 +01:00
Eelco Dolstra
a274da605d lib/tests/misc.nix: Fix dependency on currentSystem
This doesn't work in pure mode.
2020-02-10 16:20:41 +01:00
worldofpeace
1193468f13 Merge pull request #79291 from chkno/remove-isArm
Remove isArm
2020-02-08 09:57:30 -05:00
Chuck
5d4821141b stdenv: Remove isArm (use isAarch32 instead)
isArm has been deprecated for three releases.  All references have been
removed.  Tree-wide substitution was performed in #37401 21 months ago.
2020-02-05 10:56:14 -08:00
Chuck
a7835b936e lib.systems.elaborate: isArm -> isAarch32
This is the last reference to isArm.  isArm is deprecated after 18.03.
This substitution was performed tree-wide in #37401.
2020-02-05 10:56:14 -08:00
Frederik Rietdijk
419bc0a4cd Revert "Revert "Merge master into staging-next""
In 87a19e9048 I merged staging-next into master using the GitHub gui as intended.
In ac241fb7a5 I merged master into staging-next for the next staging cycle, however, I accidentally pushed it to master.
Thinking this may cause trouble, I reverted it in 0be87c7979. This was however wrong, as it "removed" master.

This reverts commit 0be87c7979.
2020-02-05 19:41:25 +01:00
Frederik Rietdijk
0be87c7979 Revert "Merge master into staging-next"
I merged master into staging-next but accidentally pushed it to master.
This should get us back to 87a19e9048.

This reverts commit ac241fb7a5, reversing
changes made to 76a439239e.
2020-02-05 19:18:35 +01:00
Robert Helgesson
fc3bd1aeb9
lib/strings: fix comment typo 2020-02-05 18:09:37 +01:00
Profpatsch
07eb21ceaf
Merge pull request #78337 from Profpatsch/lib-improve-cli-module
lib: improve cli module
2020-01-24 21:05:53 +01:00
Franz Pletz
402b97fa1e
Merge pull request #78058 from mayflower/nixos/version-gitdir-symlink
nixos/version: fix case where .git is a symlink
2020-01-24 14:58:31 +00:00
Profpatsch
7228a3c0bc lib/cli: mkKey -> mkOptionName, use generators.mkValueStringDefault
Let’s call them by what they are, option names.

`generators.mkValueStringDefault` is a better value string renderer
than plain `toString`.

Also add docs to all options.
2020-01-23 14:47:38 +01:00
Profpatsch
18520b7f36 lib/generators: floats are not supported in mkValueStringDefault
They are cut off after a few decimal places; we cannot in good faith
define a default string representation with that.
2020-01-23 14:47:38 +01:00
Profpatsch
e71e1be859 lib/cli: rename renderX options to mkX
Mirrors the naming scheme in `generators.nix`, for consistency.

Also rename `key` to `k` and value to `v` to aid readability to the
code structure.
2020-01-23 14:47:38 +01:00
Profpatsch
b2654c226a lib/cli,lib/tests/misc: somewhat more standard formatting 2020-01-23 14:47:38 +01:00
Profpatsch
582354d3b6 lib/cli: encodeGNUCommandLine -> toGNUCommandLineShell
The semantic difference between `encode` and `to` is not apparent.
Users are likely to confuse both functions (which leads to unexpected
error messages about the wrong types). Like in `generators.nix`, all
functions should be prefixed by `to`.

Furthermore, converting to a string depends on the target context. In
this case, it’s a POSIX shell, so we should name it that (compare
`escapeShellArg` in `strings.nix`).

We can later add versions that escape for embedding in e.g. python
scripts or similar.
2020-01-23 14:47:38 +01:00
Profpatsch
88a7f65c83 lib/cli: unexport symbols & sort with generators
lib/cli is very similar to generators, so it should follow largely the
same interface. Similar to how generators isn’t exported, we should
also namespace cli by default (plus “cli” is only three characters to
type).
2020-01-23 14:47:38 +01:00
Anderson Torres
45b400880a
Merge pull request #77855 from AndersonTorres/update/notion
notion: 3-2017050501 -> 3-2019050101
2020-01-22 07:46:22 -03:00
Silvan Mosberger
774e3d8e48
nixos/lib: Inherit type for doRename options (#78135)
nixos/lib: Inherit type for doRename options
2020-01-20 23:15:24 +01:00
Silvan Mosberger
74775d1d72
lib/attrsets: Fix error in comment for getAttrFromPath 2020-01-20 22:42:38 +01:00
Janne Heß
790cd012d0
nixos/lib: Inherit type for doRename options
Co-authored-by: Silvan Mosberger <contact@infinisil.com>
2020-01-20 22:06:20 +01:00
Franz Pletz
46773a15b3
nixos/version: fix case where .git is a symlink
Before c9214c394b and
9d396d2e42 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-20 00:53:44 +01:00
AndersonTorres
bdf32f33fa Notion custom license: exclude 2020-01-17 08:31:22 -03:00
Silvan Mosberger
3c2e9fa53d
Merge pull request #77704 from mayflower/also-submodules
lib.commitIdFromGitRepo: fix support for git-submodule
2020-01-16 00:44:46 +01:00
Drew Hess
370efefd8c
Replace short URL from #63103 with full URL.
The error message is already helpfully verbose, so there's little
reason to shorten the informational URL.
2020-01-15 13:47:49 +00:00
elseym
9d396d2e42
lib.commitIdFromGitRepo: fix support for git-submodule
Adds handling for relative references from .git-files, fixing a bug introduced by c9214c394b.
2020-01-14 21:08:38 +01:00