Commit Graph

79 Commits

Author SHA1 Message Date
Thomas Gerbet
31ab653f7e fetchurl: revert enabling TLS verification when NIX_SSL_CERT_FILE
This reverts commit f829274128.
2024-10-26 13:58:19 +02:00
Thomas Gerbet
f829274128 fetchurl: enable TLS verification when NIX_SSL_CERT_FILE is set
This is a follow-up to a169553f7e.
In most cases it should allow the TLS verification to be enabled.
It also makes the behavior of `fetchurl` more consistent with other fetchers
like `fetchgit`.

Ideally we would always fallback on `cacert` but I am not sure how to build
`cacert` during bootstrap without making an unmaintainable mess.
2024-10-22 14:58:54 +02:00
Anderson Torres
ce21e97a1f fetchurl: nixfmt-rfc-style 2024-09-25 14:51:53 -03:00
Anderson Torres
a32c7a11dd fetchurl: fixup typo on a comment 2024-09-25 14:51:53 -03:00
Thomas Gerbet
a169553f7e fetchurl: enable TLS verification when credentials are used
This make sure the credentials cannot be leaked in a MITM attack.
Note that this change might break some existing deployments if the users
tries to fetch resources on endpoints with invalid certificates.
The impacted users will have the following choices:
* fix the endpoint providing the resource
* override SSL_CERT_FILE to either disable the verification (not
  recommended) or to set it to a path including their CA certificate.
2024-09-23 18:27:02 +02:00
nicoo
af5682b3e1 fetchurl: Correctly handle { outputHash != ""; outputHashAlgo = "" }
Previously, the error that would be thrown would have been confusing:
```
fetchurl requires a hash for fixed-output derivation
```
2023-08-30 09:51:22 +00:00
nicoo
a59f03079c fetchurl: Validate that a single hash was passed 2023-08-30 09:51:22 +00:00
Jan Malakhovski
9437e4da35 fetchurl: cleanup a bit by moving the warning into assert 2023-08-08 13:38:11 +00:00
Theodore Ni
6f30e0a906
fetchurl: clean up md5 references 2023-07-20 21:23:04 -07:00
Sandro
1fd6cf192a
fixup! fetchurl: add pname+version support 2022-10-05 15:54:57 +02:00
Sandro Jäckel
7deac8b8f7
fetchurl: add pname+version support 2022-10-04 17:30:06 +02:00
Vladimír Čunát
cb704bf922
fetchurl: disallow specifying both sha256 and hash
A full check would be more complicated to write -
and more importantly - probably also more expensive.

Motivation: eval-time catch for errors like in commit 8198636be0.
2022-07-26 12:47:14 +02:00
Robert Hensing
1e17bb943e
Merge pull request #164662 from infinisil/fetchurl-curlOpts-list
fetchurl: Allow passing curl options with spaces
2022-06-30 21:10:57 +02:00
Artturin
f002ffed9a treewide: enable strictDeps in bootstrap packages 2022-05-22 16:40:26 +03:00
Silvan Mosberger
86c902d673 fetchurl: Introduce curlOptsList as an improvement over curlOpts
It's impossible to pass arguments with spaces with curlOpts.
curlOptsList supports that. Passing a list to curlOpts has been
deprecated. This commit is fully backwards compatible.
2022-04-26 21:01:19 +02:00
Sandro Jäckel
a67950f20b
fetchurl: passthru url 2022-04-17 05:30:04 +02:00
Alyssa Ross
da450f6b1d treewide: clean up obsolete version checks
These checks are all redundant with the check for Nix ≥2.2 in
default.nix.
2022-03-22 10:54:11 +00:00
Jonathan Ringer
24cbda98f3 fetchzip: remove need for overrideAttrs 2022-02-26 08:58:08 -08:00
Sandro
5f58402c94
fetchurl: also check certificate when using all zero hash (#152608) 2022-01-02 13:01:17 +01:00
Vladimír Čunát
e5ec487840
fetchurl: check that url is a string
Otherwise we (may) get a hard to debug issue in the tarball job,
e.g. see the grandparent commit.
2021-04-01 22:50:22 +02:00
Matthew Bauer
0046802ab6 fetchurl: only allow empty hash when cacert is available
We can use cacert to validate that the data passes SSL certificates.
Normally, this doesn’t happen because we already have the hash, but in
the hash = "" case we don’t.
2020-06-09 12:56:27 -05:00
Matthew Bauer
f2e9046de5 fetchurl: allow empty hash
Meant as a companion to https://github.com/NixOS/nix/pull/3674

This just resets outputHash if nothing is passed in.
2020-06-09 01:37:10 -05:00
Pavol Rusnak
7b0167204d treewide: use https for nixos.org and hydra.nixos.org
tarballs.nixos.org is omitted from the change because urls from there
are always hashed and checked
2020-05-03 22:14:21 -07:00
John Ericson
38ebb8ff82 fetchurl: Eliminate pointless cross differences 2019-11-11 00:25:24 -05:00
Eelco Dolstra
267c8d6b2f
fetchurl (and derived functions): Support SRI hashes
E.g.

  fetchFromGitHub {
    owner = "NixOS";
    repo = "nix";
    rev = "ad42a784690449873fccb20192bd2150da81c56d";
    hash = "sha256-ZXeadXUJMXV5lSLz6TOBeL/SSOVwQ8ywxU5AFMCnbRU=";
  }
2019-07-11 15:52:35 +02:00
Jörg Thalheim
eac6797380
prefer-fetch-remote: an overlay to fetch on remote builders
This is useful when running tools like NixOps or nix-review
on workstations where the upload to the builder is significantly
slower then downloading the source on the builder itself.
2019-01-18 14:41:10 +00:00
Yegor Timoshenko
f44012ba10
lib.release -> lib.trivial.release 2018-06-11 02:14:18 +00:00
Yegor Timoshenko
5a232b0f5b
Leverage lib.release 2018-06-11 01:50:06 +00:00
Yegor Timoshenko
16ed09a10e
Merge branch 'master' into fetchurl-user-agent 2018-05-18 10:39:44 +03:00
Jan Malakhovski
a89899ce4e fetchurl: cleanup, better errors
Also fix what seems like bugs in uncommon `stdenv`s.
2018-02-18 14:24:53 +00:00
John Ericson
940c4fa3f5 treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
John Ericson
3d59b4d285 treewide: Fixed output fetch* derivations should use nativeBuildInputs 2018-01-09 20:14:46 -05:00
Dan Peebles
0cb623c3d9
fetchurl: add user agent
It would be nice to be able to track Nix requests. It's not trustworthy,
but can be helpful for stats and routing in HTTP logs.

Since `fetchurl` is used so widely, we should "magically" get a UA on
`fetchzip`, `fetchFromGitHub`, and other related fetchers.

Since `fetchurl` is only used for fixed-output derivations, this should
cause no mass rebuild.

User-Agent example: curl/7.57.0 Nixpkgs/18.03
2017-12-23 22:20:56 +00:00
Frederik Rietdijk
ef21b240c8 fetchurl: add passthru
so that we could add e.g. the `version` attribute.
2017-11-05 10:12:19 +01:00
Shea Levy
b71b7ee622 fetchFromGitHub: Allow private repos, hosted githubs 2017-05-19 15:38:01 -04:00
Sven Slootweg
fa8adf2c47 fetchurl: fixed typo in error message
This typo was likely introduced by copy-pasting the error message from elsewhere and forgetting to change the text, during the MD5 deprecation process (#4491).
2017-04-21 16:41:09 +02:00
Robin Gloster
f57185db95
fetch-*: remove md5 support
fixes #4491
2017-03-20 22:23:41 +01:00
Eelco Dolstra
e3a873479e
Remove fetchMD5warn
Deprecation warnings should not be used in Nixpkgs because they spam
innocent "nix-env -qa" users with (in this case) dozens of messages
that they can't do anything about.

This also reverts commit 2ca8833383.
2016-11-30 15:14:30 +01:00
Michael Raskin
f603dc11a6 fetch*: print a trace warning about md5 deprecation 2016-10-09 16:19:04 +02:00
Profpatsch
61462c94e6 lib/fetchers.nix: factor out impure proxy vars (#18702)
Apparently everyone just copied those variables, instead of creating a
library constant for them. Some even removed the comment. -.-
2016-09-17 21:50:01 +02:00
Domen Kožar
0f9268e52c fetchurl: assert required Nix version for sha512 2016-04-14 12:50:21 +01:00
Eelco Dolstra
3ecbe604ef fetchurl: Support SHA-512 hashes 2016-04-13 14:11:14 +02:00
Scott Olson
43a523526d Require at least one of url or urls in fetchurl. 2016-02-19 03:18:21 -06:00
Scott Olson
9cf93ba135 Simplify fetchurl assertion logic.
The two lines I removed technically assert the exact same thing, since `!a -> b`
is equivalent to `a || b`. So, I replaced the two lines with the more symmetric
form to make it clearer.
2016-02-18 22:39:43 -06:00
Domen Kožar
c7383cb34b fetchurl: support executables 2016-01-19 11:17:49 +01:00
Jan Malakhovski
bdf32ed2ab fetchurl: allow adding meta info; fetchFrom*: add meta.homepage
The point of this is to be able to do `meta.homepage = src.meta.homepage;`
instead of the usual copy-paste for the packages that are hosted
on these hosting services.
2015-05-24 14:26:39 +00:00
Vladimír Čunát
c00d36f6c1 fetchurl: fix typo from 105154afed pushed today 2015-02-22 20:27:29 +01:00
Vladimír Čunát
105154afed fetchurl: build the mirror list locally 2015-02-22 19:26:22 +01:00
Domen Kožar
909b62fa6e fetchurl: friendly message if hash is not given 2014-11-23 17:49:32 +01:00
Linquize
f40db99c7b fetchurl: Fix typo in comment (close #2591) 2014-05-13 11:23:50 +02:00