Commit Graph

105 Commits

Author SHA1 Message Date
Aleksana
de383830c4
nixos-rebuild: Fix repl with channels (#332705) 2024-09-06 23:07:25 +08:00
éclairevoyant
eeb2588a59
Merge pull request #333768 from miallo/fix-list-generations-with-sudo
nixos-rebuild: remove list-generations piping into $PAGER to fix execution with sudo
2024-08-20 02:41:42 +00:00
Emily
4e7d996aa8
Merge pull request #331741 from max-privatevoid/pr-nixos-rebuild-no-sudo-user
nixos-rebuild: ignore SUDO_USER
2024-08-12 01:10:21 +01:00
Michael Lohmann
fd1f078fea nixos-rebuild: remove list-generations piping into $PAGER
In https://github.com/NixOS/nixpkgs/issues/333734 it was noticed that
executing the list-generations with sudo would fail. The reason was,
that the variable $PAGER was set, but empty.

${PAGER:cat} only has the default of cat if PAGER is unset, but it will
not default to cat if the variable is empty instead.

One way of fixing this would have been to change it to ${PAGER:-cat},
but since a pager requires pressing an additional key to exit, it is a
bit annoying in the first place, so it was removed instead.
2024-08-10 22:36:49 +02:00
MrQubo
a14312cbed nixos-rebuild: Fix repl with channels 2024-08-06 13:40:52 +02:00
Wroclaw
e4a3db6ecc nixos-rebuild: fix condition for byAttr in edit action
this prevented running that action
2024-08-03 03:44:12 +02:00
Max
89ec1b315a nixos-rebuild: ignore SUDO_USER 2024-08-02 12:54:35 +02:00
Vladimír Čunát
211398c03e
Merge branch 'staging-next' into staging 2024-07-14 08:35:35 +02:00
tomberek
e28b6650c3
Merge pull request #320462 from amozeo/pkgs/nixos-rebuild/by-attr
nixos-rebuild, nixos-install: add support for --file and --attr flags
2024-07-13 20:46:31 -04:00
Wroclaw
61c719e473 nixos-rebuild: add support for --file and --attr flags
adds support of building system from nix file and attrPath directly

these are --file and --attr flags in nix-build respectfully
2024-07-10 20:59:41 +02:00
Travis A. Everett
8f413d8a44 binlore: migrate override lore to package passthru
Lore overrides have been included with binlore's source up to now, but
this hasn't worked very well. (It isn't as easy to self-service for
people working in nixpkgs, and its use of partial pnames for matching
breaks down around some edge cases like version numbers appearing
early in perl pnames, or multiple packages having identical pnames.)
2024-07-04 11:15:05 -05:00
Masum Reza
cd97722d51
Merge pull request #316301 from amozeo/nixos-rebuild/nix-common-options
nixos-rebuild: Document all supported builder flags in manpage
2024-06-23 10:44:02 +05:30
Wroclaw
9475000878 nixos-rebuild: reverse some conditionals and factor out getNixDrv
in "building nix" section, removes indent clutter
2024-06-16 10:14:02 +02:00
Alexis Hildebrandt
bf995e3641 treewide: Remove ending period from meta.description
nix run nixpkgs#silver-searcher -- -G '\.nix$' -0l 'description.*".*\.";' pkgs \
  | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee 's/(description.*)\.";/\1";/'
2024-06-09 23:04:51 +02:00
Wroclaw
2ac2449841 nixos-rebuild: document supported flake-related options 2024-06-06 08:54:21 +02:00
Wroclaw
509bbd7a4a nixos-rebuild: Document all supported builder flags in manpage 2024-06-01 03:08:23 +02:00
Pol Dellaiera
b5c90bbeb3
Merge pull request #283634 from itzwam/master
nixos-rebuild: Fetch Flake's default configurationName (Hostname) from targetHost
2024-05-07 13:12:17 +02:00
éclairevoyant
2680b60c30
nixos-rebuild: avoid rebuilding nix / reexecuting nixos-rebuild for list-generations 2024-04-23 15:03:52 -04:00
Sandro
65b10c53d1
Merge pull request #288610 from sephii/nixos-rebuild-remote-specialisation
nixos-rebuild: fix --specialisation with remote builder and target
2024-04-20 21:11:35 +02:00
Robert Hensing
9ffe63c6fa
Merge pull request #300335 from amarshall/nixos-rebuild-repl-path
nixos-rebuild: Fix `repl` with a relative flake path
2024-04-02 14:22:49 +02:00
Andrew Marshall
228dc7eaf4 nixos-rebuild: Fix repl with a relative flake path
Most nixos-rebuild commands support a relative flake path, however
`repl` uses `builtins.getFlake` and that requires an absolute path. So
ensure we pass an absolute path to it, providing UX consistency. Only do
so when the path exists in order to passthrough URLs as-is.
2024-04-01 16:29:54 -04:00
Philip Taron
a696dbb659
nixos-rebuild: use substitute rather than substituteAll
No change in produced output.
2024-03-30 12:00:21 -07:00
Thiago Kenji Okada
48f9437cd1
Merge pull request #263360 from duament/nixos-rebuild-pipe
nixos-rebuild: use --pipe instead of --pty in systemd-run
2024-03-28 18:25:08 +00:00
K900
99bebcbfa4 nixos-rebuild: avoid --preserve-env
sudo-rs does not support it, but also it's just spooky action at a distance.
2024-02-18 10:24:51 +03:00
Sylvain Fankhauser
a77bfd0f15
nixos-rebuild: fix --specialisation with remote builder and target
Fixes #286066.
2024-02-13 18:06:08 +01:00
Jacek Galowicz
3dbf54decb nixos-rebuild: Fix "too long for Unix domain socket" errors due to long
TMPDIR
2024-01-29 06:27:30 +01:00
Antoine Toinux
03b68f1431 nixos-rebuild: Fetch Flake's default configurationName (Hostname) from targetHost 2024-01-26 15:47:04 +01:00
Rvfg
ff3d9902e0
nixos-rebuild: use --pipe instead of --pty in systemd-run 2024-01-26 13:10:22 +08:00
Robert Hensing
e0000983db
Merge pull request #279170 from SuperSandro2000/nixos-repl-lib
nixos-rebuild: add lib to repl to make debugging even easier
2024-01-19 12:29:04 +01:00
Robert Hensing
d059ce52ce nixos-rebuild: Partially future-proof the repl test 2024-01-18 18:04:46 +01:00
Robert Hensing
71154a6e30 nixos-rebuild: Test the repl subcommand 2024-01-18 18:04:46 +01:00
Robert Hensing
8be52599b7 nixos-rebuild: Prefer the module lib when available
pkgs.lib and lib need not match, so prefer the one that the modules get.

For example:

```nix
nix-repl> :lf nixpkgs
nix-repl> (lib.nixosSystem { modules = [ ({ lib, ... }: assert lib?nixosSystem; { nixpkgs.hostPlatform = "x86_64-linux"; }) ]; }).pkgs.lib?nixosSystem
false
```

The code is backwards compatible, for the case where you evaluate a
config whose nixpkgs doesn't have the preceding commit yet.
2024-01-15 00:28:36 +01:00
Robert Hensing
c8c3c5854e nixos-rebuild: Avoid empty command
"${a[@]}" => ok
"${foo:+a[@]}" => empty string when length is 0
2024-01-14 04:03:25 +01:00
Robert Hensing
472dfb3888 nixos-rebuild: Add tty only to "sudo-able" commands for target
This solves again the problem solved by 09fd207cb8.

To quote:

> We always want to use `ssh -t` to force PTY allocation as there may be
> interactive SSH prompts like trusting unknown hosts.

However, the creation of a pseudoterminal causes the remote stdout and stderr
to point to the same tty, resulting in a single stream in the ssh client,
which breaks other usages of ssh, such as `--build-host`.

Hence, this commit only sets the flag for invocations that need it -
or would need it if sudo were disabled. That should help with development
and gives a somewhat more consistent user experience.
2024-01-14 01:14:33 +01:00
Robert Hensing
99d3e0c168 Revert "nixos-rebuild: fix entering sudo password over SSH"
This reverts commit 09fd207cb8.

It caused a regression when using `--build-host` and flakes.
See https://github.com/NixOS/nixpkgs/pull/277642#issuecomment-1890783714
2024-01-14 00:48:53 +01:00
Michael Hoang
cd61094234 nixos-rebuild: fix systemd-run hanging over SSH 2024-01-07 03:40:01 +11:00
Michael Hoang
09fd207cb8 nixos-rebuild: fix entering sudo password over SSH
We always want to use `ssh -t` to force PTY allocation as there may be
interactive SSH prompts like trusting unknown hosts.
2024-01-07 03:40:01 +11:00
Michael Hoang
5aad97fcff nixos-rebuild: only use sudo when necessary 2024-01-07 03:40:01 +11:00
Michael Hoang
b09de27cd6 nixos-rebuild: add --target-host test 2024-01-07 03:40:01 +11:00
Sandro Jäckel
50d0eb6c9f
nixos-rebuild: add lib to repl to make debugging even easier 2024-01-06 15:34:45 +01:00
Linus Heckemann
bb2a5d8706
Merge pull request #270212 from SuperSandro2000/nixos-rebuild-accept-flake-config
nixos-rebuild: passthru accept-flake-config
2023-12-14 14:39:07 +01:00
Robert Hensing
0e062cb692 nixos-rebuild: Add nixos-rebuild repl
Apologies to the non-flake users; your repl isn't quite as fancy,
but at least evaluates your config exactly as you would expect,
unlike flakes which are only evaluated impurely for now.
2023-12-10 06:36:02 +01:00
Sandro Jäckel
89ef7b76f3
nixos-rebuild: passthru accept-flake-config 2023-12-04 22:33:25 +01:00
Michael Lohmann
67c354b081 nixos-rebuild: remove manpage hint on feature that is not merged
This is a hint that mentions the feature #105910 but that is not yet
merged. This is very confusing and since it there is no progress with
that merge we should remove the reference
2023-11-27 12:35:40 +01:00
Samuel Dionne-Riel
c95728ce72
Merge pull request #262684 from samueldr/feature/nixos-rebuild-completions
nixos-rebuild: Locally own the nixos-rebuild (bash) completions
2023-11-05 22:41:03 -05:00
Thiago Kenji Okada
ccebc89954 nixos/tests: add nixos-rebuild-install-bootloader 2023-10-23 12:39:40 +01:00
Thiago Kenji Okada
b269e6853e nixos-rebuild: fix --install-bootloader flag with systemd-run 2023-10-22 12:19:59 +01:00
Samuel Dionne-Riel
a5e30e71b6 nixos-rebuild: Locally own the nixos-rebuild completion 2023-10-22 03:18:50 -04:00
Samuel Dionne-Riel
61d5040ef1 nixos-rebuild: Drop incorrectly implemented short args for build/target host
*Nobody* uses them, or else it'd have been fixed already.
2023-10-22 02:42:48 -04:00
Thiago Kenji Okada
ecd89093e1 nixos-rebuild: run activation inside systemd-run
Right now, running `nixos-rebuild switch` in a remote system via SSH may
put the system in an unusable state by restarting services (e.g.:
network ones like systemd-networkd.service) during the update. This will
cause the SSH to lose access to the TTY, stopping the process entirely.

This commit wraps up the call to `switch-to-configuration` inside a
systemd-run call, making the switch resiliant against TTY loss, since it
will allocate its own TTY. For the user this should be entirely
transparent though, with the only visible change is that the
`switch-to-configuration` messages will be logged through journalctl
(e.g.: `journalctl -u nixos-rebuild-switch-to-configuration`).
2023-10-04 20:45:23 +01:00