Commit Graph

986741 Commits

Author SHA1 Message Date
r-vdp dbbee0dd3a nixos-rebuild-ng: document --elevate / --ask-elevate-password 2026-05-29 00:22:20 +03:00
r-vdp c30b2c06d9 nixos-rebuild-ng: add --elevate=run0
Locally this just prefixes activation commands with `run0 --`, so the
user's normal polkit agent (graphical or pkttyagent) handles auth.

For --target-host, run0 would need a controlling terminal, which we
deliberately do not allocate over SSH. Instead the equivalent
`systemd-run --uid=0 --pipe --wait ...` form is used. Without
--ask-elevate-password this relies on a polkit rule on the target
granting the deploying user `org.freedesktop.systemd1.manage-units`.
With --ask-elevate-password the command is wrapped in
polkit-stdin-agent, which registers a per-process polkit agent for the
child and answers the PAM conversation from stdin.

A transient unit does not inherit the SSH login environment. On NixOS
the unit's PATH is just the systemd store path, so neither `env` nor
`nix-env` would be found inside it. Elevator.wrap_remote() therefore
now takes the env mapping and the command, and returns the full remote
argv: sudo keeps the existing `/bin/sh -c 'exec /usr/bin/env -i ...'`
wrapper inside itself, while run0 puts the shell wrapper *around*
systemd-run and forwards the resolved values into the unit via
--setenv. The Arg/Args/EnvValue/PRESERVE_ENV types and the env-shell
helper move from process.py into elevate.py to avoid a circular import,
and callers are updated to import them from there.

polkit-stdin-agent is resolved on the machine doing the elevation
rather than baked in as a host-arch store path, which would be wrong
for --no-reexec, cross-arch deploys (re-exec hits ENOEXEC and falls
back), --rollback/--store-path, and Darwin deployers. Locally that is
PATH. Remotely, Elevator.for_target_config() binds the elevator to the
toplevel just placed on the target, and a small /bin/sh picker tries
<toplevel>/sw/bin/polkit-stdin-agent (target-arch, in the copied
closure) then PATH, exiting with an actionable error pointing at
system.tools.nixos-rebuild.enableRun0Elevation when neither resolves.
That option (added here) puts the agent in environment.systemPackages
and asserts security.polkit.enable.

A nixos-rebuild-target-host subtest exercises the full remote run0
path (polkit-stdin-agent + systemd-run + activation) end-to-end.

Drop the now-unused stdenv argument from package.nix while here.

Closes #507054.
2026-05-29 00:22:19 +03:00
r-vdp 4d4952ae28 polkit-stdin-agent: init at 0.3.0
A non-interactive polkit authentication agent that answers PAM prompts
from a file descriptor. Provides the missing `sudo --stdin` equivalent
for run0/systemd-run, which authorise via polkit and otherwise require
a controlling terminal for pkttyagent.

Used by the upcoming `nixos-rebuild --elevate=run0
--ask-elevate-password`. The machine performing the elevation enables
system.tools.nixos-rebuild.enableRun0Elevation (added in the next
commit), which puts this package on PATH locally and at
<toplevel>/sw/bin on a remote target.
2026-05-29 00:22:19 +03:00
r-vdp 0273aad113 nixos-rebuild-ng: move password prompt out of Remote
Remote no longer carries auth state, the elevator owns the password
end-to-end. The prompt itself lives in Elevator.with_prompted_password()
so the CLI entry point stays a thin orchestrator and all
elevation-related plumbing is in one module.
2026-05-29 00:22:18 +03:00
r-vdp a769269aef nixos-rebuild-ng: add --elevate and --ask-elevate-password flags
--elevate={none,sudo} picks the privilege-elevation backend and
--ask-elevate-password (-S) prompts locally and feeds the password to
whichever backend is selected.

--sudo and --ask-sudo-password are kept as silent aliases that map onto
the new flags. --use-remote-sudo stays deprecated as before.
2026-05-29 00:22:17 +03:00
r-vdp c0941322a4 nixos-rebuild-ng: thread Elevator through the call chain
Mechanical replacement of `sudo: bool` with `elevate: Elevator` across
run_wrapper, nix.py and services.py, plus test updates. The temporary
shim in run_wrapper is removed.

`args.elevator` is constructed in execute() from the existing --sudo /
--ask-sudo-password flags so the CLI surface is unchanged in this
commit.
2026-05-29 00:22:16 +03:00
r-vdp b9a7b55898 nixos-rebuild-ng: run_wrapper: delegate sudo wrapping to Elevator
Replaces the inline sudo command assembly with calls into the Elevator
introduced in the previous commit. The `sudo: bool` parameter is kept
as a temporary shim that constructs a SudoElevator internally, so no
caller or test changes are needed and the existing test suite proves
the move is behaviour-preserving.

The shim is removed in the next commit.
2026-05-29 00:22:16 +03:00
r-vdp 59cdf0f127 nixos-rebuild-ng: introduce Elevator abstraction
Adds elevate.py with an Elevator base, NoElevator and SudoElevator.
Nothing uses it yet. This is a pure addition so the next commit can
swap run_wrapper over without mixing new code with the move.

The SudoElevator wrapping is byte-for-byte what run_wrapper currently
emits (including NIX_SUDOOPTS handling), so behaviour is unchanged
once the switch happens.

Motivated by #507054: threading a second `run0: bool` alongside
`sudo: bool` through every signature does not scale and makes invalid
combinations representable.
2026-05-29 00:22:15 +03:00
nixpkgs-ci[bot] aad530e44f Merge master into staging-nixos 2026-04-25 06:33:53 +00:00
zowoq 47ec133254 terraform-providers.hashicorp_google-beta: 7.28.0 -> 7.29.0 (#513271) 2026-04-25 06:08:11 +00:00
zowoq 0ac86dd716 terraform-providers.aiven_aiven: 4.54.0 -> 4.55.2 (#513270) 2026-04-25 06:08:06 +00:00
nixpkgs-ci[bot] 252c21ca7b yarn-berry: 4.13.0 -> 4.14.1 (#512685) 2026-04-25 05:46:41 +00:00
dotlambda 59910a8b87 bitwarden-cli: 2026.3.0 -> 2026.4.1 (#513253) 2026-04-25 05:18:17 +00:00
R. Ryantm 2a2197aa8f terraform-providers.hashicorp_google-beta: 7.28.0 -> 7.29.0 2026-04-25 05:08:18 +00:00
R. Ryantm 31b4675561 terraform-providers.aiven_aiven: 4.54.0 -> 4.55.2 2026-04-25 05:04:21 +00:00
Franz Pletz 816f1571c6 rspamd: use vendored doctest to fix build (#512834) 2026-04-25 03:44:56 +00:00
caverav cdc53e7008 bitwarden-cli: 2026.3.0 -> 2026.4.1 2026-04-24 23:01:08 -04:00
Matthieu Coudron 2af030e5a5 tree-sitter-grammars.tree-sitter-fsharp: 0.2.2-unstable-2026-03-29 -> 0.3.0-unstable-2026-04-16 (#510540) 2026-04-25 02:15:50 +00:00
Matthieu Coudron 334a74332d tree-sitter-grammars.tree-sitter-ghostty: 1.2-unstable-2026-01-02 -> 1.3.0-unstable-2026-04-24 (#513230) 2026-04-25 02:15:39 +00:00
Michael Daniels 65c7f0d9d5 python3Packages.google-cloud-firestore: 2.26.0 -> 2.27.0 (#511671) 2026-04-25 01:55:01 +00:00
Peder Bergebakken Sundt 8169375de2 typical: 0.12.1 -> 0.15.0 (#512871) 2026-04-25 00:45:00 +00:00
Peder Bergebakken Sundt 7a51703980 ammonite: 3.0.6 -> 3.0.9 (#512637) 2026-04-25 00:44:26 +00:00
Peder Bergebakken Sundt f7bf13b6db harper: 2.0.0 -> 2.1.0 (#513188) 2026-04-25 00:43:46 +00:00
Jhonas Wernery f26d411e7f solidtime-desktop: fix build (#512338) 2026-04-25 00:34:27 +00:00
Peder Bergebakken Sundt 6f4f1dd551 normcap: fix QT_QPA_PLATFORM (#507133) 2026-04-25 00:31:52 +00:00
nixpkgs-ci[bot] 9bacb5e061 Merge master into staging-nixos 2026-04-25 00:31:25 +00:00
kirillrdy e0ee38d58b blender: reenable darwin build (#509838) 2026-04-25 00:29:52 +00:00
Jhonas Wernery 7e5edfd756 sensu-go-backend: 6.13.1 -> 6.14.0 (#510257) 2026-04-25 00:29:42 +00:00
Michael Daniels 3766f4c3d6 fosrl-newt: mark broken for Darwin; fosrl-{newt,olm}: enable __structuredAttrs (#509882) 2026-04-25 00:22:53 +00:00
Michael Daniels f8b81cd1c9 .github: Bump cachix/install-nix-action from 31.10.4 to 31.10.5 (#513059) 2026-04-25 00:17:53 +00:00
kirillrdy c5b61d6ccf python3Packages.ray: 2.55.0 -> 2.55.1 (#513219) 2026-04-25 00:15:15 +00:00
kirillrdy 116266f526 python3Packages.pylance: 4.0.0 -> 4.0.1 (#513192) 2026-04-25 00:14:38 +00:00
Jack Rosenberg ee800e745e fosrl-olm: enable __structuredAttrs 2026-04-24 20:13:00 -04:00
Jack Rosenberg cc32c4c44b fosrl-newt: enable __structuredAttrs 2026-04-24 20:13:00 -04:00
Jack Rosenberg 99ca18373e fosrl-newt: mark broken for darwin
Co-authored-by: Michael Daniels <mdaniels5757@gmail.com>
2026-04-24 20:12:53 -04:00
Sandro 62f27251c9 nixos/duplicity: remove absolute path literals (#513211) 2026-04-25 00:09:43 +00:00
Sandro 3b909aed2f nixos/oci-containers: remove absolute path literals (#513210) 2026-04-25 00:09:36 +00:00
Sandro ae8bb43d78 nixos/maddy: remove absolute path literals (#513213) 2026-04-25 00:09:06 +00:00
Michael Daniels be8392fa44 .github: Bump korthout/backport-action from 4.3.0 to 4.4.0 (#513060) 2026-04-25 00:07:51 +00:00
Sandro 36c52011fd python3Packages.django-allauth: 65.16.0 -> 65.16.1 (#513208) 2026-04-25 00:05:48 +00:00
Sandro 3b48158d58 wl-freeze: rename from hyprfreeze; 1.2.0 -> 2.0.2 (#508697) 2026-04-25 00:05:39 +00:00
Sandro 204d8b6cdf krbjack: fix changelog (#513190) 2026-04-24 23:57:34 +00:00
Sandro e2f1d80a3b python3Packages.sdds: fix build (#513206) 2026-04-24 23:57:16 +00:00
Sandro 8eb7f1cfd9 python3Packages.pyeclib: 1.7.0 -> 1.8.0 (#513220) 2026-04-24 23:56:27 +00:00
Martin Weinelt 244bc07e68 python3Packages.pydantic-{ai-slim,graph}: 1.84.1 -> 1.86.1 (#513228) 2026-04-24 23:53:47 +00:00
Yohann Boniface d65e0f9ed4 sylpheed: drop (#512634) 2026-04-24 23:51:32 +00:00
Azat Bahawi 08cfca36f4 radare2: 6.1.2 -> 6.1.4 , add updateScript, versionCheckHook (#511014) 2026-04-24 23:48:52 +00:00
Sandro e7ee27489f opencode: 1.14.20 -> 1.14.24 (#513165) 2026-04-24 23:43:39 +00:00
Sandro be5f192147 flare-signal: 0.20.2 -> 0.20.4 (#512990) 2026-04-24 23:40:08 +00:00
Martin Weinelt 8cd0c5e2ff python3Packages.pydantic-ai-slim: 1.84.1 -> 1.86.1
https://github.com/pydantic/pydantic-ai/compare/v1.84.1...v1.86.1
2026-04-25 01:40:04 +02:00