Commit Graph

2293 Commits

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