Commit Graph

40 Commits

Author SHA1 Message Date
Maximilian Bosch
8bc5104a6e
treewide: refactor .attrs.sh detection
When specifying the `builder` attribute in `stdenv.mkDerivation`, this
will be effectively transformed into

    builtins.derivation {
      builder = stdenv.shell;
      args = [ "-e" builder ];
    }

This also means that `default-builder.sh` is never sourced and as a
result it's not guaranteed that `$NIX_ATTRS_SH_FILE` is set to a correct
location[1].

Also, we need to source `.attrs.sh` to source `$stdenv`. So, the
following is done now:

* If `$NIX_ATTRS_SH_FILE` points to a correct location, then use it.
  Directly using `.attrs.sh` is problematic for `nix-shell(1)` usage
  (see previous commit for more context), so prefer the environment
  variable if possible.

* Otherwise, if `.attrs.sh` exists, then use it. See [1] for when this
  can happen.

* If neither applies, it can be assumed that `__structuredAttrs` is
  turned off and thus nothing needs to be done.

[1] It's possible that it doesn't exist at all - in case of Nix 2.3 or
    it can point to a wrong location on older Nix versions with a bug in
    `__structuredAttrs`.
2023-10-04 18:36:57 +02:00
Theodore Ni
4c9ed3189c
fetchhg: clean up md5 references 2023-07-20 21:24:13 -07:00
ajs124
b7cb74322c fetchhg: allow specifying (sri) hash 2023-04-03 12:40:35 +02:00
Felix Buehler
cdb39a86e0 treewide: use optionalString 2023-02-13 21:52:34 +01:00
Artturin
fe1c7a1945 treewide: remove usages of header and stopNest
they're obsolete
2023-01-16 00:08:12 +02:00
Artturin
c01f509e44 treewide: source .attrs in builders
if theres a source $stdenv then this is needed

for structuredAttrs
2022-12-08 21:09:02 +02:00
Ben Siraphob
02ee14b9d5 treewide: stdenvNoCC.lib -> lib 2021-01-27 13:01:51 +07: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
volth
52f53c69ce pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +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
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
Benjamin Staffin
fc85f1beed nix-prefetch-hg: Various bash style improvements, fixes #9511 2016-02-17 00:35:30 +01:00
Juho Östman
e7a28447ea fetchhg: fixed nix-prefetch-hg interpreter 2015-10-06 22:41:46 +03:00
Edward Tjörnhammar
655eed7a93 Merge pull request #7235 from risicle/fetchhgsubrepo
fetchhg: add option to fetch hg subrepos
2015-05-04 18:20:32 +02:00
Robert Scott
366da9e70f fetchhg: add option to fetch hg subrepos 2015-05-04 16:18:26 +01:00
Edward Tjörnhammar
4256ab778a fetchhg: pass proxyvars to hg 2015-04-28 22:44:57 +02:00
aszlig
5e7a1cf955
build-support: Fix nix-prefetch-* on OS X.
Fixes a regression on OS X introduced by f83af95.

Don't use --tmpdir for mktemp, because that flag doesn't exist on OS X.
However, using -t is deprecated in GNU coreutils, so as suggested by
@ip1981 we're now using parameter expansion on ${TMPDIR:-/tmp} to
provide /tmp as a fallback if TMPDIR is not set and use it instead.

Also use this approach for nix-prefetch-cvs now in order to stay
consistent.

Reported-by: Vladimir Kirillov <proger@wilab.org.ua>
Tested-by: Igor Pashev <pashev.igor@gmail.com>
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2014-08-27 11:22:34 +02:00
aszlig
f83af95f8a
build-support: Use mktemp -d in nix-prefetch-*.
Instead of relying on $$ to not collide with an existing path.

Quoting the Bash manual about $$:

> Expands to the process ID of the shell. In a () subshell, it expands
> to the process ID of the current shell, not the subshell.

So, this is different from $BASHPID:

> Expands to the process ID of the current bash process. This differs
> from $$ under certain circumstances, such as subshells that do not
> require bash to be re-initialized.

But even $BASHPID is prone to race conditions if the process IDs wrap
around, so to be on the safe side, we're using mktemp here.

Closes #3784.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2014-08-25 15:28:55 +02:00
Benno Fünfstück
e10001042d fetchbzr, fetchdarcs, fetchhg: use rev attr
This makes it match the behaviour of fetchgit and fetchsvn, so it's
easier to write scripts that support all of them.
2014-06-28 21:06:10 +02:00
Benno Fünfstück
063efadd69 nix-prefetch-{bzr,hg,svn}: print fetched revision 2014-06-11 14:42:39 +02:00
Rob Vermaas
a089dbfe8a Fix regression in fetchhg. 2014-05-29 09:06:13 +02:00
Rob Vermaas
ea23ea00e4 Make fetchhg do the same as nix-prefetch-hg, use hg archive. Fixes #2781. 2014-05-28 10:40:21 +02:00
Jack Cummings
83e45309fd fetchhg: allow untrusted certs (merge #540)
It's for fixed-output derivations, security provided by output hash.
2013-05-20 21:24:25 +02:00
Eelco Dolstra
84779a6f7d Remove unnecessary parentheses around if conditions
Pet peeve...
2012-12-28 19:54:15 +01:00
Lluis Batlle
ba47bf7258 fetchhg: removing the nix dependency
I don't think it's required for anything. I tried once without it, and it
worked equally fine.
2012-08-26 23:16:28 +02:00
Rob Vermaas
080c0b2f38 prefer local builds for fetchhg
svn path=/nixpkgs/trunk/; revision=31462
2012-01-10 06:41:44 +00:00
Rob Vermaas
66b4a5a009 revert previous commit, i'm not awake...
svn path=/nixpkgs/trunk/; revision=30971
2011-12-19 21:15:17 +00:00
Rob Vermaas
1ef78f94eb make sure fetchhg always produces same output for same revision
svn path=/nixpkgs/trunk/; revision=30970
2011-12-19 21:12:57 +00:00
Rob Vermaas
9d3e13f7f3 remove .hg-archival.txt from nix-prefetch-hg result
svn path=/nixpkgs/trunk/; revision=30217
2011-11-03 23:46:50 +00:00
Rob Vermaas
d7ac5cd014 nix-prefetch-hg: if url is local file, do not make clone, but run hg archive on it
svn path=/nixpkgs/trunk/; revision=26779
2011-04-11 12:24:57 +00:00
Rob Vermaas
3756e6021a use same name as nix-prefetch-hg for derivation
svn path=/nixpkgs/trunk/; revision=26778
2011-04-11 12:20:59 +00:00
Rob Vermaas
15cb365b1d make nix-prefetch-hg executable
svn path=/nixpkgs/trunk/; revision=22755
2010-07-27 16:32:51 +00:00
Lluís Batlle i Rossell
0530f43655 Updating go, and making the go expression work in both i686-linux and x86_64-linux.
svn path=/nixpkgs/trunk/; revision=22230
2010-06-12 11:21:20 +00:00
Rob Vermaas
13417770a3 applying patches provided by griswold
svn path=/nixpkgs/trunk/; revision=19707
2010-01-27 12:12:35 +00:00
Nicolas Pierron
c8cb5210fb * Add a fetchhg builder to checkout mercurial repositories.
svn path=/nixpkgs/trunk/; revision=18347
2009-11-14 20:14:21 +00:00
Marc Weber
04bd6b0607 commented out avrdude which is using unstable lib functions,
missing fetchhg expression added

svn path=/nixpkgs/trunk/; revision=9249
2007-09-04 12:45:00 +00:00