Commit graph

2689 commits

Author SHA1 Message Date
Jan Tojnar 61cf52bc17
Merge pull request #77501 from jtojnar/more-loaof-fxes
tree-wide: fix more warning related to loaOf deprecation
2020-01-12 18:47:34 +01:00
Robert Hensing 9884cb3ed0
Merge pull request #76861 from Infinisil/paths-as-submodules
lib/types: Allow paths as submodule values
2020-01-12 14:19:04 +01:00
Jan Tojnar 13633bd21a
lib/types: improve loaOf message even more
Now we suggest correct names for all options in Nixpkgs and also home-manager at the time of writing.
2020-01-11 15:02:57 +01:00
Jan Tojnar 6fc46fbb17
lib/types: only show ... in loaOf warning when necessary 2020-01-11 13:32:30 +01:00
Jan Tojnar b0c2c96cbe
lib/types: improve loaOf warning
Not all modules use name attribute as the name of the submodule, for example,
environment.etc uses target. We will need to maintain a list of exceptions.
2020-01-11 08:56:29 +01:00
elseym c9214c394b
lib.commitIdFromGitRepo: support git-worktree
lib.commitIdFromGitRepo now resolves the refs from the
parent repository in case the supplied path is a file
containing the path to said repository. this adds support
for git-worktree and things alike. see gitrepository-layout(5).

this also:
- adds a new boolean function lib.pathIsRegularFile to
  check whether a path is a regular file
- patches lib.revisionWithDefault and
  the revision and versionSuffix attributes in
  config.system.nixos in order to support git-worktrees
2020-01-10 22:29:48 +01:00
Frederik Rietdijk 348eaa280b Merge master into staging-next 2020-01-10 18:32:07 +01:00
Silvan Mosberger 9e97e64847
lib/modules: Switch _module.args from attrsOf to lazyAttrsOf 2020-01-10 16:20:31 +01:00
Silvan Mosberger ab10e87414
lib/tests: Add tests for attrsOf and lazyAttrsOf 2020-01-10 16:20:31 +01:00
Silvan Mosberger b48717d1eb
lib/types: Introduce lazyAttrsOf
The standard attrsOf is strict in its *values*, meaning it's impossible to
access only one attribute value without evaluating all others as well.
lazyAttrsOf is a version that doesn't have that problem, at the expense
of conditional definitions not properly working anymore.
2020-01-10 16:19:55 +01:00
Silvan Mosberger 4268b4f9cf
lib/types: Add emptyValue attribute to types
Co-Authored-By: Robert Hensing <roberth@users.noreply.github.com>
2020-01-10 16:19:54 +01:00
Silvan Mosberger 130a0c9878
lib/modules: Move the isDefined check into mergedValue
Without this change, accessing `mergedValue` from `mergeDefinitions` in
case there are no definitions will throw an error like

  error: evaluation aborted with the following error message: 'This case should never happen.'

This change makes it throw the appropriate error

  error: The option `foo' is used but not defined.

This is fully backwards compatible.
2020-01-10 16:19:54 +01:00
Silvan Mosberger 092107cdc1
lib/tests: Fix module tests
Fix the broken test in https://github.com/NixOS/nixpkgs/pull/77416

Apparently hydra uses `nix-build lib/tests/release.nix` to run all
tests, where IFD isn't allowed. Fortunately we can get around this with
builtins.toFile, which doesn't require IFD, but still can test the
properties we want.
2020-01-10 16:02:36 +01:00
Frederik Rietdijk 5ad16cb27f Merge master into staging-next 2020-01-10 10:34:04 +01:00
Silvan Mosberger 2955e6bd26
lib/tests: Add test case for imports from derivations 2020-01-10 04:13:28 +01:00
Silvan Mosberger e0ea5f4d9b
lib/modules: Fix store imports
This fixes imports from the store not being possible, which was caused by
https://github.com/NixOS/nixpkgs/pull/76857

E.g. such a case:

  imports = [ "${home-manager}/nixos" ];
2020-01-10 04:13:28 +01:00
Silvan Mosberger e9c16ec186
Merge pull request #76857 from Infinisil/recursive-disableModules
Apply `disabledModules` recursively
2020-01-09 18:20:12 +01:00
Silvan Mosberger b89b23b6b2
lib/tests: Add tests for recursive disabledModules 2020-01-09 17:26:08 +01:00
Silvan Mosberger de5f73d434
lib/modules: Recursive disabledModules
With this change, disabledModules applies recursively, meaning if you
have a module "foo.nix" with

    imports = [ ./bar.nix ];

then setting

  disabledModules = [ "foo.nix" ];

will disable both "foo.nix" and "bar.nix", whereas previously only
"foo.nix" would be disabled.

This change along with https://github.com/NixOS/nixpkgs/pull/61570 allows
modules to be fully disabled even when they have some `mkRenamedOption`
imports.
2020-01-09 17:26:05 +01:00
Silvan Mosberger 6525da6321
lib/types: Allow paths as submodule values 2020-01-08 23:54:45 +01:00
Vladimír Čunát 5c780036c5
Merge branch 'master' into staging-next
The nss rebuild isn't so small.
2020-01-08 22:48:13 +01:00
Silvan Mosberger b46776d14e
Clarify error message of 'assigning to top-level attribute' (#76702)
Clarify error message of 'assigning to top-level attribute'
2020-01-08 17:36:43 +01:00
Frederik Rietdijk a823616723 Merge master into staging-next 2020-01-07 20:06:22 +01:00
Silvan Mosberger 65872f407e
Merge pull request #77133 from Infinisil/fix-path-check
lib/types: Fix path type check
2020-01-07 16:43:50 +01:00
Silvan Mosberger d7a109b59f
lib/types: Fix path type check
Previously when this function was called without a value coercible to a
string it would throw an error instead of returning false. Now it does.

As a result this now allows the use of a type like `either path attrs`
without it erroring out when a definition is an attribute set.

The warning about there not being a isPath primop was removed because
this is not the case anymore, there is builtins.isPath. But also there
always was `builtins.typeOf x == "path"` that could've been used
instead. However the path type now stands for more than just path types,
but absolute paths in general.
2020-01-06 22:09:56 +01:00
rnhmjoj 03309899eb lib/types: warn loaOf is deprecated 2020-01-06 10:39:19 -05:00
rnhmjoj cde46494c6 lib/tests: remove strictly loaOf tests and rebase on attrsOf 2020-01-06 10:39:19 -05:00
Gabriel Gonzalez a46679facd
Export toGNUCommandLine
... as suggested by @roberth

Co-Authored-By: Robert Hensing <roberth@users.noreply.github.com>
2020-01-05 14:44:42 -08:00
Gabriel Gonzalez 6d584c2614 Factor out a toGNUCommandLine utility
... as suggested by @roberth
2020-01-05 13:03:00 -08:00
Arnout Engelen 43ef3a8d00 lib/modules: clarify error message of 'assigning to top-level attribute'
If I understand correctly, the problem isn't so much that you're assigning to
that top-level attribute, but that the assignment to the attribute (or any
child of the attribute) introduces the 'config' object and prevents 'lifting'
all settings to a generated 'config' object.
2020-01-05 10:22:32 +01:00
Matthew Bauer 04000331c1
Merge pull request #74284 from matthewbauer/ios-with-xcode-11
Update iOS for XCode 11
2020-01-03 15:35:41 -05:00
Matthew Bauer 9c1a2ac51e Merge remote-tracking branch 'origin/master' into ios-with-xcode-11 2020-01-03 15:34:20 -05:00
Matthew Bauer 010d2f4aa2 lib/systems: use newer ios sdk 2020-01-03 15:20:54 -05:00
Silvan Mosberger be3f887ac4
lib/tests: Temporarily disable submodule path test
Until https://github.com/NixOS/nixpkgs/pull/76861 or so is merged
2020-01-03 06:02:55 +01:00
Silvan Mosberger c7ade6844f
Revert "lib/types: Allow paths as submodule values"
This reverts commit eec83d41e3.

This broke hydra evaluation because with this commit submodule values
are allowed to be paths, however the certmgr module uses `either
(submodule ...) path` in its type, meaning it already used paths for
something else which would now be interpreted as a submodule.
2020-01-03 05:21:01 +01:00
Silvan Mosberger cdf79db19d
Module system improvements for NixOS as a submodule (#75031)
Module system improvements for NixOS as a submodule
2020-01-02 20:38:45 +01:00
Silvan Mosberger cc81320a46
lib/tests: Add submoduleWith tests 2020-01-02 09:59:35 +01:00
Silvan Mosberger eec83d41e3
lib/types: Allow paths as submodule values 2020-01-02 09:59:35 +01:00
Silvan Mosberger 5414b4018b
lib/modules: Don't pack submodules specially
This has the beneficial side effect of allowing paths to be used as modules in
types.{submodule,submoduleWith}
2020-01-01 01:13:03 +01:00
Silvan Mosberger 5002e6afbc
lib/types: Add types.submoduleWith for more flexibility than types.submodule 2020-01-01 01:13:01 +01:00
Gabriel Gonzalez 5edd4dd44c Use a more realistic example that exercises all encodings
... as suggested by @roberth

This also caught a bug in rendering lists, which this change also fixes
2019-12-15 08:21:41 -08:00
Gabriel Gonzalez 693096d283 Make behavior of encodeGNUCommandLine customizable
... based on feedback from @edolstra
2019-12-13 18:25:52 -08:00
Gabriel Gonzalez 8c6a05c8c9 Rename renderOptions to encodeGNUCommandLine
... as suggested by @edolstra
2019-12-13 18:19:24 -08:00
Gabriel Gonzalez 183a99734f Add pkgs.lib.renderOptions
This adds a new utility to intelligently convert Nix records to
command line options to reduce boilerplate for simple use cases and to
also reduce the likelihood of malformed command lines
2019-12-11 16:30:05 -08:00
Silvan Mosberger 3cc77ce756
lib/modules: Make unifyModuleSyntax fully idempotent
Because why not
2019-12-05 05:51:44 +01:00
Silvan Mosberger aa613427b7
lib/modules: file -> _file for a more idempotent unifyModuleSyntax
This will be useful for doing more complicated module evaluations
2019-12-05 05:51:44 +01:00
John Ericson 80524db331 Merge branch 'ghcjs-cross-without-cc-19.09' into ghcjs-cross-without-cc 2019-11-25 14:11:18 +00:00
John Ericson 765d2608b6 Fix lib tests
js-ghcjs didn't fit in an existing categor.
2019-11-25 14:09:50 +00:00
John Ericson 6bc456c91c Merge remote-tracking branch 'upstream/master' into ghcjs-cross-without-cc 2019-11-25 00:23:07 +00:00
John Ericson c739c420db Add support for cross compiling to js-ghcjs
This platform doesn't have a C compiler, and so relies and the changes
in the previous commit to work.
2019-11-25 00:12:38 +00:00
John Ericson 814f9104d7
Merge pull request #72657 from cleverca22/vc4
Initial implementation of vc4 cross-compile
2019-11-24 16:04:15 -05:00
John Ericson d0d5136cce Merge remote-tracking branch 'upstream/master' into wrapper-pname-support 2019-11-24 17:25:07 +00:00
John Ericson 84a105254d lib: Add getName to mirror getVersion 2019-11-24 16:24:50 +00:00
Jan Tojnar 10ac558ca1
lib: Add lib.teams
Also add a freedesktop maintainer group as an example.
2019-11-23 00:07:28 +01:00
Michael Bishop 4aa1ffae04
initial implementation of vc4 cross-compile 2019-11-19 22:19:15 -04:00
John Ericson 16f0fe7fe3 Merge remote-tracking branch 'upstream/master' into mingw-mcfthreads 2019-11-11 20:48:14 -05:00
John Ericson 91718534f1 lib: Switch to w64 vendor for MinGW
It is needed for the `-municode` flag, supposedly.
2019-11-11 00:25:24 -05:00
Matthew Bauer 46f1daead7
Merge pull request #72727 from oxalica/mips-parse
lib.systems: handle mips family properly
2019-11-06 10:24:05 -05:00
Chuck 4ded9beea2 Add note: Keep error message in sync with nixos-option 2019-11-04 15:11:45 +01:00
oxalica c98da73802
lib.systems: remove redundant mapping 2019-11-04 12:13:30 +08:00
oxalica 955d032b47
lib.systems: handle mips family properly 2019-11-03 22:10:06 +08:00
Silvan Mosberger 1230fc8674
Merge pull request #67809 from Infinisil/propagate-override-args
lib.makeOverridable: Propagate function arguments
2019-10-22 14:37:40 +02:00
Profpatsch 8252861507 lib/trivial: add pipe function
`pipe` is a useful operator for creating pipelines of functions.

It works around the usual problem of e.g. string operations becoming
deeply nested functions.

In principle, there are four different ways this function could be
written:

pipe val [ f1 .. fn ]
pipe val [ fn .. f1 ]
compose [ f1 .. fn ] val
compose [ fn .. f1 ] val

The third and fourth form mirror composition of functions, they would
be the same as e.g. `(f1 << f2 << f3 .. << fn) val`.
However, it is not clear which direction the list should have (as one
can see in the second form, which is the most absurd.

In order not to confuse users, we decide for the most “intuitive”
form, which mirrors the way unix pipes work (thus the name `pipe`).
The flow of data goes from left to right.

Co-Authored-By: Silvan Mosberger <infinisil@icloud.com>
2019-10-21 13:19:16 +02:00
Silvan Mosberger 2b1e2f2e97
Merge pull request #69746 from Infinisil/rem-opt-usage-message
lib.mkRemovedOptionModule: Show replacement for option usage too
2019-10-02 23:11:41 +02:00
Matthew Bauer bf2e3515a8
Merge pull request #70194 from obsidiansystems/lib-more-arm
lib: Add armv7a-linux to doubles.nix
2019-10-01 13:34:27 -04:00
John Ericson 3098d65210 lib: Add armv7a-linux to doubles.nix
This is needed for android.
2019-10-01 12:51:57 -04:00
Matthieu Coudron a4fe469d39 lib.kernel: scoped whenXXX helpers
whenAtLeast/whenBetween are made available in lib/kernel.nix but are now
scoped under whenXXX.
2019-10-01 16:09:07 +09:00
Matthieu Coudron afa0e02d64 lib.kernel: make public
Remove the "version" parameter in order to make it more widely
available.
Starts making some kernel configuration helpers available.
The intent is to be able to better build and check the linux kernel
configuration.
2019-10-01 15:57:14 +09:00
Silvan Mosberger c75a18fea6
mkRemovedOptionModule: assert on removed options (#69419)
mkRemovedOptionModule: assert on removed options
2019-09-30 16:39:40 +02:00
Robin Gloster b08b0bcbbe mkRemovedOptionModule: assert on removed options
We don't want to ignore config that can mess up machines. In general
this should always fail evaluation, as you think you are changing
behaviour and don't, which can easily create run-time errors we can
catch early.
2019-09-30 12:07:13 +02:00
Silvan Mosberger ebb136da9f
lib.mkRemovedOptionModule: Show replacement for option usage too
Previously mkRemovedOptionModule would only show the replacement
instructions when the removed option was *defined*. With this change, it
also does so when an option is *used*.

This is essential for options that are only intended to be used such as
`security.acme.directory`, whose replacement instructions would never
trigger without this change because almost everybody only uses the
option and isn't defining it.
2019-09-28 04:10:22 +02:00
Joachim F ad773d31e2
Merge pull request #69345 from joachifm/feat/split-version
Replace uses of splitString for splitting version strings
2019-09-27 06:19:18 +00:00
Joachim Fasting 2d4352b1ae
lib: basic tests for lib.versions 2019-09-26 17:42:48 +02:00
Joachim Fasting fd3052901c
lib/versions: expose splitVersion 2019-09-26 17:42:42 +02:00
Orivej Desh 8bec8df663 licenses: refer to curl using spdx 2019-09-22 20:33:44 +00:00
Orivej Desh 698b06dfe4 qhull: specify spdx license 2019-09-22 20:22:23 +00:00
Peter Simons c82b347947 lib: fix typo in 'zipAttrsWith' documentation 2019-09-11 19:54:36 +02:00
Robert Hensing a96f37db10 Document attrsets.recurseIntoAttrs 2019-09-11 14:55:23 +02:00
Robert Hensing fc64cf65ab top-level: Fix dontRecurseIntoAttrs and include in lib
dontRecurseIntoAttrs was a noop (x: x), causing the expression
dontRecurseIntoAttrs (recurseIntoAttrs a) to have the wrong effect.
2019-09-11 13:12:06 +02:00
Robert Hensing 8935bfb4ac lib: Add recurseIntoAttrs
This makes the function available without having to evaluate the
Nixpkgs fix-point, making it available in a more natural way for
code that deals with multiple Nixpkgs invocations.

Its definition is coupled to Nix rather than Nixpkgs, so it will
feel right at home in lib.
2019-09-11 13:12:06 +02:00
Samuel Leathers 01268fda85
20.03 is Markhor
* Markhor is a spiral horned animal that is on the endangered species list
* https://en.wikipedia.org/wiki/Markhor
2019-09-09 11:26:58 -04:00
Frederik Rietdijk 66bc7fc1b3 Merge master into staging-next 2019-09-06 22:46:05 +02:00
Silvan Mosberger d1bb36d5cb
Merge pull request #67996 from roberth/cleanSourceWith-name
lib.cleanSourceWith: Allow name to be set, optional filter, doc
2019-09-06 21:11:12 +02:00
Robert Hensing a0b743f47c
Fix typo in lists.nix 2019-09-06 20:02:36 +02:00
Silvan Mosberger a4896cb4aa
lib/makeOverridable: Refactor
- Rename ff to result because that's what it is
- Better indentation
- Less parens
- Comment what overrideWith does
2019-09-05 00:57:55 +02:00
Silvan Mosberger 23e72eff41
lib/makeOverridable: Remove unimplemented overrideDerivation for functions
- Apparently nobody ever needed this
- We already have enough ways to override things
- Using overrideDerivation is discouraged
2019-09-05 00:57:22 +02:00
Silvan Mosberger c638dac226
lib/makeOverridable: Propagate function args of the callPackage'd function
This allows querying function arguments of things like fetchFromGitHub:

  nix-repl> lib.functionArgs pkgs.fetchFromGitHub
  { fetchSubmodules = true; githubBase = true; ... }
2019-09-05 00:57:04 +02:00
Silvan Mosberger d54bdf5504
lib/makeOverridable: Propagate function arguments to override functions
This allows querying the arguments you can .override:

  nix-repl> lib.functionArgs pkgs.hello.override
  { fetchurl = false; stdenv = false; }
2019-09-05 00:56:39 +02:00
Silvan Mosberger e140d709c4
lib/makeOverridable: Abstract result overriding 2019-09-05 00:56:11 +02:00
Silvan Mosberger a75080f58c
lib/makeOverridable: Deduplicate override definition
And call it overrideArgs in the let binding because that's what it does
2019-09-05 00:54:03 +02:00
Robert Hensing 9a2180fa0b lib.cleanSourceWith: Allow name to be set, optional filter, doc
This change is API-compatible and hash-compatible with the previous
version.

At first I considered to write a rename function too, but adding
it name to cleanSourceWith was a no-brainer for ease of use. It
turns out that a rename function isn't any more useful than
cleanSourceWith.
To avoid having to write the identity predicate when renaming,
the filter is now optional.

builtins.path is supported since Nix 2.0 which is required by nixpkgs
2019-09-03 10:36:57 +02:00
Vladimír Čunát f21211ebfe
Merge branch 'master' into staging 2019-09-02 23:25:24 +02:00
Gabriel Féron 4b5afe54de
Fix typo in customisation.nix 2019-09-02 13:39:40 +02:00
John Ericson c2b34b2b57 Merge remote-tracking branch 'upstream/master' into js-unknown-ghcjs 2019-09-02 01:57:01 -04:00
John Ericson a77a2cfe4a lib: Further clean up systems list 2019-09-02 01:55:38 -04:00
John Ericson f57fe63d5f Merge lib sort into feature/js-unknown-ghcjs 2019-09-02 01:44:30 -04:00
John Ericson 3d8cf08706 lib: Sort platform predicates 2019-09-02 01:38:22 -04:00
John Ericson c33d80c071 Merge remote-tracking branch 'upstream/master' into feature/js-unknown-ghcjs 2019-09-02 01:31:31 -04:00
Moritz Angermann 446f8c851d Add support for js-unknown-ghcjs
This adds enough logic to nixpkgs to support the `js-unknown-ghcjs` triple.
2019-09-02 01:27:05 -04:00
Silvan Mosberger 03391cd336
lib/types: Make usage of types.string emit a warning 2019-08-31 18:19:15 +02:00
Frederik Rietdijk ad1d58c622 Merge staging-next into staging 2019-08-31 10:04:20 +02:00
volth 08f68313a4 treewide: remove redundant rec 2019-08-28 11:07:32 +00:00
Frederik Rietdijk 5061fe0c2c Merge staging-next into staging 2019-08-28 08:26:42 +02:00
Silvan Mosberger 91f6a681e0
Merge pull request #66407 from Infinisil/fix-option-rename
lib/modules: Use options `apply` function even if no values are defined
2019-08-27 22:06:23 +02:00
volth 35d68ef143 treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00
Jan Tojnar 907529ff06
lib/options: fix path in comment 2019-08-26 02:01:49 +02:00
danbst d80cd26ff9 Merge branch 'master' into flip-map-foreach 2019-08-18 18:00:25 +03:00
Aaron Andersen 6f6468bef3
Merge pull request #65728 from Infinisil/types-eithers
lib/types: Add oneOf, extension of either to a list of types
2019-08-13 11:48:42 -04:00
Silvan Mosberger de9cb24938
lib/modules: Use options apply function even if no values are defined
This allows `apply` functions to return a valid value if they completely
ignore their argument, which is the case for the option renaming
functions like `mkAliasOptionModule`. Therefore this solves issue #63693
2019-08-10 00:56:56 +02:00
Silvan Mosberger 9a44f44d4c
lib/types: Add oneOf, extension of either to a list of types 2019-08-06 14:08:42 +02:00
danbst 210c57883e and one more place 2019-08-05 14:14:40 +03:00
Danylo Hlynskyi 7585496eff
Merge branch 'master' into flip-map-foreach 2019-08-05 14:09:28 +03:00
danbst d0413360d3 rename foreach -> forEach 2019-08-05 14:06:20 +03:00
Silvan Mosberger 377cd8a1ea
Merge pull request #65380 from danbst/int-merge-one-option
lib/types: change merge strategy for `str`, `int`, `float`, `path` and `enum`
2019-07-29 20:49:33 +02:00
Jay Kruer e931a525f9 Add RISC-V embedded crossSystems 2019-07-25 21:45:11 -07:00
danbst 795383204e lib/types: change merge strategy for str, int, float and enum
Change to `mergeEqualOption`.
2019-07-25 18:12:15 +03:00
Bas van Dijk 58ea28eb2c lib: allow sourceByRegex to be composed after cleanSourceWith
`sourceByRegex src regexes` should include a source file if one of the
regular expressions `regexes` matches the path of that file relative
to `src`.

However to compute this relative path `sourceByRegex` uses:

```
relPath = lib.removePrefix (toString src + "/") (toString path);
```

Note that `toString path` evaluates to an absolute file somewhere
under `src` and not under `/nix/store`.

The problem is that this doesn't work if `src` is a `cleanSourceWith`
invocation as well because `toString src` will then evaluate to
`src.outPath` which will evaluate to `builtins.filterSource ...` which
evaluates to a path in `/nix/store` which is not a prefix of `path`.

The solution is to replace `src` with `origSrc` where

```
origSrc = if isFiltered then src.origSrc else src;
isFiltered = src ? _isLibCleanSourceWith;
```

Test this by executing the following from the nixpkgs repo:

```
(cat << 'EOI'
let
  pkgs = import ./. {};
in pkgs.runCommand "test-sourceByRegex" {
  test_sourceByRegex =
    let
      src1 = pkgs.lib.sourceByRegex ./.  [ "^test-sourceByRegex.nix$" ];
      src2 = pkgs.lib.sourceByRegex src1 [ "^test-sourceByRegex.nix$" ];
    in src2 + "/test-sourceByRegex.nix";
} ''
 cp $test_sourceByRegex $out
''
EOI
) > test-sourceByRegex.nix
nix-build test-sourceByRegex.nix
```
2019-07-19 16:23:11 +02:00
danbst 69920dafbf lib: introduce foreach = flip map
The main purpose is to bring attention to `flip map`, which improves
code readablity. It is useful when ad-hoc anonymous function
grows two or more lines in `map` application:

```
      map (lcfg:
        let port = lcfg.port;
            portStr = if port != defaultPort then ":${toString port}" else "";
            scheme = if cfg.enableSSL then "https" else "http";
        in "${scheme}://cfg.hostName${portStr}"
      ) (getListen cfg);
```
Compare this to `foreach`-style:
```
      foreach (getListen cfg) (lcfg:
        let port = lcfg.port;
            portStr = if port != defaultPort then ":${toString port}" else "";
            scheme = if cfg.enableSSL then "https" else "http";
        in "${scheme}://cfg.hostName${portStr}"
      );
```
This is similar to Haskell's `for` (http://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Traversable.html#v:for)
2019-07-14 13:29:58 +03:00
Frederik Rietdijk 8931db9f0b make-tarball / lib-tests: reduce duplication
The misc.nix and systems.nix tests were invoked at three different
places. Let's not that.
2019-07-11 18:02:05 +02:00
Matthew Bauer d059185bad Revert "Revert "systems/doubles.nix: add Apple doubles""
This reverts commit ce2f74df2c.

Doubles are treated as -darwin here, to provide some consistency.
There is some ambiguity between “x86_64-darwin” and “i686-darwin”
which could refer to binaries linked between iOS simulator or real
macOS binaries. useiOSPrebuilt can be used to determine which to use,
however.
2019-07-10 15:14:59 -04:00
Frederik Rietdijk ce2f74df2c Revert "systems/doubles.nix: add Apple doubles"
The lib tests need to be fixed as well.

This unbreaks the tarball job.

This reverts commit 00ba557856.
2019-07-10 12:37:06 +02:00
Matthew Bauer 00ba557856 systems/doubles.nix: add Apple doubles
These are used in cross-compilation to iOS devices and simulators.

Fallout from #60349.
2019-07-08 12:33:16 -04:00
volth f3282c8d1e treewide: remove unused variables (#63177)
* treewide: remove unused variables

* making ofborg happy
2019-06-16 19:59:05 +00:00
Danylo Hlynskyi e718eb6243
Merge pull request #62712 from danbst/module-conflict-naming
NixOS module system: improve one of error messages
2019-06-13 11:59:54 +03:00
Orivej Desh a9b033d221 licenses: refer to libpng2 using spdx
https://spdx.org/licenses/libpng-2.0.html
2019-06-12 22:04:52 +00:00
Orivej Desh 16a066d968 licenses: fix LGPL 2.1 full name 2019-06-06 14:44:12 +00:00
danbst bfb6ef1d59 module system: prettify a bit error when unique option defined twice
The error can be reproduced like:
```
$ nix-instantiate ./nixos -A system --arg configuration '
  { fileSystems."/".device = "nodev";
    boot.loader.grub.devices = [ "nodev" ];
    containers.t.config.imports = [ <nixpkgs/nixos/modules/virtualisation/amazon-image.nix> ];
  }'
```

Previously error was:
```
error: The unique option `containers.t.networking.hostName' is defined multiple times, in `/nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/virtualisation/amazon-image.nix' and `module at /home/danbst/dev/nixpkgs/nixos/modules/virtualisation/containers.nix:470'.
(use '--show-trace' to show detailed location information)
```

Now it is:
```
error: The unique option `containers.t.networking.hostName' is defined multiple times, in:
 - /nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/virtualisation/amazon-image.nix
 - module at /home/danbst/dev/nixpkgs/nixos/modules/virtualisation/containers.nix:470.
(use '--show-trace' to show detailed location information)
```

Related: https://github.com/NixOS/nixpkgs/issues/15747
2019-06-05 03:10:57 +03:00
Matthew Bauer 0fef9f89e4 systems: fix lib-tests
These were broken by the added system doubles. This just adds those to
the lib-tests.
2019-06-04 14:51:33 -04:00
Matthew Bauer de70b76779 systems: fixup from last commit
it’s powerpc-none not ppc-none
2019-06-04 13:42:14 -04:00
Matthew Bauer f7c7207a3f systems: add missing doubles
in https://github.com/NixOS/nixpkgs/pull/60349, the attr handling was
removed. This means we rely on these double values for determing what
we are compatible with. This adds some of the missing doubles to this
list.

https://hydra.nixos.org/eval/1523389#tabs-removed
2019-06-04 13:34:40 -04:00
Matthew Bauer 760c9995b0
Merge pull request #60349 from matthewbauer/fix-60345
check-meta: use system tuple in platforms
2019-06-04 11:29:48 -04:00
Matthew Bauer 635b762569 systems: allow passing in string for cross/localSystem
This makes things a little bit more convenient. Just pass in like:

$ nix-build ’<nixpkgs>’ -A hello --argstr localSystem x86_64-linux --argstr crossSystem aarch64-linux
2019-06-04 11:17:25 -04:00
Matthew Bauer 40271ae138 systems: remove forMeta
This is unused now.
2019-06-04 11:09:43 -04:00
Robin Gloster 6cf583cf2f
Merge pull request #60406 from JohnAZoidberg/remove-isnull
treewide: Remove usage of isNull
2019-05-18 09:36:24 +00:00
Lionello Lunesu fb147b07ad Adds pkgsCross.gnu32 and pkgsCross.gnu64 platforms 2019-05-05 15:24:10 +08:00
Matthew Bauer e500bb8409 systems: add riscv double
This was never listed in doubles.nix! Not sure why?
2019-04-30 12:59:38 -04:00
Matthew Bauer a52e317200 check-meta: use system tuple in platforms
Fixes #60345
2019-04-30 12:59:03 -04:00
Daniel Schaefer 786f02f7a4 treewide: Remove usage of isNull
isNull "is deprecated; just write e == null instead" says the Nix manual
2019-04-29 14:05:50 +02:00
Frederik Rietdijk 883232c00d Merge master into staging-next 2019-04-27 07:01:38 +02:00
Matthew Bauer ed5c731b21 tests/systems: fix tests 2019-04-25 17:28:02 -04:00
Mario Rodas 8bc92d78e7
lib.licences: Add CC-BY-NC-3.0 2019-04-24 21:12:43 -05:00
Matthew Bauer 7488a367af
Merge pull request #56555 from matthewbauer/wasm
Initial WebAssembly/WASI cross-compilation support
2019-04-23 22:44:33 -04:00
Matthew Bauer dbb94b984f wasmtime: init and use for emulation
This isn’t really an "emulator" but it’s the closest concept we have
right now.
2019-04-23 21:48:57 -04:00
Matthew Bauer d591a109be wasm: don’t assume musl 2019-04-23 21:48:57 -04:00
Matthew Bauer 9abff4af4f wasm: init cross target
Adds pkgsCross.wasm32 and pkgsCross.wasm64. Use it to build Nixpkgs
with a WebAssembly toolchain.

stdenv/cross: use static overlay on isWasm

isWasm doesn’t make sense dynamically linked.
2019-04-23 21:48:57 -04:00
Matthew Bauer d180cb9850 cc-wrapper: make machine configuration configurable
It is useful to make these dynamic and not bake them into gcc. This
means we don’t have to rebuild gcc to change these values. Instead, we
will pass cflags to gcc based on platform values. This was already
done hackily for android gcc (which is multi-target), but not for our
own gccs which are single target.

To accomplish this, we need to add a few things:

- add ‘arch’ to cpu
- add NIX_CFLAGS_COMPILE_BEFORE flag (goes before args)
- set -march everywhere
- set mcpu, mfpu, mmode, and mtune based on targetPlatform.gcc flags

cc-wrapper: only set -march when it is in the cpu type

Some architectures don’t have a good mapping of -march. For instance
POWER architecture doesn’t support the -march flag at all!

https://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html#RS_002f6000-and-PowerPC-Options
2019-04-20 20:05:51 -04:00
Matthew Bauer ae50241871 release-cross: remove alpha-elf target
This doesn’t appear to ever have worked. binutils doesn’t seem to
support the alpha-elf target at all. It doesn’t make sense to keep
this around.

https://hydra.nixos.org/build/92403855/nixlog/1/tail
2019-04-20 17:22:52 -04:00
Matthew Bauer d8934feba1 kernel-headers: infer ARCH from config triple
This makes us less reliant on the systems/examples.nix. You should be
able to cross compile with just your triple:

$ nix build --arg crossSystem '{ config = "armv6l-unknown-linux-gnueabi"; }' stdenv
2019-04-19 14:53:48 -04:00
Matthew Bauer 5eea658778 systems: correct qemu architectures
ppc64le and ppc64 are different targets in the configure script. We
can’t use the same one.

TODO: canonicalize similar ones based on qemu’s configure script.
2019-04-19 12:03:56 -04:00
Matthew Bauer 23560ea057 systems: fix emulator identity
Squashed to fix shell quoting, thanks @Ericson2314
2019-04-19 12:03:44 -04:00
Matthew Bauer 59bb1dcbfb systems/parse.nix: fixup arm compatibilities 2019-04-19 12:00:32 -04:00
Frederik Rietdijk 9d87ccabce Merge master into staging-next 2019-04-18 08:25:25 +02:00
Alyssa Ross 7ed977e60d
lib.converge: optimise 2019-04-17 15:55:57 +01:00
Ken Micklas ec7643047c androidndk-pkgs: Remove -mfloat flag 2019-04-16 16:21:51 -04:00
Frederik Rietdijk bae32a9f5c Merge staging-next into staging 2019-04-16 18:54:15 +02:00
Eelco Dolstra 9f5ba91c7a
Merge pull request #59369 from Ekleog/unique-fix
lib: improve the implementation of the unique function
2019-04-15 14:16:39 +02:00
Silvan Mosberger 3c3de4b154
Merge pull request #58815 from Infinisil/fix/cleanSource/git-worktree
lib.cleanSourceFilter: Filter all .git, not just directories
2019-04-14 17:36:41 +02:00
Léo Gaspard 8319ead594 lib: improve the implementation of the unique function 2019-04-12 20:08:29 +02:00
Frederik Rietdijk c6341c279b Merge staging-next into staging 2019-04-11 07:52:44 +02:00
Matthew Bauer ac491d2df7 systems: remove android armv5te platform
this isn’t useful any more because the ndk we use no longer supports it.
2019-04-10 01:55:09 -04:00
Matthew Bauer 589c2c2870 androidndk: fixup mess
New android ndk (18) now uses clang. We were going through the wrapper
that are provided. This lead to surprising errors when building.
Ideally we could use the llvm linker as well, but this leads to errors
as many packages don’t support the llvm linker.
2019-04-10 01:30:34 -04:00
Corbin 5719f892e1 python: Make .isPyPy flag more accurate.
nix-repl> map (s: s.isPyPy) [ python python3 pypy pypy3 ]
[ false false true true ]
2019-04-09 20:41:08 +02:00
Silvan Mosberger eb09fd5a88
lib.cleanSourceFilter: Filter all .git, not just directories
In the case of a worktree created with `git worktree add`, .git is
actually a file with contents pointing to the original repository.
2019-04-08 16:20:09 +02:00
Jan Tojnar cb1a20499a
Merge branch 'master' into staging 2019-04-05 11:37:15 +02:00
Vladimír Čunát 2771375d6e
Merge branch 'master' into staging-next
Hydra nixpkgs: ?compare=1512490
2019-04-02 20:56:53 +02:00
John Ericson 842b14ba98
Merge pull request #58330 from AerialX/msp430
TI MSP430 cross compiling
2019-03-29 16:11:22 -04:00
Matthias Beyer 3cf40fc794 lib: lists: Alias builtins.map
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Suggested-by: Profpatsch <mail@profpatsch.de>
2019-03-29 14:34:30 +01:00
Aaron Lindsay 1c7bb464d9 msp430: include vendor headers with stdenv 2019-03-25 20:39:51 -07:00
Aaron Lindsay 1eca945e94 systems: support TI MSP430 microcontrollers 2019-03-25 20:33:58 -07:00
Frederik Rietdijk b40d752872 Merge master into staging-next 2019-03-23 09:18:41 +01:00
Wael M. Nasreddine 5af0780492
Merge remote-tracking branch 'origin/master' into staging
* origin/master: (693 commits)
  buildGoModule: use go_1_12 instead of go_1_11 (#58103)
  gitAndTools.lab: 0.15.2 -> 0.15.3 (#58091)
  signal-desktop: 1.22.0 -> 1.23.0
  added missing semicolon to documentation
  terminus_font_ttf: 4.46.0 -> 4.47.0
  buildGoModule: remove SSL env vars in favor of cacert in buildInputs (#58071)
  dav1d: init at 0.2.1
  dropbox-cli: 2018.11.28 -> 2019.02.14
  atlassian-confluence: 6.14.1 -> 6.14.2
  maintainers: update email for dywedir
  python.pkgs.hglib: use patch to specify hg path (#57926)
  chkrootkit: 0.52 -> 0.53
  radare2-cutter: 1.7.2 -> 1.8.0
  autorandr: 1.7 -> 1.8
  pythonPackages.pyhepmc: fix build
  llvm-polly/clang-polly: use latest llvm
  apulse: 0.1.11.1 -> 0.1.12, cleanup
  factorio: experimental 0.17.14 → 0.17.16 (#58000)
  sequeler: 0.6.7 -> 0.6.8
  nasc: 0.5.1 -> 0.5.2
  ...
2019-03-21 21:01:25 -07:00
Nathan van Doorn 8bf42f538e
Doc fix: use correct function name in type signature for concatIMapStringsSep 2019-03-18 12:14:39 +00:00
Vladimír Čunát bf47162c26
Merge branch 'master' into staging-next
Hydra nixpkgs: ?compare=1508887
2019-03-10 08:04:21 +01:00
Jan Malakhovski 570aed4b46 lib: add showWarnings 2019-03-08 11:19:18 +02:00
Danylo Hlynskyi 60e8fcf0e5
module system: revert "remove types.optionSet", just deprecate (#56857)
The explicit remove helped to uncover some hidden uses of `optionSet`
in NixOps. However it makes life harder for end-users of NixOps - it will
be impossible to deploy 19.03 systems with old NixOps, but there is no
new release of NixOps with `optionSet` fixes.

Also, "deprecation" process isn't well defined. Even that `optionSet` was
declared "deprecated" for many years, it was never announced. Hence, I
leave "deprecation" announce. Then, 3 releases after announce,
we can announce removal of this feature.

This type has to be removed, not `throw`-ed in runtime, because it makes
some perfectly fine code to fail. For example:
```
$ nix-instantiate --eval -E '(import <nixpkgs/lib>).types' --strict
trace: `types.list` is deprecated; use `types.listOf` instead
error: types.optionSet is deprecated; use types.submodule instead
(use '--show-trace' to show detailed location information)
```
2019-03-07 21:28:09 +02:00
Jan Malakhovski a53b3ba091 lib: optionAttrSetToDocList: warn instead of throwing on options without descriptions
For convenience, it's not like not having a description is deadly or something.
2019-03-05 09:41:41 +00:00
Frederik Rietdijk 205e0fc5bd Merge staging-next into staging 2019-03-01 09:22:21 +01:00
Matthew Bauer 5c46f77249
Merge pull request #56197 from matthewbauer/cross-fixes3
Android and related cross fixes
2019-02-26 20:30:53 -05:00
Matthew Bauer 8e25da0beb cross/tests: add llvm-based tests 2019-02-26 19:46:24 -05:00
Matthew Bauer 3c8b75f536
Merge pull request #56393 from matthewbauer/is-compatible
systems: add isCompatible handling
2019-02-26 16:39:08 -05:00
Matthew Bauer aab8c7ba43 netbsd: add cross target 2019-02-26 15:55:47 -05:00
Matthew Bauer 20a4bbe23b systems: add “emultator” for wasm
v8 can run any wasm bytecode
2019-02-25 20:07:43 -05:00
Linus Heckemann bd018946eb 19.09 is Loris.
https://en.wikipedia.org/wiki/Loris
2019-02-25 23:21:14 +01:00
Matthew Bauer bfb45e96b9 mesa: armv7a-linux supports mesa 2019-02-24 17:00:48 -05:00
xeji 631bc2c99f
Merge pull request #55488 from winpat/add_dirvish
dirvish: init at 1.2.1
2019-02-24 12:02:11 +01:00
Silvan Mosberger d3216be6d9
Merge pull request #54528 from cdepillabout/module-alias-uses-priority
lib/modules: Change mkAliasOptionModule to use the priority for the alias
2019-02-23 16:43:05 +01:00
Matthew Bauer f455a07f13 systems: add isCompatible handling 2019-02-21 22:17:51 -05:00
Vincent Weisner 1eca8366e8 alpha-embedded: isAlpha code Added (#56090)
Adds isAlpha to stdenv.<platform> flags.
2019-02-20 14:27:47 -05:00
Frederik Rietdijk 6fe10d2779 Merge master into staging-next 2019-02-16 09:29:54 +01:00
Michael Raskin 8384cfe455
Merge pull request #55129 from oxij/tree/move-defaults-to-package-files
all-packages.nix: move defaults to package files
2019-02-13 20:04:08 +00:00
Patrick Winter 44936c416f lib.licenses: add Open Software License 2.0 2019-02-09 19:30:09 +01:00
(cdep)illabout dcbd136319
Fix the documentation for the tests to reflect what is actually happening. 2019-02-07 10:33:48 +09:00
Jan Malakhovski 51687d9a7f lib: tiny cleanup 2019-02-03 15:30:15 +00:00
Vladimír Čunát 8ba516664b
Merge branch 'staging-next' into staging 2019-02-01 09:42:53 +01:00
Vladimír Čunát 5effa4e0f9
Merge branch 'master' into staging-next
Comments on conflicts:
- llvm: d6f401e1 vs. 469ecc70 - docs for 6 and 7 say the default is
  to build all targets, so we should be fine
- some pypi hashes: they were equivalent, just base16 vs. base32
2019-02-01 09:22:29 +01:00
danbst 27982b408e types.optionSet: deprecate and remove last usages 2019-01-31 00:41:10 +02:00
danbst aa2e63ce5e lib/modules.nix: small eval optimization (foldl' + foldl' + attrNames -> foldl' + mapAttrs) 2019-01-30 15:26:44 +02:00
danbst f32987d451 lib/types.nix: small eval optimization (listToAttrs + mapAttrsToList -> mapAttrs) 2019-01-30 15:26:44 +02:00
Matthieu Coudron 7aacbdb898 linux: convert hardened-config to a structured one 2019-01-28 09:07:24 +09:00
Matthieu Coudron 3bb7b3f02e linux: ability to merge structured configs
This should make the composability of kernel configurations more straigthforward.

- now distinguish freeform options from tristate ones
- will look for a structured config in kernelPatches too
one can now access the structuredConfig from a kernel via linux_test.configfile.structuredConfig
in order to reinject it into another kernel, no need to rewrite the config from scratch

The following merge strategies are used in case of conflict:
-- freeform items must be equal or they conflict (mergeEqualOption)
-- for tristate (y/m/n) entries, I use the mergeAnswer strategy which takes the best available value, "best" being defined by the user (by default "y" > "m" > "n", e.g. if one entry is both marked "y" and "n", "y" wins)
-- if one item is both marked optional/mandatory, mandatory wins (mergeFalseByDefault)
2019-01-28 09:06:33 +09:00
Matthew Bauer bf041c3f1d
systems/default.nix: wasm in platform.uname.system
This adds the "Wasm" system to platform.uname.system. This is used in CMake infrastructure.
2019-01-27 17:29:23 -05:00
(cdep)illabout 81fa1e392b lib/modules: Change mkAliasOptionModule to use the priority for the alias.
This commit changes the `mkAliasOptionModule` function to make sure that
the priority for the aliased option is propagated to the non-aliased
option.

This also affects the `mkRenamedOptionModule` function in a similar
fashion.

This also removes the `mkAliasOptionModuleWithPriority` function, since
its functionality is now subsumed by `mkAliasOptionModule`.

This change was recommended by @nbp:
https://github.com/NixOS/nixpkgs/pull/53397#discussion_r245487432
2019-01-24 13:02:16 +09:00
Vladimír Čunát 3456ad586b
Merge #51447: libpng: 1.6.35 -> 1.6.36, license v2
(into staging)
2019-01-19 10:56:57 +01:00
Frederik Rietdijk f8b45e2d84 Merge staging-next into staging 2019-01-19 09:24:01 +01:00
Michael Raskin 4d0e1b792f
Merge pull request #50561 from oxij/lib/setPrio
lib: implement `setPrio`
2019-01-18 08:23:31 +00:00
Frederik Rietdijk 42d276c6b8 Merge staging-next into staging 2019-01-15 16:59:03 +01:00
Nicolas B. Pierron a3beabf327
Merge pull request #53397 from cdepillabout/aliasoptionmodule-set-priority
lib/modules: Add function to create option alias that respects priority
2019-01-14 20:28:28 +01:00
Frederik Rietdijk bb9581cd88 Merge staging-next into staging 2019-01-13 14:46:43 +01:00
Jörg Thalheim b75aff7202
Merge pull request #53754 from danbst/lib-fake-hashes
lib: add fake hashes
2019-01-10 17:56:09 +00:00
danbst 68a6b47b8c lib: add shortcuts for fake hashes (fakeSha256, fakeSha512)
Fake hashes can be used as placeholders for all the places, where
Nix expression requires a hash, but we don't yet have one.

This should be more convenient than following:
- echo|sha256sum, copy into clipboard, go to editor, paste into previously
  edited place
- search nixpkgs for a random package, copy it's hash to cliboard, go to
  editor, paste into previously edited place

Nix can add support for these fake hashes. In that case printed error should contain
only 1 hash, so no more problem "which of two hashes from error should I use?"

Idea by irc:Synthetica
2019-01-10 19:27:35 +02:00
Daniel Goertzen 1c10efc912 add generic x86_32 support (#52634)
* add generic x86_32 support

- Add support for i386-i586.
- Add `isx86_32` predicate that can replace most uses of `isi686`.
- `isi686` is reinterpreted to mean "exactly i686 arch, and not say i585 or i386".
- This branch was used to build working i586 kernel running on i586 hardware.

* revert `isi[345]86`, remove dead code

- Remove changes to dead code in `doubles.nix` and `for-meta.nix`.
- Remove `isi[345]86` predicates since other cpu families don't have specific model predicates.

* remove i386-linux since linux not supported on that cpu
2019-01-06 12:57:36 -06:00
(cdep)illabout 7314d885a1
Add test that shows that the aliases are able to override options. 2019-01-06 18:10:03 +09:00
(cdep)illabout f24e2d0721
Pull out defaultPriority to a top-level definition. 2019-01-06 17:48:37 +09:00
Vladimír Čunát d84a33d85b
Merge branch 'master' into staging-next
A few more rebuilds (~1k on x86_64-linux).
2019-01-05 15:02:04 +01:00
John Ericson 1383670a83
Merge pull request #53029 from Ericson2314/windows-ce-arm
lib: Fix Mingw on 32-bit ARM
2019-01-04 20:27:35 -05:00
John Ericson 3bf0e4efc7 lib: Fix Mingw on 32-bit ARM 2019-01-04 12:05:35 -05:00
(cdep)illabout b81b3ad1b0
lib/modules: Add a function to create an option alias that respects the priority
This commit adds a function `mkAliasOptionModuleWithPriority`.  This
function will make an alias to an existing option and copy over the
priority.

This functionality is needed for PRs like #53041.  In that case
`nixos-generate-config` added an option to `hardware-configuration.nix`
with `mkDefault`.  That option was then changed and an alias created for
the old name.

The end user should be able to set the non-alias option in their
`configuration.nix` and have everything work correctly.  Without this
function, the priority for the option won't be copied over correctly
and the end-user will get a message saying they have the same option
set to two different values.
2019-01-04 18:35:10 +09:00
(cdep)illabout da00ec4b45
Add a failing test for mkAliasOptionModule. 2019-01-04 18:34:09 +09:00
Frederik Rietdijk 070290bda7 Merge master into staging-next 2018-12-31 12:00:36 +01:00
Frederik Rietdijk c6e043d57c Remove composableDerivation, closes #18763 2018-12-30 12:33:45 +00:00
Will Dietz d37b48d1e4 libpng2: link to license, SPDX seems geared to old version
See https://github.com/NixOS/nixpkgs/pull/51447 for some discussion.
2018-12-29 14:21:47 -06:00
Will Dietz 6f986c8bdc libpng: 1.6.35 -> 1.6.36, license v2 2018-12-29 14:20:44 -06:00
Jan Tojnar c45e9d0fac
Merge branch 'master' into staging 2018-12-25 17:03:57 +01:00
Orivej Desh 18a5e8c36b licenses: update SPDX IDs (#52711)
See the bottom of https://spdx.org/licenses/ for the list of deprecations.

The explicit URLs of agpl3Plus and gpl2Classpath were dropped because the
default SPDX URL is correct.

wxWindows ID had wrong capitalization.
2018-12-24 23:29:58 +00:00
Sander van der Burg 51428627eb Initial attempt to restore Android NDK cross building 2018-12-18 22:58:12 +01:00
volth fed7914539
Merge branch 'staging' into make-perl-pathd 2018-12-18 17:13:27 +00:00
Jan Tojnar aead6e12f9
Merge remote-tracking branch 'upstream/master' into staging 2018-12-16 22:55:06 +01:00
volth bb9557eb7c lib.makePerlPath -> perlPackages.makePerlPath 2018-12-15 03:50:31 +00:00
Alyssa Ross b450083ee3
Merge pull request #51884 from alyssais/bundlerEnv-groups
bundlerEnv: improve handling of groups
2018-12-12 23:51:52 +00:00
Jörg Thalheim 554851e689
platform.emulator: fix non-x86 systems 2018-12-12 08:00:07 +00:00
Etienne Laurin 328fbcff60 ikos: init at 2.1 2018-12-12 00:09:24 +00:00
Alyssa Ross 67b1265fb3
bundlerEnv: ensure dependencies always included
Suppose I have a Gemfile like this:

    source "https://rubygems.org"
    gem "actioncable"
    gem "websocket-driver", group: :test

The gemset.nix generated by Bundix 2.4.1 will set ActionCable's groups
to [ "default" ], and websocket-driver's to [ "test" ]. This means that
the generated bundlerEnv wouldn't include websocket-driver unless the
test group was included, even though it's required by the default group.

This is arguably a bug in Bundix (websocket-driver's groups should
probably be [ "default" "test" ] or just [ "default" ]), but there's no
reason bundlerEnv should omit dependencies even given such an input --
it won't necessarily come from Bundix, and it would be good for
bundlerEnv to do the right thing.

To fix this, filterGemset is now a recursive function, that adds
dependencies of gems in the group to the filtered gemset until it
stabilises on the gems that match the required groups, and all of their
recursive dependencies.
2018-12-11 21:26:07 +00:00
Matthew Bauer 3b32c920d5 systems/parse.nix: support eabihf
eabihf is an abi that can be used with ARM architectures that support
the “hard float”. It should probably only be used with ARM32 when you
are absolutely sure your binaries will run on ARM systems with a FPU.

Also, add an example "armhf-embedded" to match the preexisting
arm-embedded system. qmk_firmware needs hard float in a few places, so
add them here to get that to work.

Fixes #51184
2018-12-02 19:49:36 -06:00
Frederik Rietdijk 1828a5c5ba Merge master into staging-next 2018-11-30 17:46:21 +01:00
Matthew Bauer f435272ce3
Merge pull request #50212 from matthewbauer/host-emulator
Add "emulator" function to systems
2018-11-29 19:34:20 -06:00
Matthew Bauer 9c8fd41224 treewide: add emulator to platform
You can use stdenv.hostPlatform.emulator to get an executable that
runs cross-built binaries. This could be any emulator. For instance,
we use QEMU to emulate Linux targets and Wine to emulate Windows
targets. To work with qemu, we need to support custom targets.

I’ve reworked the cross tests in pkgs/test/cross to use this
functionality.

Also, I’ve used talloc to cross-execute with the emulator. There
appears to be a cross-execute for all waf builds. In the future, it
would be nice to set this for all waf builds.

Adds stdenv.hostPlatform.qemuArch attrbute to get the qemuArch for
each platform.
2018-11-29 19:15:30 -06:00
Matthew Bauer ce6d558c4d systems/examples.nix: move riscv function to let binding
Makes it easier to use mapAttrs with lib.systems.examples. Now every
entry in it are legitimate systems.
2018-11-29 19:15:28 -06:00
Jan Malakhovski 1b3629ef34 lib: implement setPrio
For when `hiPrio` and `lowPrio` are not enough.
2018-11-22 08:59:48 +00:00
Frederik Rietdijk c31cb577ae Merge master into staging-next 2018-11-22 09:57:08 +01:00
Robert Hensing 9959d7d8b8
Merge pull request #50532 from typetetris/add-extends-example
lib/fixed-points.nix: add an example for extends
2018-11-21 18:27:09 +01:00
Eric Wolf 3cc83dffca lib/fixed-points.nix: add an example for extends
- helped me understand how extends works, hopefully it can help others too
2018-11-21 17:40:20 +01:00
Matthew Bauer 4b00cfe77f systems/parse: add older x86 architectures
i386, i486, i586 are added. These may have issues as many places
assume i686 is the only valid 32 bit x86 architecture.
2018-11-21 09:38:10 -06:00
Frederik Rietdijk 0d0d7dcd06 Merge staging-next into staging 2018-11-18 10:41:34 +01:00
Linus Heckemann 4ef0760808 lib/licenses: remove bsl10
Licence isn't used anywhere and nonfree.
2018-11-16 20:58:49 +01:00
Linus Heckemann 8fb1e5e166 lib/licenses: mark some as unfree
AMD license agreement (currently unavailable at the given URL, but
included in tarball) disallows reverse-engineering, modification,
redistribution etc;

BSL licenses limit commercial production use.
2018-11-16 20:58:33 +01:00
zimbatm 2a838cb6d7
group the release info
this makes the codename globally accessible in the repo. The release is
not only for NixOS anymore.
2018-11-15 21:56:17 +01:00
Matthew Bauer d97e0ba8fe
Merge pull request #49588 from vincrusher/master
lib/system: More Types of CPUs Added
2018-11-12 12:53:54 -06:00
Frederik Rietdijk 1d3bff25db Merge staging-next into staging 2018-11-11 14:28:08 +01:00
Silvan Mosberger e468a1091b
Merge pull request #48687 from danielrutz/port-type
Add port type
2018-11-10 15:12:07 +01:00
Vincent Weisner e7d2ea13e1
lib/systems: Added missing semicolons 2018-11-09 09:08:28 -05:00
Vincent Weisner 84810a1ba0
lib/system: Added Embedded Platforms for the CPUs
I added some embedded platforms for the CPUs I added to the parse.nix file.
These could be used as new platforms for the added CPUs.
2018-11-09 09:06:31 -05:00
Markus Kowalewski e9da929e41
cwebbin: add license 2018-11-08 20:29:09 +01:00
Jan Malakhovski 2f5e4c733b lib: commitIdFromGitRepo: simplify a tiny bit 2018-11-08 05:20:18 +00:00
Patrick Hilhorst 320c9c10de
make-derivation: use pname-version as default name if both are present 2018-11-06 00:04:21 +01:00
Vincent Weisner 0607adde1a
Update parse.nix 2018-11-02 09:38:47 -04:00
Markus Kowalewski b13ab27360
jasper: add license 2018-11-01 23:27:14 +01:00
Jörg Thalheim aa75ebdcd3
CPU Fix
Co-Authored-By: vincrusher <vincentweisner@icloud.com>
2018-11-01 11:14:18 -04:00
Vincent Weisner f9aaf7134b
Update parse.nix 2018-11-01 10:00:55 -04:00
John Ericson 4c48da246f
Merge pull request #49567 from obsidiansystems/arm-auto-detect
lib.systems.platforms: Add more ARM autodetection
2018-10-31 21:21:14 -04:00
John Ericson aa964c82d3 lib.systems.platforms: Add more ARM autodetection 2018-10-31 19:04:06 -04:00
Matthew Bauer 2634d37617 systems/examples: add i686 & x86-64 embedded
Fixes #28160
2018-10-30 13:46:01 -05:00
Matthew Bauer 52dbd3380e systems/parse.nix: support weird system configs
There are some weird ones out there that don’t follow any pattern:

- arm-none-eabi
- powerpc-none-eabi
- aarch64-none-elf
2018-10-29 14:34:10 -05:00
Matthew Bauer 412093994b gcc: support avr
- respect libc’s incdir and libdir
- make non-unix systems single threaded
- set LIMITS_H_TEST to false for avr
- misc updates to support new libc’s
- use multilib with avr

For threads we want to use:
- posix on unix systems
- win32 on windows
- single on everything else

For avr:
- add library directories for avrlibc
- to disable relro and bind
- avr5 should have precedence over avr3 - otherwise gcc uses the wrong one
2018-10-29 14:34:09 -05:00
Matthew Bauer 72e3b2a662 systems: add avrlibc for avr systems 2018-10-29 14:34:09 -05:00
Matthew Bauer d59a9ac7cf avr: use new compilation infrastructure
Gets rid of:
  avrbinutils
  avrgcc

to replace with:
  pkgsCross.avr.buildPackages.binutils
  pkgsCross.avr.buildPackages.gcc
2018-10-29 14:34:09 -05:00
Graham Christensen 0c5d9e5c52
Merge pull request #49383 from tazjin/docs/lib-docstrings
Update library function "docstrings" for nixdoc generation
2018-10-29 11:00:02 +00:00
Vincent Ambo 2384966880 lib/options: Update documentation comments for docs generation
Documents functions in `lib.options` for docs generation with nixdoc.

The formatting change in the `mkOption` arguments is due to the way
`nixdoc` parses documentation comments on pattern arguments. It's not
ideal, but it works.
2018-10-29 10:45:28 +01:00
Vincent Ambo da18b92635 lib/debug: Update documentation comments for docs generation
Documents functions in `lib.debug` for docs generation with nixdoc.

Note that type signatures and clearer descriptions are still missing
on some of these functions, but this is good enough for a first run.
2018-10-29 10:45:25 +01:00
Vincent Ambo 65f50a9bb0 lib/lists: Update documentation comments for doc generation
Updates documentation comments with extra information for nixdoc[1]
compatibility.

[1]: https://github.com/tazjin/nixdoc
2018-10-29 10:42:43 +01:00
Vincent Ambo 0560caa578 lib/strings: Update documentation comments for doc generation
Updates documentation comments with extra information for nixdoc[1]
compatibility.

Some documentation strings have additionally been reworded for
clarity.

"Faux types" are added where applicable, but some functions do things
that are not trivially representable in the type notation used so they
were ignored for this purpose.

[1]: https://github.com/tazjin/nixdoc
2018-10-29 10:42:43 +01:00
taku0 66124646ee licenses: add GPLv2.0 only + classpath exception 2018-10-28 13:52:12 +00:00
Vincent Ambo c2a744b9af lib/trivial: Update function comments for doc generation
Expands on some of the function comments and add some of the
special syntaxes recognised by nixdoc.
2018-10-27 16:40:40 +02:00
Tim Cuthbertson d984c55383 lib.isStorePath: fix false result when passed a path object
Since `isStorePath` relies on comparing against builtins.storeDir
(a string), we need to convert the input into a string as well.
2018-10-20 22:33:04 +11:00
xeji 856243e346
Merge pull request #48680 from markuskowa/licenses-22
Add licenses
2018-10-18 23:40:02 +02:00
Daniel Rutz 161c0765ad Add type port as an alias to u16 2018-10-18 23:39:13 +02:00
Markus Kowalewski f5b9a9455f
libmilter: add license 2018-10-18 22:36:18 +02:00
John Ericson d97e5e1115
Merge pull request #48602 from matthewbauer/cmake-cross
Set CMAKE_SYSTEM_* for cross compiling
2018-10-18 15:47:04 -04:00
Matthew Bauer 4a12a9321c tests/systems.nix: fix tests
these weren’t being run correctly
2018-10-18 14:12:49 -05:00
Matthew Bauer c8040003f0 Correctly set windows doubles
mingw is the toolchain name but it is actually run on a window kernel
2018-10-17 17:03:00 -05:00
Matthew Bauer 45cc6e2a42 lib/systems: use lookup for uname.system
This is a little bit cleaner and avoids the if ... else if ... chain.
2018-10-17 14:43:49 -05:00
Matthew Bauer 8652631b13 systems/doubles.nix: add mingw doubles
this makes it easier to show what supports windows vs. unix.
2018-10-16 21:56:58 -05:00
Matthew Bauer 0e0894c37d lib/systems: add uname attrs 2018-10-16 21:48:43 -05:00
Eelco Dolstra b6bac6c144
Revert "Merge pull request #48122 from zimbatm/pkg-nixos-rebuild"
This reverts commit 10addad603, reversing
changes made to 7786575c6c.

NixOS scripts should be kept in the NixOS source tree, not in
pkgs. Moving them around is just confusing and creates unnecessary
code/history churn.
2018-10-16 20:25:44 +02:00
zimbatm b7a07313cc
move the codeName to /.codeName
Make the codeName globally accessible in the repo. The release is not
only for NixOS anymore.
2018-10-16 11:11:28 +02:00
Matthew Bauer 0b298d516a
Merge pull request #47182 from bhipple/add/mkl
mkl: init at 2019.0.117
2018-10-15 15:17:57 -05:00
Léo Gaspard 455e0ed885 generators: make toPretty handle floats correctly 2018-10-15 14:03:16 +02:00
Moritz Kiefer 6738033727
alt-ergo: 1.30->2.2.0, ocplib-simplex: 0.3->0.4 2018-10-13 17:45:45 +00:00
Ryan Mulligan 1bde5ec7e0
Merge pull request #48251 from samueldr/feature/separated-string-description
lib/types: enhances separatedString's description.
2018-10-12 16:41:21 -07:00
Samuel Dionne-Riel 0808c7cd31 lib/types: enhances separatedString's description
The previous description "string" is misleading in the full options
manual pages; they are actually concatenated strings, with a specific
character.

The empty string version ("types.string") has been special-cased to
provide a better message.
2018-10-12 19:11:16 -04:00
Bas van Dijk fceab3ec62 lib: fix wording of the overrideScope warning 2018-10-11 17:23:47 +02:00
John Ericson dd428b8f5f
Merge pull request #47980 from lopsided98/armv7l-system-config
lib/systems: use correct config for armv7l-hf-multiplatform
2018-10-09 20:59:50 -04:00
Ben Wolsieffer 50e947f529 lib/systems: use correct config for armv7l-hf-multiplatform 2018-10-06 01:01:07 -04:00
Graham Christensen 4312cfdbda
version.nix: extract revision-fetching function 2018-10-05 11:06:28 -04:00
Graham Christensen 62b3e55923
Merge pull request #47683 from NixOS/docs-lib-options
docs: lib/options.nix function documentation
2018-10-02 17:34:07 -04:00
Tobias Pflug d5166027e2 docs: lib/options.nix function documentation 2018-10-02 22:05:57 +02:00
Tobias Pflug 1d68b5ee84 docs: documentation for cleanSource 2018-10-02 22:05:06 +02:00
John Ericson 22ce614112
Merge pull request #47238 from obsidiansystems/overrideScope-order
lib: Deprecate `overrideScope` in lieu of `overrideScope'` taking arguments in the conventional order
2018-09-24 18:04:18 -04:00
John Ericson b9dce11712 lib: Make overrideScope' which takes arguments in the conventional order
The `overrideScope` bound by `makeScope` (via special `callPackage`)
took an override in the form `super: self { … }`. But this is
dangerously close to the `self: super { … }` form used by *everything*
else, even other definitions of `overrideScope`! Since that
implementation did not even share any code either until I changed it
recently in 3cf43547f4, this inconsistency
is almost certainly an oversight and not intentional.

Unfortunately, just as the inconstency is hard to debug if one just
assumes the conventional order, any sudden fix would break existing
overrides in the same hard-to-debug way. So instead of changing the
definition a new `overrideScope'` with the conventional order is added,
and old `overrideScope` deprecated with a warning saying to use
`overrideScope'` instead. That will hopefully get people to stop using
`overrideScope`, freeing our hand to change or remove it in the future.
2018-09-24 17:50:11 -04:00
Benjamin Hipple d7c1d04af4 mkl: init at 2019.0.117
This packags the Intel Math Kernel library on x86-64 platforms, which is a
dependency for many data science and machine learning packages.

Upstream, Intel provides proprietary binary RPMs with a permissive
redistribution license. These have been repackaged in both Debian and Anaconda,
so we are not the first distribution to redistribute.
2018-09-22 15:28:39 -04:00
Jörg Thalheim 83d89edc6e
Merge pull request #46336 from Infinisil/overrideExisting
lib: Improve overrideExisting implementation
2018-09-18 11:37:30 +01:00
John Ericson 226d574870 Merge remote-tracking branch 'upstream/master' into darwin-android-ndk-for-master 2018-09-17 22:48:25 -04:00
John Ericson 6769437186 androidndk: Add Darwin support
Also switch Linux to using the official sha1 hashes for consistency.
They are gotten from https://developer.android.com/ndk/downloads/.
2018-09-17 22:34:37 -04:00
Silvan Mosberger c7104d97c8
lib.overrideExisting: Better example 2018-09-17 23:28:47 +02:00
Silvan Mosberger afd8620621
lib/tests: Add overrideExisting tests 2018-09-17 22:40:08 +02:00
Graham Christensen 4c7f0714c9
Merge pull request #36287 from shlevy/lib-tests-default
lib/tests: Add check-eval.nix to run simple tests.
2018-09-16 18:38:47 -04:00
Maximilian Bosch 6d6cbd316d pythonmagick: fix build (#46469)
The original build broke with the following linker issue:

```
  CXXLD    _PythonMagick.la
/nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/ld: cannot find -l-L/nix/store/4gh6ynzsd5ndx37hmkl62xa8z30k43y1-imagemagick-6.9.9-34/lib
collect2: error: ld returned 1 exit status
```

This happens since `BOOST_PYTHON_LIB` wasn't set properly, however
`_PythonMagick.la` was linked with `-l$(BOOST_PYTHON_LIB)
$(MAGICK_LIBS)`. With an empty `BOOST_PYTHON_LIB` the linker got
confused.

To work around this, the `boost` library directory needs to be specified
explicitly. To ensure that the changes take effect, the original
`configure` script shipped with `$src` needs to be removed and recreated
using the `autoreconfHook`.

Additionally the `imagemagick` license (https://spdx.org/licenses/ImageMagick.html)
needs to be added to `lib/licenses.nix` to document the proper license
of `pythonmagick` in the meta section.
2018-09-10 11:59:51 +02:00
Silvan Mosberger 5cfdec6e94
lib: Improve overrideExisting implementation 2018-09-07 21:00:14 +02:00
Profpatsch efdf618330 lib: move assertMsg and assertOneOf to their own library file
Since the `assertOneOf` uses `lib.generators`, they are not really trivial
anymore and should go into their own library file.
2018-09-06 18:14:27 +02:00
Profpatsch 3e45b61a99 lib/trivial: add a few examples of usage of assertMsg/assertOneOf 2018-09-06 18:14:27 +02:00
Profpatsch 320cdecd16 lib/trivial: add assertOneOf 2018-09-06 18:14:27 +02:00
Profpatsch 0e2aa97f3a lib/trivial: add assertMsg 2018-09-06 18:14:27 +02:00
Shea Levy 18337f3ece
Merge branch 'no-toPath' 2018-09-06 08:09:53 -04:00
xeji c23ec2794d
Merge pull request #46011 from markuskowa/homepages-2
Cleanup homepage links
2018-09-03 23:32:52 +02:00
Markus Kowalewski 7422953eb0
lsof: add license + update homepage
lib/licenses: add purdue style BSD license
2018-09-03 22:36:27 +02:00
Vladimír Čunát 608730af44
lib/trivial.nix: fix missing parens
Broken in 62dca7c9a; the tricky thing is that it depends on nix version.
Explanation: https://github.com/NixOS/nix/issues/629
2018-09-03 14:18:26 +02:00
Silvan Mosberger 9113696051
Merge pull request #45038 from symphorien/optopt
module system: rework module merging
2018-08-30 20:08:45 +02:00
Jan Tojnar 7d1968c0e3
Nix minimal version: 1.11 -> 2.0
Placeholders are just too convenient.
2018-08-30 08:09:54 -04:00
Jörg Thalheim 9efffe0135 hurd: cleanup unmaintained target
This has been not touched in 6 years. Let's remove it to cause less
problems when adding new cross-compiling infrastructure.
This also simplify gcc significantly.
2018-08-28 22:18:02 +01:00
Symphorien Gibol 526d604670 module system: rework module merging
The asymptotic complexity is now much lower.
2018-08-27 17:11:58 +02:00
Matthew Bauer 379fc894de Merge remote-tracking branch 'origin/master' into staging 2018-08-21 15:41:53 -05:00
CrystalGamma 72d161f548 [RFC] ppc64le enablement (#45340)
* ppc64le enablement

* gcc, glibc: properly handle __float128

* lib/systems, stdenv: syntax cleanup

* gcc7: remove ugly hack

* gcc: add/update __float128 flags

* stdenv: add another pair of quotes for consistency

* gcc: move __float128 flag for ppc64le-glibc into common/platform-flags.nix
2018-08-21 15:31:34 -04:00
Aaron Andersen 343e10aaa6 function rewritten by @Infinisil 2018-08-21 20:11:28 +02:00
Aaron Andersen 74d446176e as requested:
- moved function into strings.nix
- renamed function from makePerl5Lib
- removed duplicates entries in the resulting value
- rewrote the function from scratch after learning a few things (much cleaner now)
2018-08-21 20:11:28 +02:00
John Ericson 3cf43547f4
lib: Use lib.fixed-points.extends to avoid repetition
Another attempt after my sloppy 48ccdf322d.

@Infinisil, thanks again, reverted in 4794aa5de2 and explained my mistakes in 48ccdf322d (commitcomment-29678643). I start with their work and provide this proof of this commit's correctness:
```nix
(lib.fixedPoints.extends (lib.flip g) f) # now
((f: rattrs: self: let super = rattrs self; in super // f self super) (lib.flip g) f) # inline extends
(self: let super = f self; in super // (lib.flip g) self super) # beta reduce
(self: let super = f self; in super // g super self)  # beta reduce
(self_: let super = f self_; in super // g super self_)  # alpha rename
(self_: let super = f self_; in super // g super self_) # original, same
```

Eventually we might harmonize `overrideScope`'s `g` parameter with the general pattern, but I leave that breaking change as a separate step. Best not to refactor and break at once, and at least the abstractions make the oddity clearer.
2018-08-20 13:09:15 -04:00
Markus Kowalewski 6d95b55d3c
xfig: 3.2.5b -> 3.2.7a
init fig2dev as separate package (3.2.7a).
fig2dev was included in xfig in the previous version.
2018-08-20 00:43:11 +02:00
Markus Kowalewski 17702d0416
curl: add license 2018-08-16 21:38:59 +02:00
zimbatm 9976f37c77
Merge pull request #44896 from cdepillabout/vbox-extpack
add derivation for the virtualbox oracle extension pack
2018-08-15 18:05:07 +01:00
Profpatsch d817452e29 lib/recursiveUpdateUntil: add a test & release note for fix 2018-08-15 17:16:56 +02:00
Mathijs Kwik b63ec64521 lib/recursiveUpdateUntil: fix code to match documentation
$ nix repl lib
Welcome to Nix version 2.0.2. Type :? for help.

Loading 'lib'...
Added 350 variables.

-- this is the exact example from the function's documentation:
nix-repl> recursiveUpdateUntil (path: l: r: path == ["foo"]) {
                   # first attribute set
                   foo.bar = 1;
                   foo.baz = 2;
                   bar = 3;
                 } {
                   #second attribute set
                   foo.bar = 1;
                   foo.quz = 2;
                   baz = 4;
                 }
{ bar = 3; baz = 4; foo = { bar = 1; baz = 2; quz = 2; }; }

-- although the documentation says:
{
    foo.bar = 1; # 'foo.*' from the second set
    foo.quz = 2; #
    bar = 3;     # 'bar' from the first set
    baz = 4;     # 'baz' from the second set
}
2018-08-15 17:16:56 +02:00
Vladimír Čunát fecb444e18
lib/strings: guard against an easy mistake
This would catch the bad `fwknop` flags fixed in 580cab57e4,
during evaluation already.
2018-08-12 10:17:08 +02:00
(cdep)illabout 18869d85f9
Add the virtualbox-puel license to the licenses file. 2018-08-08 23:21:18 +09:00
Matthew Bauer a22797d356 systems: fix netbsd triple parsing
binutils expects x86_64-unknown-netbsd<version> (only 3 parts!). Any other combo seems to fail.

Also handle darwin versions similarly.

/cc @Ericson2314
2018-07-28 19:54:09 -04:00
Bas van Dijk ebcdb822f8 elk: 6.2.4 -> 6.3.2
* The ELK stack is upgraded to 6.3.2.

* `elasticsearch6`, `logstash6` and `kibana6` now come with X-Pack which is
  a suite of additional features. These are however licensed under the unfree
  "Elastic License".

* Fortunately they also provide OSS versions which are now packaged
  under: `elasticsearch6-oss`, `logstash6-oss` and `kibana6-oss`.
  Note that the naming of the attributes is consistent with upstream.

* The test `nix-build nixos/tests/elk.nix -A ELK-6` will test the OSS
  version by default. You can also run the test on the unfree ELK using:
  `NIXPKGS_ALLOW_UNFREE=1 nix-build nixos/tests/elk.nix -A ELK-6 --arg enableUnfree true`
2018-07-28 00:01:31 +02:00
Profpatsch 62dca7c9ab lib/trivial: move zipIntBits to its own file
The amount of implementation detail really should not be the first thing in a
prominent file called `trivial.nix`.
2018-07-26 20:36:45 +02:00
Profpatsch af10842940 lib/trivial: unify & improve docstrings
- add section headers
- unify comment syntax
- add examples

Tested with:
nix-instantiate --strict --eval ./lib/tests/misc.nix
2018-07-26 20:36:45 +02:00
John Q Crosscompiler 7cc62144b2
systems: Allow detection of powerpc and sparc 2018-07-26 09:33:36 -04:00
volth cc55a3ebcb treewide: fix build with disallowed aliases (#43872)
fixes build with disallowed aliases
2018-07-21 22:03:24 -04:00
volth 6d2857a311 [bot] treewide: remove unused 'inherit' in let blocks 2018-07-20 19:38:19 +00:00
volth 87f5930c3f [bot]: remove unreferenced code 2018-07-20 18:48:37 +00:00
André-Patrick Bubel 0103ae2f6d
licenses: Add CC-BY-NC-4.0 2018-07-16 14:08:18 +02:00
Matthieu Coudron 5a9ba174bd lib.debug: fix traceValSeqFn
was calling the wrong parent version.
2018-07-15 09:36:08 +09:00
Silvan Mosberger 4794aa5de2
Revert "lib: Use lib.fixed-points.extends to avoid repetition"
This reverts commit 48ccdf322d.
2018-07-12 02:04:06 +02:00
John Ericson 48ccdf322d lib: Use lib.fixed-points.extends to avoid repetition 2018-07-09 12:33:43 -04:00
volth e9a6c7cebb lib.concatMap and lib.mapAttrs to be builtins 2018-07-05 03:08:00 +00:00
Matthew Bauer dc72e8ac06 lib.generators.toPlist: add floats
Nix now supports floats & we can pretty easily map them to Plist’s
<real></real> type. Note that I am unsure how this affects older
version of Nix that may or may not have builtins.isFloat available.
Make sure this satisfies minver.nix’s "1.11" requirement.
2018-07-03 17:14:00 -04:00
Richard Marko 4a310a0404 lib: add float option type 2018-07-03 00:11:11 +02:00
Dan Peebles ff9999ad1b linux: translate config to structured config
Instead of using a string to describe kernel config, use a nix
attribute set, then converted to a string.
- allows to override the config, aka convert 'yes' into 'modules' or
vice-versa
- while for now merging different configs is still crude (last spec wins),
at least there should be only one CONFIG_XYZ value compared to the current string
config where the first defined would be used and others ignored.

[initial idea by copumpkin in 2016, a major rebase to 2018 by teto]
2018-06-30 16:01:41 +03:00
Matthew Bauer a44d33aac1
Merge pull request #42669 from obsidiansystems/upstream-plist
Upstream PLIST handling
2018-06-28 15:26:31 -04:00
Matthew Bauer 337b58950b generators: refactor toPlist
Address PR comments

Refactors

- Rename toPLIST -> toPlist
2018-06-28 15:24:12 -04:00
Matthew Bauer d361371d23 generators: refactor toPLIST 2018-06-28 11:11:19 -04:00
Matthew Bauer 3210dd3039 generators: add PLIST handling
/cc @LnL7 @3noch
2018-06-27 15:35:07 -04:00
xeji 249be1c560
Merge pull request #42138 from NixOS/yegortimoshenko-patch-6
lib/modules: decrease mkOptionDefault priority to 1500
2018-06-27 20:29:39 +02:00
Michael Raskin b8ffd2459d
Merge pull request #40418 from oxij/lib/fix-module-aliases
lib, nixos: fix module aliases in presence of defaults
2018-06-27 09:24:50 +00:00
Matthew Justin Bauer e4d9ce9061
Merge pull request #42599 from obsidiansystems/xcodever-in-system
xcode: add xcodePlatform to system
2018-06-26 10:56:57 -04:00
Matthew Bauer 0bfffbc5e1 xcode: add xcodePlatform to system
This give us a little bit more control over what target we are using.
Eventually we can target other things like WatchOS or MacOS.
2018-06-25 22:18:23 -04:00
Matthew Justin Bauer c16eb04425
Merge pull request #42399 from obsidiansystems/xcodever-in-system
xcode: add xcodeVer to system
2018-06-25 21:59:01 -04:00
Matthew Bauer 9b0b31d981 xcode: add xcodeVer to system
This version number controls which xcode version to use when building
cross to iOS.
2018-06-25 21:57:24 -04:00
Théo Zimmermann 4033416845
Mark more unfree licenses as unfree. See also #20256. 2018-06-24 18:31:54 +02:00
Matthew Bauer c8fd285c8d android: add ndkVer to resolve ndk ambiguity
It wasn’t exactly clear which NDK you were using previously. This adds
an attribute to system that handles what version of the NDK we should
use when building things.

/cc @Ericson2314
2018-06-22 11:06:17 -04:00
Matthew Bauer cf09ffe9aa android: Use NDK 17 for aarch32 2018-06-22 09:33:25 -04:00
Yegor Timoshenko 441796cb16
lib/modules: bump mkOptionDefault priority to 1500 2018-06-17 23:29:16 +03:00
Ben Wolsieffer 7cb01d58b2 platforms/raspberrypi: enable kernelAutoModules 2018-06-12 20:44:23 +03:00
Jan Malakhovski 449d43fe01 lib: fix and simplify doRename
Before this change `mkRenamedOptionModule` would override option defaults
even when the old option name is left unused. For instance

```nix
{
  optios = {
    services.name.new = mkOption {
      default = { one = {}; };
    };
  };
  imports = [
    (mkRenamedOptionModule [ "services" "name" "old" ] [ "services" "name" "new" "two" ])
  ];
  config = {};
}
```

would evaluate to

`{ config.services.name.new = { two = {}; }; }`

when you'd expect it to evaluate to

`{ config.services.name.new = { one = {}; }; }`.
2018-06-11 15:06:27 +00:00
Jan Malakhovski c0c43e9c07 lib: simplify mkAliasAndWrapDefinitions 2018-06-11 15:06:27 +00:00
Izorkin 35ce5c1c8e maxscale: init at 2.1.17 (#33835) 2018-06-10 22:50:36 +02:00
volth 3c2bbe217c lib: bitAnd, bitOr, bitXor (bitsize-agnostic fallback function) (#41491)
* lib: bitAnd, bitOr, bitXor

* lib: test for bitAnd, bitOr, bitXor

* lib: bitsize-agnostic zipIntBits

* lib: bitNot

* lib: bitNot
2018-06-10 21:25:48 +02:00
volth 4e85c4ff27 lib: add groupBy (#38612) 2018-06-10 19:31:09 +02:00
Profpatsch f98272d6e2 Revert "lib: bitAnd, bitOr, bitXor" 2018-06-05 18:45:20 +02:00
Jörg Thalheim d036073bcf
Merge pull request #41373 from volth/bitwise
lib: bitAnd, bitOr, bitXor
2018-06-03 11:38:56 +01:00
volth 078b9b4c2b
lib: test for bitAnd, bitOr, bitXor 2018-06-02 21:13:43 +00:00
volth 0addac3b0a lib: bitAnd, bitOr, bitXor 2018-06-01 21:36:31 +00:00
Tuomas Tynkkynen e864247f08 Merge branch 'plat-fix-for-merge-2' into master 2018-06-01 20:08:08 +03:00
Tuomas Tynkkynen 27bb4da344 platforms.nix: More rpi2 cleanup 2018-05-31 18:06:09 +03:00
Tuomas Tynkkynen 3abdd4f1e3 platforms.nix: Clean up obsolete cruft from raspberrypi2 2018-05-31 18:06:09 +03:00
Tuomas Tynkkynen db2988f7bd platforms.nix: Clean up obsolete cruft from raspberrypi
Works fine without, and the 'DRM n' is actually preventing the mainline
VC4 driver from building.
2018-05-31 18:06:09 +03:00
Tuomas Tynkkynen 96edbe4a0e linux_rpi: Specify defconfig in kernel expression
In particular, now the mainline kernel can be built on the RPi 1 as well
(so kernelBaseConfig should always be a mainline defconfig from now on).
And RPi 2 users can now use linux_rpi without doing the
`nixpkgs.config.platform = lib.systems.platforms.raspberrypi2;` dance.
2018-05-31 18:06:09 +03:00
John Ericson 72fa40f72d lib: Fix nix-env -qaP -f . --xml --meta
A merge undid my fix in d437f2c365.
2018-05-29 13:06:17 -04:00
Tuomas Tynkkynen 2760b24462 Merge remote-tracking branch 'upstream/master' into staging 2018-05-26 19:01:18 +03:00
Graham Christensen 951e9099c0
Merge pull request #36344 from grahamc/fancy-option-names
lib/options: teach showOptions about funny option names
2018-05-25 20:55:17 -04:00
Jan Malakhovski ad35019501 Merge branch 'master' into staging
Fixed conflicts:
- lib/systems/for-meta.nix: in favor of staging
- pkgs/os-specific/darwin/xcode/default.nix: in favor of master
2018-05-26 00:20:17 +00:00
John Ericson d437f2c365 lib: Fix nix-env -qaP -f . --xml --meta
The function value cannot be serialized so nix-env was mad. Turns out we can
just remove it like we do in `lib/systems/inspect.nix`.
2018-05-24 10:43:14 -04:00
Shea Levy 6da6accd30
treewide: Remove uses of builtins.toPath.
toPath has confusing semantics and is never necessary; it can always
either just be omitted or replaced by pre-concatenating `/.`. It has
been marked as "!!! obsolete?" for more than 10 years in a C++
comment, hopefully removing it will let us properly deprecate and,
eventually, remove it.
2018-05-22 16:42:02 -04:00
Tuomas Tynkkynen 003473613a Merge remote-tracking branch 'upstream/master' into staging
Conflicts:
	pkgs/top-level/all-packages.nix
2018-05-18 03:54:38 +03:00
John Ericson c5b13f97ff
Merge pull request #40659 from bkchr/androidndk
Androidndk
2018-05-17 12:04:14 -04:00
Bastian Köcher 832a8ca087 androidndk: Fix usage as crossSystem 2018-05-17 17:22:27 +02:00
John Ericson ddbe9191ef Merge remote-tracking branch 'upstream/master' into staging
Keep the dontCheck because the test suite fails, get rid of the LDFLAGS
hack because we don't need it!
2018-05-16 15:16:08 -04:00
Samuel Dionne-Riel 136f1c4706 doc: Fixes documented default option for <name> for submodules. (#40464)
Fixes #40463

This is related to change 1d56d0c8a7
2018-05-16 18:11:36 +02:00
John Ericson f2017c40ae Merge remote-tracking branch 'upstream/master' into staging 2018-05-14 22:53:10 -04:00
Matthew Justin Bauer 165c151f7a
Merge pull request #34805 from rycee/fix/dorename
lib: make use of visible variable in doRename
2018-05-14 18:08:26 -05:00
Frederik Rietdijk 658b7c3f2e Merge master into staging 2018-05-13 12:13:25 +02:00
John Ericson 2c5d915200 Merge commit '92b7a814f26ee1d37e989431c18518c67285a332' into staging 2018-05-13 01:02:09 -04:00
Matthew Justin Bauer f799042d41
Merge pull request #39447 from oxij/nixos/warn-missing-stateversion
nixos: warn on missing `stateVersion`
2018-05-12 14:45:06 -05:00
Jan Malakhovski 4017fdcafd lib: modules: propagate highestPrio
Yeah, it's ugly. But it's the minimal change that doesn't break anything
else.
2018-05-12 19:27:09 +00:00
John Ericson 92b7a814f2 Merge branch 'fix-gcc-with-float' 2018-05-12 15:21:30 -04:00
John Ericson f2004e6287 lib: Fix float handling for Aarch32
Forgot to adjust default so abi with explicit float attr would be used.
2018-05-12 15:18:31 -04:00
John Ericson 6f40d18d44 prebuilt android cc: Edit wrapper to pass the right -m flags for armv7a
(cherry picked from commit 827ef09140)
2018-05-12 15:16:16 -04:00
John Ericson 6a96dc0417 lib/system: Remove float from androideabi
There are two different official variations which differ in their float
support, so such a blanket statement is invalid.
`lib.systems.platforms.*android` already handles each case correctly.

Correcting an error in 827ef09140.
2018-05-11 20:16:28 -04:00
John Ericson 827ef09140 prebuilt android cc: Edit wrapper to pass the right -m flags for armv7a 2018-05-11 19:17:35 -04:00
John Ericson 28bacc2093 lib/systems: Add assertion to "android" ABI
This is analogous to the GNU assertion.
2018-05-11 19:03:07 -04:00
John Ericson f4de669777 lib/systems/inspect: Fix after assertions
Function are never equal in Nix, so we need to filter out this attribute
in ABIs.
2018-05-11 19:02:50 -04:00
John Ericson 98a1b89945
Merge pull request #40385 from obsidiansystems/lib-android-platforms
lib: Add 32-bit Android platforms
2018-05-11 19:01:22 -04:00
John Ericson e3f6c6d18d lib: Add 32-bit Android platforms 2018-05-11 18:41:55 -04:00
John Ericson 81387c2e78 Merge remote-tracking branch 'upstream/master' into staging 2018-05-11 17:12:04 -04:00
John Ericson 0a77a72895
Merge pull request #40378 from obsidiansystems/lib-platform-sort
lib/systems: Sort platforms, and space CPUs
2018-05-11 17:10:49 -04:00
John Ericson 341794a4b9 lib/systems: Sort platforms, and space CPUs 2018-05-11 15:02:18 -04:00
John Ericson ee4b56edd3 Merge remote-tracking branch 'upstream/master' into staging 2018-05-11 14:36:08 -04:00
John Ericson 9e9cdd7027 lib: Add more configure flag helpers
Add with/without to match enable/disable, and add
`--{enable,with}-key=value` versions of both.
2018-05-11 17:43:35 +02:00
John Ericson f18ddabee7 Merge remote-tracking branch 'upstream/master' into lib-float 2018-05-10 18:13:00 -04:00
John Ericson 1fe81a4bcd lib: Clean up float/fpu options
ARM ABIs now have a float field. This is used as a fallback to lessen
our use of `platform.gcc.float`. I didn't know what the MIPs convention
is so I kept using `platform.gcc.float` in that case.
2018-05-10 18:02:00 -04:00
Matthew Justin Bauer 4ec9c4b377
Merge pull request #40255 from matthewbauer/remove-enableIfAvailable
treewide: remove lib.meta.enableIfAvailable
2018-05-10 16:00:16 -05:00
John Ericson 67db915a43 Merge remote-tracking branch 'upstream/master' into staging 2018-05-10 16:35:04 -04:00
John Ericson 58b2e875c2 lib/systems: Prohibit "gnu" ABI (*-gnu) with 32-bit ARM
It is ambiguous, and therefore banned within GCC.
2018-05-10 15:05:23 -04:00
Frederik Rietdijk 64c8c6dcb3 Merge master into staging 2018-05-10 09:30:56 +02:00
John Ericson 006422d08d Merge commit 'feb648ce59ffbed94c58133eb7aa2761992a35e1' into staging 2018-05-10 01:55:26 -04:00
John Ericson c17f79ea3b Merge remote-tracking branch 'upstream/master' into lib-platform-simplify 2018-05-10 01:40:44 -04:00
John Ericson feb648ce59 Merge commit '70963b382f3f820ba6d3bc3b3aaf50a2957ec1ff' into lib-platform-simplify 2018-05-10 01:40:38 -04:00
John Ericson a02be2bd85 treewide: Get rid of *Platform.arch
Use `parsed.cpu.name` or `platform.gcc.arch` instead.
2018-05-10 01:37:31 -04:00
John Ericson 3bc923bf5f Merge remote-tracking branch 'upstream/master' into uclibc 2018-05-10 00:23:12 -04:00
John Ericson b3ef322770 Merge commit '70963b382f3f820ba6d3bc3b3aaf50a2957ec1ff' into uclibc 2018-05-10 00:18:51 -04:00
John Ericson f063a860d6 xbursttools: Cleanup slightly 2018-05-09 23:40:13 -04:00
John Ericson e42a7a5c0b lib/systems: Add uClibc just like MUSL 2018-05-09 23:39:23 -04:00
John Ericson 0b45f0ebf9
Merge pull request #40261 from obsidiansystems/more-arm
lib/systems: Parse more arm cpu types
2018-05-09 20:05:10 -04:00
John Ericson 3fa0ba9177 lib/systems: Parse more arm cpu types 2018-05-09 18:57:39 -04:00
Matthew Bauer c37b93bd52 treewide: remove lib.meta.enableIfAvailable 2018-05-09 16:21:22 -05:00
Matthew Bauer 8a98cf97e9 lib.makeSearchPath: allow null in search path
This makes things match ‘buildInputs’ where inputs are allowed to be
null.
2018-05-09 15:44:06 -05:00
Matthew Bauer 6748534d83 Merge remote-tracking branch 'upstream/master' into staging 2018-05-08 09:36:00 -05:00
Robert Helgesson 08e8701673
lib.types: fix loaOf behavior for long lists
Assigning a list of 10 or more elements to an option having the type
`loaOf a` produces a configuration value that is not honoring the
order of the original list. This commit fixes this and a related issue
arising when 10 or more lists are merged into this type of option.
2018-05-07 20:23:52 +02:00
Silvan Mosberger facd51575e lib/types: remove unnecessary coerceFunc assertion 2018-05-06 23:58:36 +02:00
Silvan Mosberger cd5736116c lib/types: clear up coercedTo description 2018-05-06 23:58:36 +02:00
Silvan Mosberger b16a69289a lib/types: Add coercedTo unsound tests 2018-05-06 23:58:36 +02:00
Silvan Mosberger ef8996f15e lib/types: Fix coercedTo check
Without this change

  (coercedTo str toInt int).check "foo"

would evaluate to true, even though

  (coercedTo str toInt int).merge {} [{ value = "foo"; }]

will throw an error because "foo" can't be coerced to an int.
2018-05-06 23:58:36 +02:00
Ben Gamari 8b32cfdbc0 lib.systems.gnu: Accept gnueabi as a gnu platform 2018-05-03 17:06:01 -04:00
John Ericson db4f96b3cb lib/systems: Fix eval for iphone32* examples
Whoops messed up 9a845de873 slightly.
2018-05-01 13:04:57 -04:00
John Ericson 9a845de873 lib/systems: Update iOS examples
The commented-out configs are @shlevy's old known-good ones. I changed
them as needed to play nice with lib.systems.parse but did not test so
leaving them as comments for now.
2018-05-01 01:16:27 -04:00
John Ericson af55a0c300
Merge pull request #39788 from obsidiansystems/aarch32-for-master
lib: Improve deprecation message for `isArm`
2018-04-30 23:28:45 -04:00
John Ericson 57723e947a Merge remote-tracking branch 'upstream/master' into aarch32 2018-04-30 23:06:59 -04:00
Maximilian Bosch 9274ea3903
treewide: rename version attributes
As suggested in https://github.com/NixOS/nixpkgs/pull/39416#discussion_r183845745
the versioning attributes in `lib` should be consistent to
`nixos/version` which implicates the following changes:

* `lib.trivial.version` -> `lib.trivial.release`
* `lib.trivial.suffix` -> `lib.trivial.versionSuffix`
* `lib.nixpkgsVersion` -> `lib.version`

As `lib.nixpkgsVersion` is referenced several times in `NixOS/nixpkgs`,
`NixOS/nix` and probably several user's setups. As the rename will cause
a notable impact it's better to keep `lib.nixpkgsVersion` as alias with
a warning yielded by `builtins.trace`.
2018-04-28 14:23:53 +02:00
Maximilian Bosch 39909289f4
lib: deduplicate version/suffix references
The logic regarding the generated `.version-suffix` file is already
defined in `lib/trivial.nix` and shouldn't be duplicated in
`nixos/version`.
2018-04-28 14:23:13 +02:00
Profpatsch 900cec79a0 lib/debug: add replacement instructions & release notes
for every deprecated function.
2018-04-27 18:59:39 +02:00
Profpatsch 5012c49fc0 lib/debug: document module & functions, prune imports 2018-04-27 18:59:39 +02:00
Profpatsch e49f40e1ca lib/debug: deprecate traceCallXml
Incompletely documented, and a FIXME/bug that has been there for years.
2018-04-27 18:59:39 +02:00
Profpatsch fd54a946ca lib/debug: deprecate addErrorContextToAttrs
The function isn’t used anywhere and `addErrorContext` is an undocumented
builtin.
The builtin is explicitely qualified at its two uses in the module system.
2018-04-27 18:59:39 +02:00
Profpatsch 562286aa56 lib/debug: deprecate traceValIfNot
The function is only used in exactly one module and overly specific (`c` must be
a true predicate for `x`, if not, a specific trace is called).
2018-04-27 18:59:39 +02:00
Profpatsch 7365671fb2 lib/debug: deprecate attrNamesToStr, traceXMLVal(Marked)
`attrNamesToStr` is very specific (and pretty trivial), so it doesn’t make sense
to have it in the library.
`traceXMLVal(Marked)` are just a builtin and `trace` and not very useful in
general (trace output should not be parsed anyway).
2018-04-27 18:59:39 +02:00
Profpatsch a7fdd10bf3 lib/debug: deprecate & modernize showVal
The code is re-implemented in terms of `generators.toPretty`, but is strictly
less general than `traceValSeqN`, so we deprecate it.
2018-04-27 18:59:39 +02:00
Profpatsch a455637d28 lib/debug: remove the deprecated strict function
The grace period was long enough.
2018-04-27 18:59:39 +02:00
Profpatsch a5f6cdfd7e lib/debug: add traceValFn, traceValSeqFn, traceValSeqNFn
Being able to modify the value on-the-fly before printing is very useful in
practice.
2018-04-27 18:59:39 +02:00
John Ericson b9acfb4ecf treewide: isArm -> isAarch32
Following legacy packing conventions, `isArm` was defined just for
32-bit ARM instruction set. This is confusing to non packagers though,
because Aarch64 is an ARM instruction set.

The official ARM overview for ARMv8[1] is surprisingly not confusing,
given the overall state of affairs for ARM naming conventions, and
offers us a solution. It divides the nomenclature into three levels:

```
ISA:             ARMv8   {-A, -R, -M}
                 /    \
Mode:     Aarch32     Aarch64
             |         /   \
Encoding:   A64      A32   T32
```

At the top is the overall v8 instruction set archicture. Second are the
two modes, defined by bitwidth but differing in other semantics too, and
buttom are the encodings, (hopefully?) isomorphic if they encode the
same mode.

The 32 bit encodings are mostly backwards compatible with previous
non-Thumb and Thumb encodings, and if so we can pun the mode names to
instead mean "sets of compatable or isomorphic encodings", and then
voilà we have nice names for 32-bit and 64-bit arm instruction sets
which do not use the word ARM so as to not confused either laymen or
experienced ARM packages.

[1]: https://developer.arm.com/products/architecture/a-profile

(cherry picked from commit ba52ae5048)
2018-04-25 15:50:41 -04:00
John Ericson ba52ae5048 treewide: isArm -> isAarch32
Following legacy packing conventions, `isArm` was defined just for
32-bit ARM instruction set. This is confusing to non packagers though,
because Aarch64 is an ARM instruction set.

The official ARM overview for ARMv8[1] is surprisingly not confusing,
given the overall state of affairs for ARM naming conventions, and
offers us a solution. It divides the nomenclature into three levels:

```
ISA:             ARMv8   {-A, -R, -M}
                 /    \
Mode:     Aarch32     Aarch64
             |         /   \
Encoding:   A64      A32   T32
```

At the top is the overall v8 instruction set archicture. Second are the
two modes, defined by bitwidth but differing in other semantics too, and
buttom are the encodings, (hopefully?) isomorphic if they encode the
same mode.

The 32 bit encodings are mostly backwards compatible with previous
non-Thumb and Thumb encodings, and if so we can pun the mode names to
instead mean "sets of compatable or isomorphic encodings", and then
voilà we have nice names for 32-bit and 64-bit arm instruction sets
which do not use the word ARM so as to not confused either laymen or
experienced ARM packages.

[1]: https://developer.arm.com/products/architecture/a-profile
2018-04-25 15:28:55 -04:00
Profpatsch c84dad316a lib/generators: print paths without quotes & move function down 2018-04-25 15:31:17 +02:00