1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 07:22:43 +01:00
Commit graph

15020 commits

Author SHA1 Message Date
Eelco Dolstra
d11e129490
Merge pull request #11753 from johnrichardrinehart/jrinehart/fix-support-for-dangling-revisions
fix: better support for dangling revisions
2024-12-19 16:49:48 +01:00
John Rinehart
591a826c7f fix: better support dangling revisions
The submodules branch generates a checkout which depends on only the
references, not all revisions. If there are dangling revisions in the
bare fetcher clone (a correctness issue itself) then the subsequent
temporary directory clone will disastrously fail with messages like
```
fatal: reference is not a tree: 2da0785fa32ce4c628d501c8743c88be00835b50
```
You should be able to reproduce this behavior with
```bash

this_nixpkgs='github:nixos/nixpkgs?rev=36ac8d7e411eeb11ac0998d5a39e329c1226e541';
this_git=$(nix build --print-out-paths "$this_nixpkgs#git")/bin/git;

export GIT_AUTHOR_NAME=foo \
	GIT_AUTHOR_EMAIL=foo@foo.foo \
	GIT_AUTHOR_DATE=100000000 \
	GIT_COMMITER_NAME=foo \
	GIT_COMMITER_EMAIL=foo@foo.foo \
	GIT_COMMITTER_DATE=100000000;

tmpgit=$(mktemp -d);
echo "Repo'll be at $tmpgit";

"$this_git" init "$tmpgit";

"$this_git" -C "$tmpgit" commit --allow-empty -m "foo"; # 8c2146823865b76da067b3bb458611a0a19ede3b
"$this_git" -C "$tmpgit" commit --allow-empty -m "foo"; # 2da0785fa32ce4c628d501c8743c88be00835b50
"$this_git" -C "$tmpgit" reset --hard HEAD~1; # 8c2146823865b76da067b3bb458611a0a19ede3b

for version in 18 19 20 21 22 23 24; do
    echo "Checking nix version 2.$version";
    this_nix=$(nix build "$this_nixpkgs#nixVersions.nix_2_$version^out" --print-out-paths)/bin/nix;

    url="file:///$tmpgit";

    # populate fetcher-v1.sqlite and the gitv3/ dir
    "$this_nix-build" --expr $'builtins.fetchGit {
        url = \"'"$url"$'\";
        rev = \"8c2146823865b76da067b3bb458611a0a19ede3b\";
        submodules = true;
    }';

    # put the "corrupted" git dir in place of the fetched one
    cache_dir="${XDG_CONFIG_HOME:-$HOME}"/.cache/nix/gitv3;
    tmp=$(mktemp);
    printf "%s" "$url" >"$tmp";
    fetched_dir="$cache_dir"/$(printf "%s" "$url" | $this_nix --extra-experimental-features nix-command hash file --type sha256 --base32 "$tmp");
    rm -rf "$fetched_dir";
    git clone --bare "$tmpgit" "$fetched_dir";

    # See if we can realise the derivation pointing to the dangling commit
    _NIX_FORCE_HTTP=1 "$this_nix-build" --impure --expr $'
    { pkgs ? (import <nixpkgs> { }) }: pkgs.stdenv.mkDerivation {
      pname = "foo";
      version = "1.0.0";
      dontUnpack = true;

      '"
      src = builtins.fetchGit {
        url = \"file:///$tmpgit\";
        rev = \"2da0785fa32ce4c628d501c8743c88be00835b50\";
        submodules = true;
      };

      buildPhase = ''
        touch \$out;
        exit 0;
      '';
    }
    "
done
```
This solution attempts to avoid the issue in the submodules path by
simply checking out the specified revision (in addition to all
references to preserve the original behavior - although, I think _only_
the revision is necessary).
2024-11-11 10:01:38 -08:00
Eelco Dolstra
266d76cf99 Bump version 2024-10-31 16:18:47 +01:00
Eelco Dolstra
6da1270783 maintainers/upload-release.pl: Delete temporary directories when we're done
(cherry picked from commit 02bb633a58)
2024-10-31 15:37:40 +01:00
Eelco Dolstra
0f665ff677 Fix perlBindings build on macOS 2024-10-31 12:47:51 +01:00
Eelco Dolstra
bddbe3b2e9 Merge remote-tracking branch 'nix-ghsa-wf4c-57rh-9pjg/advisory-fix-1-2.18' into 2.18-maintenance 2024-10-30 21:42:05 +01:00
Robert Hensing
d219faa93b local-derivation-goal: Move builder preparation to non-builtin code path 2024-10-22 22:35:34 +02:00
Robert Hensing
6fe3a5e26d local-derivation-goal: Refactor
This works because the `builder` and `args` variables are only used
in the non-builtin code path.

Co-Authored-By: Théophane Hufschmitt <theophane.hufschmitt@tweag.io>
2024-10-22 22:35:34 +02:00
Robert Hensing
4ac099d6ab local-derivation-goal: Print sandbox error detail on darwin
Co-Authored-By: Théophane Hufschmitt <theophane.hufschmitt@tweag.io>
2024-10-22 22:35:34 +02:00
Puck Meerburg
3c4bc6929e fix: Run all derivation builders inside the sandbox on macOS 2024-10-22 22:35:31 +02:00
Robert Hensing
5f20e42764
Merge pull request #11694 from NixOS/backport-11610-to-2.18-maintenance
Backport #11610 to 2.18 maintenance
2024-10-21 22:25:35 +02:00
Robert Hensing
27945161ae TMP: make buld-remote tests more verbose 2024-10-21 15:52:25 +02:00
Eelco Dolstra
a1bfc99b0a
Merge pull request #11700 from alyssais/2.18-exportReferencesGraph
[2.18] Fix exportReferencesGraph when given store subpath
2024-10-16 17:23:51 +02:00
Alyssa Ross
0812ddeb09
Fix exportReferencesGraph when given store subpath
With Nix 2.3, it was possible to pass a subpath of a store path to
exportReferencesGraph:

	with import <nixpkgs> {};

	let
	  hello = writeShellScriptBin "hello" ''
	    echo ${toString builtins.currentTime}
	  '';
	in

	writeClosure [ "${hello}/bin/hello" ]

This regressed with Nix 2.4, with a very confusing error message, that
presumably indicates it was unintentional:

	error: path '/nix/store/3gl7kgjr4pwf03f0x70dgx9ln3bhl7zc-hello/bin/hello' is not in the Nix store

(cherry picked from commit 0774e8ba33)
2024-10-15 16:56:00 +02:00
Robert Hensing
f7246305e1 ci.yml: Blanket update tests job 2024-10-14 18:48:01 +02:00
Robert Hensing
c4c0233097 flake.nix: Add hydraJobs.tests.fetchurl 2024-10-14 15:52:21 +02:00
Tom Bereknyei
ef80dea450 feat: better warning for common SSL errors
(cherry picked from commit 3e5bf90341)
2024-10-14 15:46:55 +02:00
Jörg Thalheim
f30a990117 tests/nixos/fetchurl: drop unused variables
(cherry picked from commit de9946cbfd4858133462c8cc6b7838edb3be2451)
2024-10-14 15:26:31 +02:00
Puck Meerburg
b61952212e fix passing CA files into builtins:fetchurl sandbox
This patch has been manually adapted from
14dc84ed03

Tested with:

$ NIX_SSL_CERT_FILE=$(nix-build '<nixpkgs>' -A cacert)/etc/ssl/certs/ca-bundle.crt nix-build --store $(mktemp -d) -E 'import <nix/fetchurl.nix> { url = https://google.com; }'
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
this derivation will be built:
  /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv
building '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv'...
error:
       … writing file '/nix/store/0zynn4n8yx59bczy1mgh1lq2rnprvvrc-google.com'

       error: unable to download 'https://google.com': Problem with the SSL CA cert (path? access rights?) (77)
error: builder for '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv' failed with exit code 1

Now returns:

nix-env % NIX_SSL_CERT_FILE=$(nix-build '<nixpkgs>' -A cacert)/etc/ssl/certs/ca-bundle.crt nix-build --store $(mktemp -d) -E 'import <nix/fetchurl.nix> { url = https://google.com; }'
this derivation will be built:
  /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv
building '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv'...
error: hash mismatch in fixed-output derivation '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv':
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
            got:    sha256-5xXEhGtnRdopaUTqaz2M1o2NE7ovhU0SjcSOPwntqwY=

(cherry picked from commit 1fbdf409524bb350b8614f3d95067cb9ba3c57f2)
2024-10-14 15:26:31 +02:00
Puck Meerburg
8f3bda8276 fixup! Add a test for builtin:fetchurl cert verification 2024-10-14 15:26:25 +02:00
Eelco Dolstra
fb02a952bd Bump version 2024-09-26 11:58:04 +02:00
Eelco Dolstra
501a805fcd
Merge pull request #11586 from NixOS/mergify/bp/2.18-maintenance/pr-11585
builtin:fetchurl: Enable TLS verification (backport #11585)
2024-09-26 00:49:30 +02:00
Eelco Dolstra
798e0bc75e Typo
(cherry picked from commit ef8987955b)
2024-09-26 00:18:08 +02:00
Eelco Dolstra
5e76cdbc79 Add release note
(cherry picked from commit 7b39cd631e)
2024-09-26 00:18:08 +02:00
Eelco Dolstra
c65ce6c6ec builtin:fetchurl: Enable TLS verification
This is better for privacy and to avoid leaking netrc credentials in a
MITM attack, but also the assumption that we check the hash no longer
holds in some cases (in particular for impure derivations).

Partially reverts 5db358d4d7.

(cherry picked from commit c04bc17a5a)
2024-09-25 21:53:27 +00:00
Eelco Dolstra
691f67d83e Bump version 2024-09-19 19:29:05 +02:00
John Ericson
d4d300c208
Merge pull request #11534 from fricklerhandwerk/backport-10652-to-2.18-maintenance
[backport 2.18] libstore: check additionalSandboxProfile
2024-09-18 15:42:38 -04:00
Théophane Hufschmitt
1524ad38d2 libstore: check additionalSandboxProfile
Make sure that `extraSandboxProfile` is set before we check whether it's
empty or not (in the `sandbox=true` case).

Also adds a test case for this.

Co-Authored-By: Artemis Tosini <lix@artem.ist>
Co-Authored-By: Eelco Dolstra <edolstra@gmail.com>
(cherry picked from commit 9bd1191fcc)
2024-09-18 21:17:07 +02:00
Eelco Dolstra
9f526847e4 Bump version 2024-09-16 20:45:50 +02:00
tomberek
a8196707ad
Merge pull request #11415 from NixOS/mergify/bp/2.18-maintenance/pr-10919
install-darwin: fix _nixbld uids for macOS sequoia (backport #10919)
2024-09-16 09:19:45 -04:00
Robert Hensing
aa6f7561eb
Merge pull request #11478 from NixOS/mergify/bp/2.18-maintenance/pr-11473
Fix making the build directory kept by `keep-failed` readable (backport #11473)
2024-09-16 12:38:33 +02:00
Artturin
30994e6ef4 Fix making the build directory kept by keep-failed readable
Caused by 1d3696f0fb

Without this fix the kept build directory is readable only by root

```
$ sudo ls -ld /comp-temp/nix-build-openssh-static-x86_64-unknown-linux-musl-9.8p1.drv-5
drwx------ root root 60 B Wed Sep 11 00:09:48 2024  /comp-temp/nix-build-openssh-static-x86_64-unknown-linux-musl-9.8p1.drv-5/

$ sudo ls -ld /comp-temp/nix-build-openssh-static-x86_64-unknown-linux-musl-9.8p1.drv-5/build
drwxr-xr-x nixbld1 nixbld 80 B Wed Sep 11 00:09:58 2024  /comp-temp/nix-build-openssh-static-x86_64-unknown-linux-musl-9.8p1.drv-5/build/
```

(cherry picked from commit ebebe626ff)
2024-09-11 12:54:09 +00:00
tomberek
e818523eb1
Merge branch '2.18-maintenance' into mergify/bp/2.18-maintenance/pr-10919 2024-09-10 23:39:51 -04:00
tomberek
e0fdea89c3
Merge pull request #11474 from NixOS/mergify/bp/2.18-maintenance/pr-9639
installer: allow overriding of NIX_FIRST_BUILD_ID on darwin (backport #9639)
2024-09-10 23:21:12 -04:00
Mel Zuser
c42e3e5b33 installer: allow overriding of NIX_FIRST_BUILD_ID on darwin
because there are often already users in the 300 range and it's painful
to work around.

revives #6466

(cherry picked from commit fa4bbe53e8)
2024-09-11 01:35:09 +00:00
Robert Hensing
6354f84475
Merge pull request #11445 from eclairevoyant/backport-10564-to-2.18
[backport 2.18-maintenance] AttrCursor: Remove forceErrors
2024-09-09 18:42:57 +02:00
Robert Hensing
ffaeb4b076
Merge pull request #11450 from NixOS/backport-11009-to-2.18-maintenance
installerScriptForGHA: aarch64-darwin
2024-09-09 17:57:40 +02:00
Robert Hensing
1b0805d451 installerScriptForGHA: aarch64-darwin
Backport of https://github.com/NixOS/nix/pull/11009
2024-09-09 17:47:27 +02:00
Robert Hensing
5bcc7069be Store ref<EvalState> in CachedEvalError
This makes the previous commits work.
Newer versions store it in all EvalErrors.
2024-09-09 00:38:28 +02:00
éclairevoyant
ef63ba10a2
fix 2024-09-08 12:04:26 -04:00
Eelco Dolstra
fc14197935
Typo
(cherry picked from commit eeb4c40867)
2024-09-08 10:31:25 -04:00
Eelco Dolstra
8e5ec819f8
AttrCursor: Remove forceErrors
Instead, force evaluation of the original value only if we need to
show the exception to the user.

(cherry picked from commit 2c88930ef2)
2024-09-08 10:31:23 -04:00
Eelco Dolstra
e3c55dd0d3
Add test for the evaluation cache
(cherry picked from commit 8b86f415c1)
2024-09-08 10:26:47 -04:00
Emily
517b48ffc4 install-darwin: increment base UID by 1 (#15)
(cherry picked from commit 11cf29b15c)
2024-09-03 23:57:06 +00:00
Travis A. Everett
4851e171b8 install-darwin: move nixbld gid to match first UID
(cherry picked from commit 75567423fb)

# Conflicts:
#	scripts/install-multi-user.sh
#	scripts/install-systemd-multi-user.sh
2024-09-03 23:57:05 +00:00
Travis A. Everett
3d380ed77a install-darwin: fix _nixbld uids for macOS sequoia
Starting in macOS 15 Sequoia, macOS daemon UIDs are encroaching on our
default UIDs of 301-332. This commit relocates our range up to avoid
clashing with the current UIDs of 301-304 and buy us a little time
while still leaving headroom for people installing more than 32 users.

(cherry picked from commit df36ff0d1e)

# Conflicts:
#	scripts/install-darwin-multi-user.sh
2024-09-03 23:57:05 +00:00
Robert Hensing
e154f412b7
Merge pull request #11336 from NixOS/backport-11332-to-2.18-maintenance
[Backport 2.18-maintenance] [Backport 2.22-maintenance] fix: check to see if there are any lines before
2024-08-19 17:05:38 +02:00
Tom Bereknyei
0d24420f9c fix: check to see if there are any lines before
(cherry picked from commit 59db8fd62b)
(cherry picked from commit aab801db98)
2024-08-19 14:28:08 +00:00
Eelco Dolstra
195c3e931f Bump version 2024-07-08 13:41:12 +02:00
Robert Hensing
217fadd993
Merge pull request #11047 from NixOS/backport-11046-to-2.18-maintenance
[Backport 2.18-maintenance] [Backport 2.21-maintenance] libstore: fix sandboxed builds on macOS
2024-07-05 19:40:45 +02:00