Commit graph

18385 commits

Author SHA1 Message Date
Nikodem Rabuliński
8105307f0f Always initialize curl in parent process on darwin
Because of an objc quirk[1], calling curl_global_init for the first time
after fork() will always result in a crash.
Up until now the solution has been to set
OBJC_DISABLE_INITIALIZE_FORK_SAFETY for every nix process to ignore
that error.
This is less than ideal because we were setting it in package.nix,
which meant that running nix tests locally would fail because
that variable was not set.
Instead of working around that error we address it at the core -
by calling curl_global_init inside initLibStore, which should mean
curl will already have been initialized by the time we try to do so in
a forked process.

[1] 01edf1705f/runtime/objc-initialize.mm (L614-L636)

(cherry-picked and adapted from c7d97802e4)
2024-09-18 14:29:26 +02:00
Jörg Thalheim
a20659f4fa unitests: fix tmpdir when running with meson on macOS 2024-09-17 19:15:01 +02:00
Jörg Thalheim
98db531df2 libstore-support: check that we can create the store 2024-09-17 18:46:50 +02:00
John Ericson
95f2b2beab
Merge pull request #8766 from brianmcgee/fix/base64-decode-error-message
base64Decode: clearer error message when an invalid character is detected
2024-09-17 09:59:15 -04:00
Eelco Dolstra
3fb6605d3d
Merge pull request #11514 from DeterminateSystems/fix-derivation-add
nix derivation add: Remove reference to "installable"
2024-09-17 13:12:12 +02:00
Eelco Dolstra
65f138f669 nix derivation add: Remove reference to "installable"
It doesn't operate on an installable, so don't mention it.
2024-09-17 12:37:33 +02:00
Eelco Dolstra
8321fe7c2b
Merge pull request #11512 from NixOS/dependabot/github_actions/cachix/install-nix-action-V28
Bump cachix/install-nix-action from V27 to 28
2024-09-17 12:29:11 +02:00
dependabot[bot]
afa6cc7271
Bump cachix/install-nix-action from V27 to 28
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from V27 to 28. This release includes the previously tagged commit.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/V27...V28)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 22:59:12 +00:00
Robert Hensing
799abea0c4
Merge pull request #11330 from NixOS/packfile
libgit2, GitRepo: Write (thin) packfiles
2024-09-16 14:42:59 +02:00
Robert Hensing
459d02672c fix Windows build 2024-09-16 13:42:46 +02:00
Robert Hensing
976f539f7d Make Repo::flush interruptible 2024-09-16 13:42:46 +02:00
Eelco Dolstra
176334d8be
Merge pull request #10612 from edolstra/no-flake-substitution
Input::fetchToStore(): Don't try to substitute
2024-09-16 12:47:50 +02:00
Eelco Dolstra
2c42a9dbaa
Merge pull request #11485 from abathur/sequoia_migration_errexit
sequoia-nixbld-user-migration: halt on error
2024-09-13 17:12:28 +02:00
Eelco Dolstra
11452ce674
Merge pull request #11490 from bryanhonof/bryanhonof.add-mixenvironment-to-run
Add MixEnvironment to CmdRun
2024-09-12 20:29:16 +02:00
Robert Hensing
bbef37b4a6
Merge pull request #11423 from DeterminateSystems/ignore-stale-submodules
Git fetcher: Ignore .gitmodules entries that are not submodules
2024-09-12 18:14:18 +02:00
Eelco Dolstra
bb1ce014be
Merge pull request #11492 from DeterminateSystems/canon-nars
Make the NAR parser stricter and add some tests
2024-09-12 18:14:06 +02:00
Bryan Honof
2226f9864e
feat(run): inherit from MixEnvironment 2024-09-12 17:47:48 +02:00
Eelco Dolstra
5737d31d4e Test the case hack a bit more 2024-09-12 17:27:41 +02:00
Eelco Dolstra
7aa3e7e3a5 Make the NAR parser much stricter wrt field order
We really want to enforce a canonical representation since NAR
hashing/signing/deduplication depends on that.
2024-09-12 15:57:46 +02:00
Eelco Dolstra
27ec0def74 Typo 2024-09-12 15:33:55 +02:00
Eelco Dolstra
69bf9947c7 Put 'names' in the right scope 2024-09-12 15:29:54 +02:00
Eelco Dolstra
4de9587e50 Improve badArchive() 2024-09-12 15:27:55 +02:00
Eelco Dolstra
421aa1add1 Add tests for invalid file names in NARs
Note: in general, we rely on the OS to tell us if a name is invalid or
if two names normalize in the same way. But for security, we do want
to make sure that we catch '.', '..', slashes and NUL characters. (NUL
characters aren't really a security issue, but since they would be
truncated when we pass them to the OS, it would be canonicity problem.)
2024-09-12 15:02:30 +02:00
Eelco Dolstra
12fd65d179 Disable subflakes test
Relative path flakes ("subflakes") are basically fundamentally
broken, since they produce lock file entries like

  "locked": {
    "lastModified": 1,
    "narHash": "sha256-/2tW9SKjQbRLzfcJs5SHijli6l3+iPr1235zylGynK8=",
    "path": "./flakeC",
    "type": "path"
  },

that don't specify what "./flakeC" is relative to. They *sometimes*
worked by accident because the `narHash` field allowed
`fetchToStore()` to get the store path of the subflake *if* it
happened to exist in the local store or in a substituter.

Subflakes are properly fixed in #10089 (which adds a "parent" field to
the lock file). Rather than come up with some crazy hack to make them
work in the interim, let's just disable the only test that depends on
the broken behaviour for now.
2024-09-11 21:58:32 +02:00
Eelco Dolstra
30aa45a373 Formatting 2024-09-11 20:35:04 +02:00
Travis A. Everett
48477d4a3e
doc: add admonitions for macOS 15 Sequoia update (#11487)
The impending release of macOS 15 Sequoia will break many existing nix
installs on macOS, which may lead to an increased number of people who
are looking to try to reinstall Nix without noticing the open/pinned
issue (#10892) that explains the problem and outlines how to migrate
existing installs.

These admonitions are a short-term measure until we are over the hump
and support volumes dwindle.
2024-09-11 17:50:47 +00:00
John Ericson
db7c868d24
Merge pull request #11378 from Mic92/nix-dir-errors
builtins.readDir: fix nix error trace on filesystem errors
2024-09-11 13:10:28 -04:00
John Ericson
193dc49097 tweak unpack channel built-in, std::filesystem::path for tarball 2024-09-11 12:29:49 -04:00
Eelco Dolstra
1c2508f176
Merge pull request #11466 from DeterminateSystems/git-mtime-warning
Git fetcher: Don't update mtime of ref file if fetching by rev
2024-09-11 17:34:46 +02:00
Eelco Dolstra
e557096cef Add release note 2024-09-11 17:32:16 +02:00
Eelco Dolstra
3fbd71701a Add test 2024-09-11 17:27:39 +02:00
Eelco Dolstra
aa41de7d82 Merge remote-tracking branch 'origin/master' into no-flake-substitution 2024-09-11 17:10:55 +02:00
Travis A. Everett
51a01aa6c5 sequoia-nixbld-user-migration: halt on error
Addressing user feedback about a case where actions the script takes
may fail without a specific permission if run over SSH.
2024-09-11 08:56:53 -05:00
Eelco Dolstra
46339db18d
Merge pull request #11471 from zimbatm/hacking-md
doc: add HACKING.md symlink
2024-09-11 14:54:28 +02:00
Eelco Dolstra
9a7c0d8933
Merge pull request #11473 from Artturin/keepfailedreadable
Fix making the build directory kept by `keep-failed` readable
2024-09-11 14:52:50 +02:00
Eelco Dolstra
894da59186
Merge pull request #11447 from DeterminateSystems/nix-flake-metadata-chroot-store
nix flake {metadata,archive}: Fix chroot stores
2024-09-11 14:51:56 +02:00
Noam Yorav-Raphael
38bfbb297c
Use envvars NIX_CACHE_HOME, NIX_CONFIG_HOME, NIX_DATA_HOME, NIX_STATE_HOME if defined (#11351) 2024-09-11 10:36:46 +00:00
Jörg Thalheim
04ce0e648a add release notes for filesystem fixes
Update doc/manual/rl-next/filesystem-errors.md

Co-authored-by: John Ericson <git@JohnEricson.me>
2024-09-11 08:23:18 +02:00
tomberek
c60e1be62c
Merge pull request #11438 from zimbatm/nix-fmt-pwd
fix(nix fmt): remove the default "." argument
2024-09-10 23:44:16 -04:00
tomberek
b30b3b27f8
Merge pull request #11476 from abathur/sequoia_migration_undebug
sequoia-nixbld-user-migration: disable trace mode
2024-09-10 23:35:23 -04:00
Travis A. Everett
f2e7e996da sequoia-nixbld-user-migration: disable trace mode
Was hoping to leave this enabled for a little while as core community
members test this script out, but Apple's aggressive release timeline
for macOS 15 Sequoia has caught us off-guard here.

It's probably not ideal for a general audience if the script spews all
of this output--and people can still force bash to run in trace mode
if we really need to debug a problem.
2024-09-10 20:54:09 -05:00
Artturin
ebebe626ff 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/
```
2024-09-11 00:23:14 +03:00
zimbatm
c4766d7b8b fix(nix fmt): remove the default "." argument
When `nix fmt` is called without an argument, Nix appends the "." argument before calling the formatter. The comment in the code is:
> Format the current flake out of the box

This also happens when formatting sub-folders.

This means that the formatter is now unable to distinguish, as an interface, whether the "." argument is coming from the flake or the user's intent to format the current folder. This decision should be up to the formatter.

Treefmt, for example, will automatically look up the project's root and format all the files. This is the desired behaviour. But because the "." argument is passed, it cannot function as expected.
2024-09-10 22:18:56 +02:00
Eelco Dolstra
b9d3cdfbd2
Merge pull request #11472 from Mic92/darwin-fix
add missing filesystem include (x86_64-darwin fix)
2024-09-10 17:33:09 +02:00
Jörg Thalheim
1ca1439b1f add missing filesystem include (x86_64-darwin fix) 2024-09-10 16:45:39 +02:00
zimbatm
be480971c2 doc: add HACKING.md symlink
As a hacker, I should be able to checkout the repo, and find relevant
information on how to develop in the project somewhere in the top-level.
Either in the README.md, or CONTRIBUTING.md or HACKING.md files.

This PR symlinks the HACKING.md into the right place in the manual.
2024-09-10 15:26:38 +02:00
Eelco Dolstra
9c0e968843
Merge commit from fork
Fix unsafe NAR unpacking
2024-09-10 12:42:55 +02:00
Tom Bereknyei
c55b285cf9 tests: test was re-named 2024-09-09 22:15:45 -04:00
Eelco Dolstra
b80b091bac Git fetcher: Don't update mtime of ref file if fetching by rev
This fixes the warning

  $ nix eval --store /tmp/nix --expr 'builtins.fetchTree { type = "git"; url = "https://github.com/DeterminateSystems/attic"; ref = "fixups-for-magic-nix-cache"; rev = "635753a2069d4b8228e846dc5c09ad361c75cd1a"; }'
  warning: could not update mtime for file '/home/eelco/.cache/nix/gitv3/09788h9zgba5lbfkaa6ija2dvi004jwsqjf5ln21i2njs07cz766/refs/heads/fixups-for-magic-nix-cache': error: changing modification time of '"/home/eelco/.cache/nix/gitv3/09788h9zgba5lbfkaa6ija2dvi004jwsqjf5ln21i2njs07cz766/refs/heads/fixups-for-magic-nix-cache"': No such file or directory

When we're fetching by rev, that file doesn't necessarily exist, and we
don't care about it anyway.
2024-09-09 19:52:21 +02:00
Eelco Dolstra
c5a4dfa660 nix flake {metadata,archive}: Fix chroot stores
Fixes

  $ nix flake metadata --store /tmp/nix nixpkgs
  error: path '/tmp/nix/nix/store/65xpqkz92d9j7k5ric4z8lzhiigxsfbg-source/flake.nix' is not in the Nix store

This has been broken since 598deb2b23.
2024-09-09 15:41:38 +02:00