Silvan Mosberger
c34e96f7e0
Make function arguments retain position info
...
This allows querying the location of function arguments. E.g.
builtins.unsafeGetAttrPos "x" (builtins.functionArgs ({ x }: null))
=> { column = 57; file = "/home/infinisil/src/nix/inst/test.nix"; line = 1; }
2020-04-02 05:52:52 +02:00
Eelco Dolstra
74024515a3
Support registry entries that must match exactly
...
An example use is for pinning the "nixpkgs" entry the system-wide
registry to a particular store path. Inexact matches
(e.g. "nixpkgs/master") should still use the global registry.
2020-04-01 23:12:45 +02:00
Eelco Dolstra
bd10a07d17
Registry: Use a struct instead of a tuple for entries
2020-04-01 23:03:27 +02:00
Eelco Dolstra
77ffaea4fa
Add a system-wide flake registry /etc/nix/registry.json
...
One application for this is pinning the 'nixpkgs' flake to the exact
revision used to build the NixOS system, e.g.
{
"flakes": [
{
"from": {
"id": "nixpkgs",
"type": "indirect"
},
"to": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github",
"rev": "b0c285807d6a9f1b7562ec417c24fa1a30ecc31a"
}
}
],
"version": 2
}
2020-04-01 22:56:50 +02:00
Eelco Dolstra
4fdec5f61d
Merge remote-tracking branch 'origin/master' into flakes
2020-04-01 00:03:50 +02:00
Eelco Dolstra
03b56e96bf
Typo
2020-03-31 23:55:07 +02:00
Eelco Dolstra and GitHub
a7540294cf
Merge pull request #3460 from NixOS/dev-shell
...
Backport 'nix dev-shell' from the flakes branch
2020-03-31 14:46:15 +02:00
Eelco Dolstra
3166b97174
nix shell -> nix dev-shell
2020-03-31 13:45:28 +02:00
mlatus
12556e5709
fix placeholder not substituted in passAsFile
2020-03-31 19:40:16 +08:00
Eelco Dolstra
e1a94ad852
Backport 'nix dev-shell' from the flakes branch
...
This also adds a '--profile' option to 'nix build' (replacing 'nix-env
--set').
2020-03-30 19:16:45 +02:00
Eelco Dolstra
367577d9a6
Fix macOS build
2020-03-30 17:00:40 +02:00
Eelco Dolstra
d15d91cad1
Makefile cleanup
2020-03-30 16:50:13 +02:00
Eelco Dolstra
e322a16523
Remove global -I flags
...
(cherry picked from commit 2c692a3b14 )
2020-03-30 15:30:19 +02:00
Eelco Dolstra
2c692a3b14
Remove global -I flags
2020-03-30 14:39:33 +02:00
Eelco Dolstra
e0a0ae0467
Move fetchers from libstore to libfetchers
2020-03-30 14:04:53 +02:00
Eelco Dolstra
2287cc6486
Fix segfault
2020-03-30 13:31:55 +02:00
Julian Stecklina
40c023ecfe
fetchGit: don't use std::filesystem to filter git repos
...
Using std::filesystem means also having to link with -lstdc++fs on
some platforms and it's hard to discover for what platforms this is
needed. As all the functionality is already implemented as utilities,
use those instead.
2020-03-30 00:32:42 +02:00
Bjørn Forsman and Julian Stecklina
f686efeed4
fetchGit: fix submodule corner case by fetching all refs from cacheDir
...
Due to fetchGit not checking if rev is an ancestor of ref (there is even
a FIXME comment about it in the code), the cache repo might not have the
ref even though it has the rev. This doesn't matter when submodule =
false, but the submodule = true code blows up because it tries to fetch
the (missing) ref from the cache repo.
Fix this in the simplest way possible: fetch all refs from the local
cache repo when submodules = true.
TODO: Add tests.
2020-03-29 22:29:58 +02:00
Bjørn Forsman and Julian Stecklina
cc522d0d23
fetchGit: fix submodules = true for dirty trees
2020-03-29 22:29:58 +02:00
Bjørn Forsman and Julian Stecklina
b306b7039e
fetchGit: checkout rev instead of latest ref
...
Major bugfix for the submodules = true code path.
TODO: Add tests.
2020-03-29 22:29:58 +02:00
Bjørn Forsman and Julian Stecklina
369fffd6f1
fetchGit: add submodules attribute to the .link file
...
The .link file is used as a lock, so I think we should put the
"submodule" attribute in there since turning on submodules creates a new
.link file path.
2020-03-29 22:29:58 +02:00
Bjørn Forsman and Julian Stecklina
6864ad7cf5
fetchGit: fix submodule output attribute
...
Before this change it would be false for all evaluations but the first.
Now it follows the input argument (as it should).
2020-03-29 22:29:58 +02:00
Bjørn Forsman and Julian Stecklina
002a3a95dc
fetchGit: fix "fatal: couldn't find remote ref refs/heads/master" issue with submodules
2020-03-29 22:29:58 +02:00
Julian Stecklina and Julian Stecklina
cc4fe977e5
Link to stdc++fs
...
Some platforms seem to still require linking with stdc++fs to enable
STL std::filesystem support.
2020-03-29 22:29:58 +02:00
Julian Stecklina and Julian Stecklina
435366ed3c
Rename fetchGit fetchSubmodules to just submodules
2020-03-29 22:29:58 +02:00
Julian Stecklina and Julian Stecklina
c8d33de777
Add git submodule fixes from @bjornfor
...
This fixes fetching repositories with no submodules and also cleans up
.git files in checkouts.
2020-03-29 22:29:57 +02:00
Julian Stecklina and Julian Stecklina
f58604ac32
Add fetchSubmodules to builtins.fetchGit
...
There are some downsides to this features:
- Submodules are not cached (unlike the root repo),
- Full checkouts are created in a temporary directory.
2020-03-29 22:29:57 +02:00
Eelco Dolstra
4989c04dd2
nix flake info --json: Dump attr-style flakeref
2020-03-28 22:59:38 +01:00
Eelco Dolstra
2fccef0c59
Warn about --override-input / --update-input flags that don't match an input
2020-03-28 19:09:36 +01:00
Eelco Dolstra
2287e2f279
nix flake info: Show flake subdirectory
2020-03-28 18:05:50 +01:00
Eelco Dolstra
015f8f1c13
Improve lock file generation
...
This is now done in a single pass. Also fixes some issues when
updating flakes with circular dependencies. Finally, when using
'--recreate-lock-file --commit-lock-file', the commit message now
correctly shows the differences.
2020-03-27 21:08:41 +01:00
Eelco Dolstra
3fa1e7dace
Fix diffLockFiles()
2020-03-27 16:15:50 +01:00
Eelco Dolstra
0a10854f85
Misc changes from the flakes branch
2020-03-24 14:34:47 +01:00
Eelco Dolstra
c85097da7c
Fix --refresh with --no-net
...
https://hydra.nixos.org/build/110879699
(cherry picked from commit 5bbe793abf )
2020-03-24 14:26:23 +01:00
Eelco Dolstra
6b824c78f1
nix: Add --refresh as an alias for --tarball-ttl 0
...
(cherry picked from commit e721f99817 )
2020-03-24 14:26:23 +01:00
Eelco Dolstra
777e21e596
nix path-info --json: Print hash in SRI format
...
(cherry picked from commit 442e665d6d )
2020-03-24 14:26:23 +01:00
Eelco Dolstra
7a8de57d3e
Pretty-print 'nix why-depends' / 'nix-store -q --tree' output
...
Extracted from 678301072f .
2020-03-24 14:26:23 +01:00
Eelco Dolstra
4260a22a55
absPath(): Use std::optional
...
(cherry picked from commit 1bf9eb21b7 )
2020-03-24 14:25:28 +01:00
Eelco Dolstra
f9611c7ae4
buildenv: Eliminate global variables, other cleanup
...
(cherry picked from commit b82f75464d )
2020-03-24 14:06:47 +01:00
Eelco Dolstra
76e7d958ed
Fix coverage build
...
https://hydra.nixos.org/build/110757285
(cherry picked from commit b430a81a1f )
2020-03-24 14:06:47 +01:00
Eelco Dolstra
231a8aa2c2
nix edit: Support non-derivation attributes
...
E.g.
$ nix edit .#nixosConfigurations.bla
now works.
(cherry picked from commit d2032edb2f )
2020-03-24 14:06:47 +01:00
Eelco Dolstra
c1ca4f0acc
findAlongAttrPath(): Return position
...
(cherry picked from commit 0b013a54dc )
2020-03-24 14:06:47 +01:00
Eelco Dolstra
1eb952d27a
findAlongAttrPath(): Throw AttrPathNotFound
...
(cherry picked from commit 6b0ca8e803 )
2020-03-24 14:06:47 +01:00
Eelco Dolstra
edc34cc1a2
Add function for quoting strings
...
(cherry picked from commit 7dcf5b011a )
2020-03-24 13:44:04 +01:00
Eelco Dolstra
5a7e7fc35f
Use std::string_view
...
(cherry picked from commit 6529490cc1 )
2020-03-24 13:26:37 +01:00
Eelco Dolstra
c34a20e1f6
EvalState::allocAttr(): Add convenience method
...
(cherry picked from commit c02da99757 )
2020-03-24 13:26:37 +01:00
Eelco Dolstra
7abe3bde8a
Merge remote-tracking branch 'origin/master' into flakes
2020-03-23 13:27:54 +01:00
Eelco Dolstra and GitHub
5885e20404
Merge pull request #3429 from LnL7/darwin-sandbox
...
darwin sandbox
2020-03-23 09:13:36 +01:00
Daiderd Jordan
2e9bc1245c
sandbox: fix /bin/sh on catalina
...
Sadly 10.15 changed /bin/sh to a shim which executes bash, this means it
can't be used anymore without also opening up the sandbox to allow bash.
Failed to exec /bin/bash as variant for /bin/sh (1: Operation not permitted).
2020-03-20 22:12:30 +01:00
Daiderd Jordan
f6c122aaeb
sandbox: allow pty devices
...
Nix now runs builds with a pseudo-terminal to enable colored build
output.
2020-03-20 21:58:45 +01:00