Commit graph

8836 commits

Author SHA1 Message Date
Eelco Dolstra
dd9bb11d0d Move names.{cc,hh} to libstore 2020-06-11 15:42:18 +02:00
Eelco Dolstra
95eb064062 Shut up warning 2020-06-11 15:39:30 +02:00
Eelco Dolstra
8bd892117a Style fixes 2020-06-11 15:39:08 +02:00
Eelco Dolstra
0c62b4ad0f Represent 'follows' inputs explicitly in the lock file
This fixes an issue where lockfile generation was not idempotent:
after updating a lockfile, a "follows" node would end up pointing to a
new copy of the node, rather than to the original node.
2020-06-11 14:40:21 +02:00
Tobias Pflug
4750d98bbd Add tests for pool.hh 2020-06-10 22:29:50 +02:00
Eelco Dolstra
195ed43b60 Preserve 'isFlake' when not updating a lock file entry 2020-06-10 16:24:05 +02:00
Eelco Dolstra
2226e97ec2 Combine lock file update messages 2020-06-10 15:22:12 +02:00
Eelco Dolstra
fc6c7af424 Add helper function printInputPath() 2020-06-10 15:20:00 +02:00
Eelco Dolstra
b9ae1bdd7a
Merge pull request #3655 from zimbatm/hash-encoding-prepare
libutils/hash: remove default encoding
2020-06-10 11:48:38 +02:00
Eelco Dolstra
f64cc6d9b1
Merge pull request #3668 from tweag/fix-remote-nix-env-test
Actually test nix-env with a remote store
2020-06-10 11:45:35 +02:00
Eelco Dolstra
dc719b9745
Merge pull request #3677 from matthewbauer/static-nix-one-translation-unit
Prelink static libraries into an object file
2020-06-10 10:19:55 +02:00
Matthew Bauer
7eca8a16ea Prelink static libraries into an object file
This combines the *.o into a big .o producing one translation unit.
This preserve our unused static initializers, as specified in the C++
standard:

  If no variable or function is odr-used from a given translation
  unit, the non-local variables defined in that translation unit may
  never be initialized (this models the behavior of an on-demand
  dynamic library).

Note that this is very similar to how the --whole-archive flag works.
One advantage of this is that users of the final .a library don’t have
to worry about specifying --whole-archive, or that we have unused
static initializers at all!
2020-06-09 23:35:38 -05:00
Matthew Bauer
b2c8061b44
Disable extra-platforms = i686-linux on wsl1 (#3676)
WSL1 doesn’t support i686-linux emulation, see https://github.com/microsoft/wsl/issues/2468
2020-06-09 21:53:53 +00:00
Matthew Bauer
19aa892f20 Support empty hash in fetchers
fetchTarball, fetchTree, and fetchGit all have *optional* hash attrs.
This means that we need to be careful with what we allow to avoid
accidentally making these defaults. When ‘hash = ""’ we assume the
empty hash is wanted.
2020-06-09 11:10:54 -05:00
Eelco Dolstra
29e0748847 Show HTTP status message
For example:

  warning: unable to download 'https://api.github.com/repos/edolstra/dwarffs/commits/master': HTTP error 403 ('rate limit exceeded'); using cached version
2020-06-09 14:20:22 +02:00
Eelco Dolstra
447ea52b07 FileTransfer: Don't store status since curl already does that 2020-06-09 14:05:15 +02:00
Eelco Dolstra
6cfc2db494 Fix applyOverride() for github 2020-06-09 13:45:07 +02:00
Eelco Dolstra
1205b41849 flake.lock: Update
Flake input changes:

* Updated 'nixpkgs': 'github:NixOS/nixpkgs/b88ff468e9850410070d4e0ccd68c7011f15b2be' -> 'github:NixOS/nixpkgs/70717a337f7ae4e486ba71a500367cad697e5f09'
2020-06-09 11:24:06 +02:00
Eelco Dolstra
e938add10d flake.nix: Remove edition 2020-06-09 11:23:23 +02:00
Matthew Bauer
762273f1fd Allow empty hash in derivations
follow up of https://github.com/NixOS/nix/pull/3544

This allows hash="" so that it can be used for debugging purposes. For
instance, this gives you an error message like:

  warning: found empty hash, assuming you wanted 'sha256:0000000000000000000000000000000000000000000000000000'
  hash mismatch in fixed-output derivation '/nix/store/asx6qw1r1xk6iak6y6jph4n58h4hdmbm-nix':
    wanted: sha256:0000000000000000000000000000000000000000000000000000
    got:    sha256:0fpfhipl9v1mfzw2ffmxiyyzqwlkvww22bh9wcy4qrfslb4jm429
2020-06-09 01:23:37 -05:00
Ben Burdette
2f19650768 add file origin to Pos in stests 2020-06-08 11:21:17 -06:00
Ben Burdette
b1c53b034c Merge branch 'errors-phase-2' into caveman-LOCs 2020-06-08 11:10:13 -06:00
regnat
801112de1a Move progress-bar.cc to libmain
Needed so that we can include it as a logger in loggers.cc without
adding a dependency on nix

This also requires moving names.hh to libutil to prevent a circular
dependency between libmain and libexpr
2020-06-08 17:16:52 +02:00
Eelco Dolstra
e073f2c584 nix flake: Require 'flakes' feature 2020-06-08 16:23:54 +02:00
Eelco Dolstra
6470450ab4 Add completion for --update-input 2020-06-08 16:20:00 +02:00
Eelco Dolstra
c27f92698b Style fixes 2020-06-08 13:24:01 +02:00
Tobias Pflug
cd6dbf951a Add compression unit tests 2020-06-08 11:34:37 +02:00
regnat
f6ac888d3e Actually test nix-env with a remote store
The `remote-store` test loads the `user-env` one to test nix-env when
using the daemon, but actually does it incorrectly because every test
starts (in `common.sh`) by resetting the value of `NIX_REMOTE`, meaning
that the `user-env` test will never use the daemon.

Fix this by setting `NIX_REMOTE_` before sourcing `user-env.sh` in the
`remote-store` test, so that `NIX_REMOTE` is correctly set inside the
test
2020-06-08 10:01:14 +02:00
regnat
4983401440 Unify the printing of the logs between bar-with-logs and raw
Make the printing of the build logs systematically go through the
logger, and replicate the behavior of `no-build-output` by having two
different loggers (one that prints the build logs and one that doesn't)
2020-06-08 09:31:15 +02:00
zimbatm
2c4de6af10 add documentation 2020-06-08 09:31:15 +02:00
regnat
170e86dff5 Make the logger customisable
Add a new `--log-format` cli argument to change the format of the logs.
The possible values are
- raw (the default one for old-style commands)
- bar (the default one for new-style commands)
- bar-with-logs (equivalent to `--print-build-logs`)
- internal-json (the internal machine-readable json format)
2020-06-08 09:31:15 +02:00
Ben Burdette
94c347577e set verbosity levels 2020-06-07 07:24:49 -06:00
Tobias Pflug
e60747b5fb Remove error-demo/error-demo.cc
The logging.hh superseeds the demo
2020-06-06 10:23:12 +02:00
Tobias Pflug
952e72c804 Add tests for logging.hh 2020-06-06 10:22:32 +02:00
Eelco Dolstra
9ef6048d78 diffLockFiles(): Fix assertion failure
There are some cases where this inequality didn't hold, in particular
due to the Input / TreeInfo merge, where we're not always showing
narHash.
2020-06-05 20:52:23 +02:00
Eelco Dolstra
d558fb98f6
Merge pull request #3656 from obsidiansystems/handle-unknown-file-ingestion
Add error message when FileIngestionMethod is out of bounds
2020-06-05 17:18:12 +02:00
Eelco Dolstra
488ff83e6b Fix completion of --template 2020-06-05 14:09:12 +02:00
Eelco Dolstra
39e84c35d0 Fix log-prefix of nix build -L
Alternative fix to #3661. The cause was that 'name' is a
std::string_view into a temporary which could get overwritten.
2020-06-05 10:45:05 +02:00
Eelco Dolstra
ef798f73ea
Merge pull request #3664 from obsidiansystems/gitignore-test-file
Add `src/libutil/tests/libutil-tests` to `.gitignore`
2020-06-05 10:18:42 +02:00
Carlo Nucera
d614166cb6 Fix condition error and make test suite pass 2020-06-04 17:21:21 -04:00
John Ericson
efc5e45e95 Add src/libutil/tests/libutil-tests to .gitignore
I gather this comes from the new unit tests.
2020-06-04 21:05:41 +00:00
John Ericson
e5cc1ebc5d Merge remote-tracking branch 'upstream/master' into no-stringly-typed-derivation-output 2020-06-04 21:04:35 +00:00
John Ericson
a7b82fd006 Remove file which shouldn't be committed 2020-06-04 21:04:20 +00:00
John Ericson
94ddea9e2f Use readString rather than >> temporary
Fixed the rest of these before, but this one slipped through.
2020-06-04 20:55:08 +00:00
John Ericson
744ce9ce16 Merge branch 'master' of github.com:NixOS/nix into validPathInfo-ca-proper-datatype 2020-06-04 20:46:58 +00:00
John Ericson
2041499b5e Flip boolean
Thanks Matt!
2020-06-04 20:42:25 +00:00
John Ericson
ed86acf02a Use some std::optional::has_value for clarity 2020-06-04 20:42:02 +00:00
John Ericson
574d5460f0 Make sure info.ca tag bit is set in nix add-to-store 2020-06-04 20:33:28 +00:00
Eelco Dolstra
ab54031e04 getDefaultUrl() -> value_or() 2020-06-04 20:24:28 +02:00
Eelco Dolstra
810b2c6a48 nix flake init: Add a '--template' flag
The initial contents of the flake is specified by the
'templates.<name>' or 'defaultTemplate' output of another flake. E.g.

  outputs = { self }: {

    templates = {

      nixos-container = {
        path = ./nixos-container;
        description = "An example of a NixOS container";
      };

    };

  };

allows

  $ nix flake init -t templates#nixos-container

Also add a command 'nix flake new', which is identical to 'nix flake
init' except that it initializes a specified directory rather than the
current directory.
2020-06-04 20:22:25 +02:00