Commit graph

2269 commits

Author SHA1 Message Date
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
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
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