Commit Graph

2580 Commits

Author SHA1 Message Date
Frederik Rietdijk
43f71029cc Merge master into staging-next 2020-06-05 19:40:53 +02:00
Eelco Dolstra
8f9e4bef4c
Bump minver.nix to 2.2
Note: NixOS 19.03 had Nix 2.2 and 19.09 had 2.3.
2020-06-04 13:43:10 +02:00
Florian Klink
cfb4d0dfe3
Merge pull request #84032 from teto/fix_kernel_merge
Fix kernel configuration merge
2020-05-22 13:32:22 +02:00
Emily
aff9979170 lib.fake{Sri => Hash}: fix and rename
The previous hash was too short and caused evaluation-time errors like:

    invalid SRI hash 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='

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

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

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

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

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

fix: Marking MongoDB as broken on aarch64

fix: Adding libtools to the pkg imports

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

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

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

There are different tradeoffs in each case:

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

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

I think the downside of the status quo is worse.

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

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

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

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

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

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

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

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

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

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

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

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

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

We can later add versions that escape for embedding in e.g. python
scripts or similar.
2020-01-23 14:47:38 +01:00
Profpatsch
88a7f65c83 lib/cli: unexport symbols & sort with generators
lib/cli is very similar to generators, so it should follow largely the
same interface. Similar to how generators isn’t exported, we should
also namespace cli by default (plus “cli” is only three characters to
type).
2020-01-23 14:47:38 +01:00
Anderson Torres
45b400880a
Merge pull request #77855 from AndersonTorres/update/notion
notion: 3-2017050501 -> 3-2019050101
2020-01-22 07:46:22 -03:00
Silvan Mosberger
774e3d8e48
nixos/lib: Inherit type for doRename options (#78135)
nixos/lib: Inherit type for doRename options
2020-01-20 23:15:24 +01:00
Silvan Mosberger
74775d1d72
lib/attrsets: Fix error in comment for getAttrFromPath 2020-01-20 22:42:38 +01:00
Janne Heß
790cd012d0
nixos/lib: Inherit type for doRename options
Co-authored-by: Silvan Mosberger <contact@infinisil.com>
2020-01-20 22:06:20 +01:00
Franz Pletz
46773a15b3
nixos/version: fix case where .git is a symlink
Before c9214c394b and
9d396d2e42 if .git is symlink the version
would gracefully default to no git revision. With those changes an
exception is thrown instead.

This introduces a new function `pathIsGitRepo` that checks if
`commitIdFromGitRepo` fails without error so we don't have to
reimplement this logic again and can fail gracefully.
2020-01-20 00:53:44 +01:00
AndersonTorres
bdf32f33fa Notion custom license: exclude 2020-01-17 08:31:22 -03:00
Silvan Mosberger
3c2e9fa53d
Merge pull request #77704 from mayflower/also-submodules
lib.commitIdFromGitRepo: fix support for git-submodule
2020-01-16 00:44:46 +01:00
Drew Hess
370efefd8c
Replace short URL from #63103 with full URL.
The error message is already helpfully verbose, so there's little
reason to shorten the informational URL.
2020-01-15 13:47:49 +00:00
elseym
9d396d2e42
lib.commitIdFromGitRepo: fix support for git-submodule
Adds handling for relative references from .git-files, fixing a bug introduced by c9214c394b.
2020-01-14 21:08:38 +01:00
arcnmx
92b464d57d lib/types: prioritise coercedType in coercedTo
This more intuitively matches `types.either` and allows paths to be
coerced to submodules again, which was inhibited by #76861
2020-01-14 09:30:53 -08:00
Frederik Rietdijk
05a965896d
Merge pull request #77047 from NixOS/staging-next
Staging next
2020-01-14 15:44:15 +01:00
Robert Hensing
8da81465c1
Merge pull request #75539 from Gabriel439/gabriel/renderOptions
Add `pkgs.lib.encodeGNUCommandLine`
2020-01-14 12:04:05 +01:00
Frederik Rietdijk
05962c4ad5 Merge master into staging-next 2020-01-14 10:20:32 +01:00
worldofpeace
441588c9d4
Merge pull request #77575 from worldofpeace/home-manager-warnings-drop
lib/types: dont warn loaOf for home-manager namespace
2020-01-13 17:47:21 -05:00
Frederik Rietdijk
ed1b0d0bac Merge master into staging-next 2020-01-13 16:08:59 +01:00
Linus Heckemann
247c25d302
Merge pull request #77473 from mayflower/worktrees
lib.commitIdFromGitRepo: support git-worktree
2020-01-13 12:01:49 +01:00
worldofpeace
265da70e58 lib/types: dont warn loaOf for home-manager namespace
This option namespace is not a part of NixOS
so we shouldn't provide this warning for it.
2020-01-12 15:14:08 -05:00
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