Commit graph

17179 commits

Author SHA1 Message Date
dependabot[bot]
e027d4172f
build(deps): bump cachix/install-nix-action from 26 to 27
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 26 to 27.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v26...V27)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-20 13:16:32 +00:00
Max
5ecd820c18 Merge remote-tracking branch 'nixos/master' 2024-04-22 23:29:11 +02:00
Eelco Dolstra
df424667a3
Merge pull request #10591 from Ma27/require-libseccomp-2.5.5
Require at least libseccomp 2.5.5
2024-04-22 23:27:39 +02:00
Maximilian Bosch
73918b0ae4
Require at least libseccomp 2.5.5
Closes #10585

As it turns out, libseccomp maintains an internal syscall table and
validates each rule against it. This means that when using libseccomp
2.5.4 or older, one may pass `452` as syscall number against it, but
since it doesn't exist in the internal structure, `libseccomp` will refuse
to create a filter for that. This happens with nixpkgs-23.11, i.e. on
stable NixOS and when building Nix against the project's flake.

To work around that

* a backport of libseccomp 2.5.5 on upstream nixpkgs has been
  scheduled[1].

* the package now uses libseccomp 2.5.5 on its own already. This is to
  provide a quick fix since the correct fix for 23.11 is still a staging cycle
  away.

It must not be possible to build a Nix with an incompatible libseccomp
version (nothing can be built in a sandbox on Linux!), so configure.ac
rejects libseccomp if `__SNR_fchmodat2` is not defined.

We still need the compat header though since `SCMP_SYS(fchmodat2)`
internally transforms this into `__SNR_fchmodat2` which points to
`__NR_fchmodat2` from glibc 2.39, so it wouldn't build on glibc 2.38.
The updated syscall table from libseccomp 2.5.5 is NOT used for that
step, but used later, so we need both, our compat header and their
syscall table 🤷

[1] https://github.com/NixOS/nixpkgs/pull/306070
2024-04-22 22:37:34 +02:00
Dylan Green
aa165301d1
Pathlocks Implementation for Windows (#10586)
Based on Volth's original port.

Co-authored-by: volth <volth@volth.com>
2024-04-22 15:08:10 +00:00
Eelco Dolstra
e1fd0e0a8c
Merge pull request #10581 from bam80/patch-3
Update uninstall.md: mention .profile
2024-04-22 11:33:58 +02:00
Eelco Dolstra
790202232c
Merge pull request #10580 from bam80/patch-1
Update installing-binary.md: give TTY to the installer
2024-04-22 11:17:39 +02:00
Eelco Dolstra
16669ae445
Update doc/manual/src/installation/uninstall.md 2024-04-22 11:00:09 +02:00
Eelco Dolstra
cf1adbdd64
Merge pull request #10572 from NorfairKing/no-more-prev
Remove the 'prev' check entirely.
2024-04-22 10:53:31 +02:00
Robert Hensing
6fd2f42c2d
Merge pull request #10573 from RCoeurjoly/Rename_SearchPath
Rename SearchPath to LookupPath and searchPath to lookupPath
2024-04-21 17:33:46 +02:00
Andrey Butirsky
a6d08e3502
Update uninstall.md: remove ~/.nix-* files also 2024-04-21 17:08:37 +03:00
Andrey Butirsky
d4b44a41fb
Update uninstall.md: mention .profile
~/.profile is auto-edited by the single-mode installer so we should mention it in the uninstall instructions
2024-04-21 16:46:03 +03:00
Andrey Butirsky
722dfe9908
Update installing-binary.md: give TTY to the installer
Run the installer with TTY so the process can go interactively
2024-04-21 16:24:09 +03:00
Robert Hensing
c6526fa33b
Merge pull request #10563 from hercules-ci/doc-glossary-base-directory
doc/glossary: Add base directory
2024-04-21 15:17:16 +02:00
Robert Hensing
6a5d222818
Merge pull request #7745 from hercules-ci/pre-commit
Add pre-commit hook and CI check, excluding currently unformatted files
2024-04-21 14:43:25 +02:00
Robert Hensing
d871e7cc5b
Merge pull request #10562 from hercules-ci/unit-test-clean-config
Run unit tests with clean config
2024-04-21 14:28:03 +02:00
Robert Hensing
e8d267ad5b doc/values: Refer to base directory 2024-04-21 14:24:33 +02:00
Robert Hensing
73125e46fc doc/glossary: Add base directory 2024-04-21 14:24:33 +02:00
Robert Hensing
b5f1d4cce9 Edit docs 2024-04-21 14:16:46 +02:00
Robert Hensing
a3ff75fd7e devShells: null out src to avoid nix develop rebuild
Whenever src changed, nix develop would internally create a fresh
derivation, which it has to try and substitute and then build.
Let's not do that.
2024-04-21 13:54:34 +02:00
Robert Hensing
96c8a9a417 devShells: Prefix shell-for-
Without this, it's not clear from an error trace that it's the
shell that's evaluated. It would look like evaluating the nix
package.
2024-04-21 13:54:34 +02:00
Robert Hensing
8f042a5e6d pre-commit: Remove nixpkgs-fmt 2024-04-21 13:54:34 +02:00
Robert Hensing
5b36ee4c95 Add pre-commit hook and make format target
I've added the new local.mk to the package sources. While this
should not be needed for the build, it is the simplest solution,
and won't cause many extra rebuilds, because the file won't change
very often.
2024-04-21 13:54:34 +02:00
Max
1a2019bb81 nix shell: fix symlink resolution 2024-04-20 19:14:16 +02:00
Tom Sydney Kerckhove
ad65a50a94 Remove the 'prev' check 2024-04-20 14:46:23 +02:00
Robert Hensing
1b6cd1d2af Revert "tests/test-libstoreconsumer: Ignore config"
This reverts commit 62feb5ca09263c78ddb692836228223e5b58d3ae.

It runs as part of the functional tests, which control the environment,
solving some of the problems a default config has when run in the
sandbox.
2024-04-20 01:45:04 +02:00
Robert Hensing
bcaa2e4a85 tests/libstore-support: Ignore config 2024-04-20 01:45:04 +02:00
Robert Hensing
0ecf7dac3b tests/test-libstoreconsumer: Ignore config 2024-04-20 01:45:04 +02:00
Robert Hensing
e05b58b060 init: Add flag to avoid loading configuration 2024-04-20 01:45:04 +02:00
Max
05d4a86923 libcmd/modify-installables: build overrideValues differently 2024-04-19 17:45:47 +02:00
Max
1e28a13720 libcmd: attrs -> attrs() 2024-04-19 16:53:39 +02:00
Max
2d0b0537fe Merge remote-tracking branch 'nixos/master' 2024-04-19 16:42:33 +02:00
Robert Hensing
8c4c2156bd
doc/glossary: Define output closure (#8311) 2024-04-19 15:48:56 +02:00
Robert Hensing
538eb2617a
Merge pull request #10537 from hercules-ci/c-api-nix-value-init-apply
C API: Add nix_init_apply
2024-04-18 20:09:24 +02:00
Robert Hensing
ad643cde58 C API: Add nix_init_apply
Thunks are relevant when initializing attrsets and lists, passing
arguments. This is an important way to produce them.
2024-04-18 19:13:38 +02:00
Eelco Dolstra
f00b3b37b5
Merge pull request #10554 from 0x4A6F/master-scripts/upload-release
scripts/upload-release: fix riscv64 call
2024-04-18 19:12:22 +02:00
Eelco Dolstra
40499bca99
Merge pull request #10549 from alyssais/exportReferencesGraph
Fix exportReferencesGraph when given store subpath
2024-04-18 17:23:12 +02:00
0x4A6F
f8a67d7e26
scripts/upload-release: fix riscv64 call 2024-04-18 17:18:48 +02:00
John Ericson
b2b776da4f
Merge pull request #10501 from Ma27/seccomp-fchmodat2
libstore/local-derivation-goal: prohibit creating setuid/setgid binaries
2024-04-18 10:07:05 -04:00
0x4A6F
e3fa7c38d7
system: build for riscv64-unknown-linux-gnu (#10228)
* system: add support for riscv64-unknown-linux-gnu

* maintainers: upload riscv64-linux-gnu

* doc: add riscv64-linux to supported platforms
2024-04-18 11:10:52 +00:00
John Ericson
fb9f4208ed
Don't include linux/ in #include
The linux dirs are conditionally added to the `-I` path.
2024-04-18 12:20:20 +02:00
Maximilian Bosch
ba68045187
libstore/local-derivation-goal: prohibit creating setuid/setgid binaries
With Linux kernel >=6.6 & glibc 2.39 a `fchmodat2(2)` is available that
isn't filtered away by the libseccomp sandbox.

Being able to use this to bypass that restriction has surprising results
for some builds such as lxc[1]:

> With kernel ≥6.6 and glibc 2.39, lxc's install phase uses fchmodat2,
> which slips through 9b88e52846/src/libstore/build/local-derivation-goal.cc (L1650-L1663).
> The fixupPhase then uses fchmodat, which fails.
> With older kernel or glibc, setting the suid bit fails in the
> install phase, which is not treated as fatal, and then the
> fixup phase does not try to set it again.

Please note that there are still ways to bypass this sandbox[2] and this is
mostly a fix for the breaking builds.

This change works by creating a syscall filter for the `fchmodat2`
syscall (number 452 on most systems). The problem is that glibc 2.39
and seccomp 2.5.5 are needed to have the correct syscall number available
via `__NR_fchmodat2` / `__SNR_fchmodat2`, but this flake is still on
nixpkgs 23.11. To have this change everywhere and not dependent on the
glibc this package is built against, I added a header
"fchmodat2-compat.hh" that sets the syscall number based on the
architecture. On most platforms its 452 according to glibc with a few
exceptions:

    $ rg --pcre2 'define __NR_fchmodat2 (?!452)'
    sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
    58:#define __NR_fchmodat2 1073742276

    sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
    67:#define __NR_fchmodat2 6452

    sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
    62:#define __NR_fchmodat2 5452

    sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
    70:#define __NR_fchmodat2 4452

    sysdeps/unix/sysv/linux/alpha/arch-syscall.h
    59:#define __NR_fchmodat2 562

I tested the change by adding the diff below as patch to
`pkgs/tools/package-management/nix/common.nix` & then built a VM from
the following config using my dirty nixpkgs master:

    {
      vm = { pkgs, ... }: {
        virtualisation.writableStore = true;
        virtualisation.memorySize = 8192;
        virtualisation.diskSize = 12 * 1024;
        nix.package = pkgs.nixVersions.nix_2_21;
      };
    }

The original issue can be triggered via

    nix build -L github:nixos/nixpkgs/d6dc19adbda4fd92fe9a332327a8113eaa843894#lxc \
      --extra-experimental-features 'nix-command flakes'

however the problem disappears with this patch applied.

Closes #10424

[1] https://github.com/NixOS/nixpkgs/issues/300635#issuecomment-2031073804
[2] https://github.com/NixOS/nixpkgs/issues/300635#issuecomment-2030844251
2024-04-18 12:20:20 +02:00
Eelco Dolstra
731c389d32
Merge pull request #10552 from obsidiansystems/tiny-cpp-style-cleanup
`file-descriptor.hh`: Avoid some C-isms for better C++-isms
2024-04-18 10:25:33 +02:00
John Ericson
9c815db366 file-descriptor.hh: Avoid some Cism for better C++isms
- `reinterpret_cast` not C-style cast
- `using` not `typedef`
2024-04-17 19:55:40 -04:00
John Ericson
c16fc2c1bd
Merge pull request #10550 from obsidiansystems/less-cli-unix-only
Make a few commands that were Unix-only no longer
2024-04-17 17:22:06 -04:00
John Ericson
6fa3656a32 Make a few commands that were Unix-only no longer
Also clean up some more linux-specific (`setPersonality`) code in
alignment with recent best practices.
2024-04-17 16:20:56 -04:00
John Ericson
cde0fae7d9
Merge pull request #10502 from obsidiansystems/local-overlay-doc-improvements
Improve `local-overlay` docs in a few ways
2024-04-17 15:52:14 -04:00
Alyssa Ross
0774e8ba33
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
2024-04-17 21:51:59 +02:00
John Ericson
21d9412ddc Improve local-overlay docs in a few ways
In response to https://discourse.nixos.org/t/super-colliding-nix-stores/28462/24
2024-04-17 15:28:19 -04:00
Eelco Dolstra
582c7f32e8
Merge pull request #10548 from a-kenji/wiki/link
docs: fix wiki link
2024-04-17 21:04:54 +02:00