Commit graph

9257 commits

Author SHA1 Message Date
Cole Helbling
c976cb0b8a
Don't retry on "unsupported protocol" error
When encountering an unsupported protocol, there's no need to retry.
Chances are, it won't suddenly be supported between retry attempts;
error instead. Otherwise, you see something like the following:

    $ nix-env -i -f git://git@github.com/foo/bar
    warning: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1); retrying in 335 ms
    warning: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1); retrying in 604 ms
    warning: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1); retrying in 1340 ms
    warning: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1); retrying in 2685 ms

With this change, you now see:

    $ nix-env -i -f git://git@github.com/foo/bar
    error: unable to download 'git://git@github.com/foo/bar': Unsupported protocol (1)
2020-04-05 09:00:34 -07:00
Ben Burdette
1221ae3dd0 libexpr 2020-04-05 07:12:16 -06:00
Ben Burdette
9a8b3e9747 move out of tests/ 2020-04-03 14:55:26 -06:00
Eelco Dolstra
3473b1950a
Fix tests.githubFlakes evaluation 2020-04-03 21:36:21 +02:00
Ben Burdette
9bb528d392 handle Pos instead of individual file/line/columnrange args 2020-04-03 13:15:59 -06:00
Eelco Dolstra
5e7ccdc9e3 Publish a tarball containing the crates we depend on
This is needed since we no longer produce a source tarball.

(cherry picked from commit bf70a047a0)
2020-04-03 20:14:34 +02:00
Eelco Dolstra
63fa92605b nix-env: Refuse to operate on a new-style profile
This prevents users from accidentally nuking their profile via
nix-env.

(cherry picked from commit 021634e3e3)
2020-04-03 20:14:34 +02:00
Eelco Dolstra
e35d83d1fc Fix job name 2020-04-03 20:11:14 +02:00
Eelco Dolstra
bf70a047a0 Publish a tarball containing the crates we depend on
This is needed since we no longer produce a source tarball.
2020-04-03 20:06:26 +02:00
Ben Burdette
7b7801d3f0 variadic args for hint format 2020-04-03 08:48:20 -06:00
Eelco Dolstra
6e7f252ea6 Make --override-input sticky
When we do something like 'nix flake update --override-input nixpkgs
...', the override is now kept on subsequent calls. (If you don't want
this behaviour, you can use --no-write-lock-file.)
2020-04-03 14:06:29 +02:00
Eelco Dolstra
9c78f7f196 getFlake: In pure mode, check that the argument is an immutable flakeref 2020-04-03 13:07:05 +02:00
Eelco Dolstra
47c568ee32
Merge pull request #3470 from andir/remove-unusued-attrError
libexpr: remove unused attrError
2020-04-03 09:36:13 +02:00
Ben Burdette
c6b3fcddb0 formatted with astyle 2020-04-02 16:02:40 -06:00
Ben Burdette
1c329ca433 indenting 2020-04-02 14:25:43 -06:00
Ben Burdette
b85ba3e30d full include path 2020-04-02 14:08:05 -06:00
Eelco Dolstra
bb39f2bb8a Temporary backward compatibility hack 2020-04-02 19:12:14 +02:00
Eelco Dolstra
485a87f22f Don't barf on registry parse errors 2020-04-02 19:09:17 +02:00
Eelco Dolstra
a6ff66b658 Respect the narHash attribute in more input types
call-flake.nix now passes node.info.narHash to fetchTree. This ensures
that dirty Git trees work even in pure mode.
2020-04-02 19:04:33 +02:00
Eelco Dolstra
78ad5b3d91 PathInput: Add some methods 2020-04-02 19:04:27 +02:00
Eelco Dolstra
e1fc9f6690 Improve error message 2020-04-02 19:03:32 +02:00
Eelco Dolstra
ab47868639 Change lastModified to the number of seconds in the epoch
'lastModifiedDate' is now a string representing the equivalent
date/time.
2020-04-02 18:39:41 +02:00
Eelco Dolstra
6d6467d376 Move parseTreeInfo() 2020-04-02 18:26:39 +02:00
Andreas Rammhold
4fc4eb6c93 libexpr: remove unused attrError
The attrError variable is no longer used but still allocated on every
call to the findAlongAttrPath function.
2020-04-02 17:04:00 +02:00
Eelco Dolstra
6cf91d6fbd fetchTree: Support integer attributes 2020-04-02 16:51:56 +02:00
Eelco Dolstra
12f9379123 Add 'path' fetcher
This fetchers copies a plain directory (i.e. not a Git/Mercurial
repository) to the store (or does nothing if the path is already a
store path).

One use case is to pin the 'nixpkgs' flake used to build the current
NixOS system, and prevent it from being garbage-collected, via a
system registry entry like this:

  {
      "from": {
          "id": "nixpkgs",
          "type": "indirect"
      },
      "to": {
          "type": "path",
          "path": "/nix/store/rralhl3wj4rdwzjn16g7d93mibvlr521-source",
          "lastModified": 1585388205,
          "rev": "b0c285807d6a9f1b7562ec417c24fa1a30ecc31a"
      },
      "exact": true
  }

Note the fake "lastModified" and "rev" attributes that ensure that the
flake gives the same evaluation results as the corresponding
Git/GitHub inputs.
2020-04-02 14:56:20 +02:00
Eelco Dolstra
00e1400eb7 Doh 2020-04-02 11:55:41 +02:00
Eelco Dolstra
021634e3e3 nix-env: Refuse to operate on a new-style profile
This prevents users from accidentally nuking their profile via
nix-env.
2020-04-02 11:54:48 +02:00
Eelco Dolstra
ed13457dbf nix flake info --json: Show TreeInfo 2020-04-02 11:51:34 +02:00
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
Ben Burdette
e697884f65 using std:: everywhere; fix a formatting error; add exception flags 2020-04-01 21:30:19 -06:00
Ben Burdette
dd7b8183a5 indenting 2020-04-01 16:20:20 -06:00
Ben Burdette
8713aeac5e remove using std::*, switch to include guard 2020-04-01 15:51:14 -06: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
Ben Burdette
a72b6b2ec8 examples of invalid errors 2020-03-31 18:29:41 -06:00
Eelco Dolstra
36c34c3b1f Set version properly 2020-04-01 00:20:12 +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
Ben Burdette
5b3aefff85 add some explanatory comments 2020-03-31 12:42:41 -06:00
Ben Burdette
9e7b89bf10 rename errors/warnings 2020-03-31 11:56:37 -06:00
Ben Burdette
09652f597c enum style 2020-03-31 09:36:20 -06:00
Eelco Dolstra
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
d4d456c6b1
Merge pull request #3463 from Ninlives/placeholder-passAsFile
fix placeholder not substituted in passAsFile
2020-03-31 13:50:39 +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
John Ericson
8aa46cd340 Get rid of FileIngestionMethod casts in perl bindings, too 2020-03-30 22:40:41 +00:00
John Ericson
7e9a2718f0 s/outputHashRecursive/ingestionMethod/c 2020-03-30 22:36:15 +00:00
John Ericson
51afea3af2 Never cast FileIngestionMethod to or from boolean 2020-03-30 22:31:51 +00:00