1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-03 07:31:00 +01:00
Commit graph

13118 commits

Author SHA1 Message Date
Eelco Dolstra
3c1f09ca49 Bump version 2023-02-27 18:43:40 +01:00
Théophane Hufschmitt
f12b1584c0
Merge pull request #7877 from NixOS/backport-7856-to-2.12-maintenance
[Backport 2.12-maintenance] Wait with making /etc unwritable until after build env setup
2023-02-22 06:52:10 +01:00
Yorick van Pelt
d13640f3d7 Wait with making /etc unwritable until after build env setup
This fixes /etc/nsswitch.conf

(cherry picked from commit bbba49b3e4)
2023-02-21 19:22:31 +00:00
Robert Hensing
8639f41069
Merge pull request #7855 from NixOS/backport-7831-to-2.12-maintenance
[Backport 2.12-maintenance] Backport 7616 to 2.11 maintenance
2023-02-17 15:05:38 +01:00
Robert Hensing
48b407c23e NarInfoDiskCache: Also test id consistency with updated fields
And clarify test

(cherry picked from commit 19b495a48a)
(cherry picked from commit 26378d285b)
2023-02-17 13:09:46 +00:00
Robert Hensing
112246045f NarInfoDiskCache: Keep BinaryCache.id stable and improve test
Fixes #3898

The entire `BinaryCaches` row used to get replaced after it became
stale according to the `timestamp` column. In a concurrent scenario,
this leads to foreign key conflicts as different instances of the
in-process `state.caches` cache now differ, with the consequence that
the older process still tries to use the `id` number of the old record.

Furthermore, this phenomenon appears to have caused the cache for
actual narinfos to be erased about every week, while the default
ttl for narinfos was supposed to be 30 days.

(cherry picked from commit fb94d5cabd)
(cherry picked from commit 8449b3cac3)
2023-02-17 13:09:46 +00:00
Robert Hensing
6d6a836b31 NarInfoDiskCache: Prepare reproducer for #3898
(cherry picked from commit 2ceece3ef3)
(cherry picked from commit cabf1d9b40)
2023-02-17 13:09:46 +00:00
Robert Hensing
f6192b8c23 NarInfoDiskCacheImpl: Make dbPath a parameter
This allows testing with a clean database.

(cherry picked from commit 79f62d2dda)
(cherry picked from commit 4972085195)
2023-02-17 13:09:46 +00:00
Robert Hensing
3b5a341c8c NarInfoDiskCache: Rename cacheExists -> upToDateCacheExists
This is slightly more accurate considering that an outdated record
may exist in the persistent cache. Possibly-outdated records are
quite relevant as they may be foreign keys to more recent information
that we want to keep, but we will not return them here.

(cherry picked from commit 29f0b196f4)
(cherry picked from commit 0bda735c57)
2023-02-17 13:09:46 +00:00
Robert Hensing
26dc468d8a sqlite.cc: Add SQL tracing
Set environment variable NIX_DEBUG_SQLITE_TRACES=1 to log all sql statements.

(cherry picked from commit 8a0ef5d58e)
(cherry picked from commit 54ac8fa919)
2023-02-17 13:09:46 +00:00
Eelco Dolstra
b1d7aba400
Merge pull request #7836 from NixOS/backport-7830-to-2.12-maintenance
[Backport 2.12-maintenance] Don't allow writing to /etc
2023-02-14 16:53:01 +01:00
Yorick van Pelt
e9ea93797a Make /etc writability conditional on uid-range feature
(cherry picked from commit 49fd72a903)
2023-02-14 15:50:25 +00:00
Yorick van Pelt
c0dadbc803 container test: make /etc writable
(cherry picked from commit ad1f61c39b)
2023-02-14 15:50:25 +00:00
Yorick van Pelt
28897300ab Don't allow writing to /etc
(cherry picked from commit db41f74af3)
2023-02-14 15:50:25 +00:00
Robert Hensing
5ce482b329
Merge pull request #7618 from NixOS/backport-6645-to-2.12-maintenance
[Backport 2.12-maintenance] systemd,launchd match nixos open files limit
2023-01-18 12:41:56 +01:00
Artturin
d2c82c681a systemd,launchd match nixos open files limit
it was bumped in https://github.com/NixOS/nixpkgs/pull/176558

(cherry picked from commit 2320a2f93e)
2023-01-17 19:23:04 +00:00
TIAN Yuanhao
d6c9069454 Avoid poly_user_note_set twice
f06f810 incorrectly introduces a boolean flip, resulting in a senseless
poly_user_note_set even though the user comment has been set correctly.

(cherry picked from commit 09830ab829)
2023-01-10 20:32:52 +01:00
Naïm Favier
21b1a097d6 Allow disabling build users by unsetting build-users-group
Unsetting `build-users-group` (without `auto-allocate-uids` enabled)
gives the following error:

```
src/libstore/lock.cc:25: static std::unique_ptr<nix::UserLock> nix::SimpleUserLock::acquire(): Assertion `settings.buildUsersGroup != ""' failed.
```

Fix the logic in `useBuildUsers` and document the default value
for `build-users-group`.

(cherry picked from commit 1f3c0a3c1d)
2023-01-10 20:32:15 +01:00
Eelco Dolstra
4e6c3c356d Fix a crash in DerivedPath::Built::toJSON() with impure derivations
The use of 'nullptr' here didn't result in a null JSON value, but in a
nullptr being cast to a string, which aborts.

(cherry picked from commit 0687e16c4a)
2023-01-10 20:31:40 +01:00
Steven Shaw
e3e1093e8b Fix error message
(cherry picked from commit 84b0893725)
2023-01-10 20:31:01 +01:00
Théophane Hufschmitt
c0d64cafda Fix why-depends for CA derivations (again)
This has the same goal as b13fd4c58e81b2b2b0d72caa5ce80de861622610,but
achieves it in a different way in order to not break
`nix why-depends --derivation`.

(cherry picked from commit 8cac451fce)
2023-01-10 20:30:27 +01:00
Théophane Hufschmitt
a8f78a5e6d Increase the test coverage of why-depends
- Test with `--derivation`
- Actually test with ca-derivations (was suuposedly done, but not
  activated because of a missing line in `local.mk`)

(cherry picked from commit 6a90ef072c)
2023-01-10 20:30:23 +01:00
Théophane Hufschmitt
e381bfafbf Revert "Fix why-depends for CA derivations"
This reverts commit b13fd4c58e.

(cherry picked from commit 105d74eb81)
2023-01-10 20:30:17 +01:00
Alexandre Thomas
934ddd4e46 Fix Nix installation on older versions of fish
The `fish_add_path` function is only available for fish 3.2.0 or newer,
and not on older versions.
This commit adds an alternative way to update the PATH when
`fish_add_path` does not exist.

(cherry picked from commit 49e058f1cf)
2023-01-10 20:30:03 +01:00
Eelco Dolstra
65f15ffe3c Fix deadlock between auto-GC and addTempRoot()
Previously addTempRoot() acquired the LocalStore state lock and waited
for the garbage collector to reply. If the garbage collector is in the
same process (as it the case with auto-GC), this would deadlock as
soon as the garbage collector thread needs the LocalStore state lock.

So now addTempRoot() uses separate Syncs for the state that it
needs. As long at the auto-GC thread doesn't call addTempRoot() (which
it shouldn't), it shouldn't deadlock.

Fixes #3224.

(cherry picked from commit 28d5b5cd45)
2023-01-10 20:15:07 +01:00
Eelco Dolstra
6487d49a16 Move creation of the temp roots file into its own function
This also moves the file handle into its own Sync object so we're not
holding the _state while acquiring the file lock. There was no real
deadlock risk here since locking a newly created file cannot block,
but it's still a bit nicer.

(cherry picked from commit 224b56f10e)
2023-01-10 20:15:02 +01:00
Eelco Dolstra
2d4f6e6a4e On macOS with auto-uid-allocation and sandboxing, use the correct gid
macOS doesn't have user namespacing, so the gid of the builder needs
to be nixbld. The logic got "has sandboxing enabled" confused with
"has user namespaces".

Fixes #7529.

(cherry picked from commit 4e84b532ed)
2023-01-10 20:14:36 +01:00
Eelco Dolstra
dff7d605c6 Bump version 2022-12-06 17:24:56 +01:00
Eelco Dolstra
ef800f1e73 Mark official release 2022-12-06 14:50:25 +01:00
Eelco Dolstra
eece14dce4
Merge pull request #7410 from edolstra/release-notes
Branch 2.12 release notes
2022-12-06 14:30:09 +01:00
Eelco Dolstra
5b4b2eefa1 Release notes 2022-12-06 13:55:09 +01:00
Eelco Dolstra
54906bc93c
Merge pull request #7382 from fricklerhandwerk/doc-automatic-uid
move documentation on `auto-allocate-uids` to options docs
2022-12-06 11:31:34 +01:00
Eelco Dolstra
484578d3f9
Tweak option descriptions 2022-12-06 10:30:36 +01:00
Théophane Hufschmitt
bfcf30f0ab
Merge pull request #7390 from Radvendii/fix-6383
check the store for input before failing (hopefully fix #6700)
2022-12-05 18:04:41 +01:00
Eelco Dolstra
a21d9523b9
Merge pull request #7401 from Mic92/cgroup-typo
getMaxCPU: fix cgroup path
2022-12-05 17:53:05 +01:00
Eelco Dolstra
a4642ca73e
Merge pull request #7392 from edolstra/revert-7251
Revert "docs: drop shell prompt character for consistency"
2022-12-05 17:51:13 +01:00
Taeer Bar-Yam
e4f9f3bf24 check the store for input before failing (hopefully fix #6700) 2022-12-05 11:27:47 -05:00
Eelco Dolstra
14c3d76048
Merge pull request #7329 from fricklerhandwerk/maintainers
add maintainers' handbook
2022-12-05 17:21:36 +01:00
Eelco Dolstra
647e60b356
maintainers/README.md: Use CET 2022-12-05 16:35:25 +01:00
Eelco Dolstra
67d76cb8df
Fix typo 2022-12-05 16:34:39 +01:00
Théophane Hufschmitt
3b05124682
Merge pull request #7277 from fricklerhandwerk/codeowners
add CODEOWNERS
2022-12-05 14:58:50 +01:00
Jörg Thalheim
cccd57c022 getMaxCPU: fix cgroup path
Given this typo I am not sure if it has been tested.
2022-12-04 18:22:12 +01:00
Eelco Dolstra
b4b13382f4
Merge pull request #7387 from fricklerhandwerk/upvote-convention
encourage adding 👍 to express interest
2022-12-02 20:13:24 +01:00
Eelco Dolstra
c582150360
Merge pull request #7394 from edolstra/fix-7268
Lower verbosity of exceptions in getMaxCPU()
2022-12-02 17:02:32 +01:00
Eelco Dolstra
3a8341f57e
Merge pull request #7395 from obsidiansystems/evaluating-to-calling
Change "while evaluating <fun>" to "while *calling*" in trace
2022-12-02 15:53:57 +01:00
John Ericson
19c5394971 Change "while evaluating <fun>" to "while *calling*" in trace
The old way was not correct.

Here is an example:
```
 $ nix-instantiate --eval --expr 'let x = a: throw "asdf"; in x 1' --show-trace
error: asdf

       … while evaluating 'x'

       at «string»:1:9:

            1| let x = a: throw "asdf"; in x 1
             |         ^

       … from call site

       at «string»:1:29:

            1| let x = a: throw "asdf"; in x 1
             |                             ^
```
and yet also:
```
 $ nix-instantiate --eval --expr 'let x = a: throw "asdf"; in x' --show-trace
<LAMBDA>
```

Here is the thing: in both cases we are evaluating `x`!

Nix is a higher-order languages, and functions are a sort of value. When
we write `x = a: ...`, `a: ...` is the expression that `x` is being
defined to be, and that is already a value. Therefore, we should *never*
get an trace that says "while evaluating `x`", because evaluating `a:
...` is *trival* and nothing happens during it!

What is actually happening here is we are applying `x` and evaluating
its *body* with arguments substituted for parameters. I think the
simplest way to say is just "while *calling* `x`", and so that is what I
changed it to.
2022-12-02 09:14:12 -05:00
Eelco Dolstra
fa99ef6a87 getMaxCPU(): Lower verbosity level for ignored exceptions
Fixes #7268.
2022-12-02 15:03:40 +01:00
Valentin Gagarin
0ce5742bec
Merge pull request #7381 from aakropotkin/doc-ltoa-conflicts
doc: listToAttrs: document repeated keys
2022-12-02 14:19:34 +01:00
Eelco Dolstra
1e6a5d1ff6 Clean up cgroup handling in getMaxCPU()
Also, don't assume in LocalDerivationGoal that cgroups are mounted on
/sys/fs/cgroup.
2022-12-02 12:59:13 +01:00
Eelco Dolstra
1211e59a03 Move cgroup.{cc,hh} to libutil 2022-12-02 12:38:03 +01:00