Commit Graph

11 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
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
Robert Scott
366da9e70f fetchhg: add option to fetch hg subrepos 2015-05-04 16:18:26 +01: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
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
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
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