Commit Graph

124 Commits

Author SHA1 Message Date
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Thiago Kenji Okada
eec5a8bdb8 nixos-rebuild: add thiagokokada as maintainer 2024-12-05 23:16:16 +00:00
Victor Engmark
e61a2da388 nixos-rebuild: Fix ShellCheck issue
ShellCheck recommends
<https://github.com/koalaman/shellcheck/wiki/SC2174> splitting this into
`mkdir` + `chmod`, but based on the discussion with @bjornfor in #357447
it's probably better to keep the atomic directory creation and the
probable intent of the original code.
2024-12-01 09:13:59 +01:00
tomberek
5c65b89442
nixos-rebuild: fix --file with --build-host (#351667) 2024-11-19 01:03:16 -05:00
r-vdp
76d4d46b0c
nixos-rebuild: set SSHOPTS earlier so that we resolve the correct hostname
Before, when using things like proxy jumps, we would end up with the hostname of either localhost or the jump host (depending on whether you configure the jumphost in your ssh config file or in the SSHOPTS) instead of the hostname of the target host.

I was running the following command:
```bash
NIX_SSHOPTS='-p 6016 -J username@jumphost' nixos-rebuild --verbose --flake '.#' --target-host localhost --use-remote-sudo --fast build
```

and what was getting built was `nixosConfigurations.<localhost hostname>` instead of `nixosConfigurations.<remote hostname>`, because the SSH connection to determine the hostname didn't have the NIX_SSHOPTS added to it yet.

So I simply moved the logic to set up the tmp dir and set the SSHOPTS a bit higher up.
2024-11-12 16:23:37 +00:00
Emily
05d71c7ce3
nixos-rebuild: run systemd-run with / as the working directory (#353079) 2024-11-03 16:15:07 +00:00
r-vdp
1da9bad1a2
nixos-rebuild: run systemd-run with / as the working directory
Before we would run systemd-run with the user's home dir as the working
directory, but this causes issues when the home dir is on a separate
partition and that partition cannot be mounted, as the transient unit
created by systemd-run would gain a dependency on the home mount and fail.
Since the root partition is guaranteed to be mounted, using that as the
working directory avoids this issue and allows doing a remote
nixos-rebuild to fix the issue preventing /home from being mounted.
2024-11-03 11:35:30 +01:00
Will Fancher
37ee6ba681 Revert "NixOS apply script"
Reverts #344407

This has broken nixos-rebuild switch so that it no longer updates the profile, which has bad consequences including not updating the systemd-boot menu with new generations.
2024-11-01 20:18:09 -04:00
Robert Hensing
4e558812ac nixos-rebuild: Call toplevel/bin/apply when available
By executing the whole switching process using one script, we avoid
some ssh roundtrips that would slow down deployment swith --target-host.

For the other benefits, see https://github.com/NixOS/nixpkgs/issues/266290
2024-10-30 00:21:21 +01:00
Robert Hensing
4734959784 nixos-rebuild: Add proper escaping to ssh calls
SSH merges its arguments by space-concatenation - it does not preserve
the array structure.

This is arguably a historic mistake, whose fix would be too breaking.
I suppose it will stay this way forever, until perhaps a better behavior
can be opted in to using a flag, and I don't think this flag exists yet.

To make multi-argument commands work reliably over ssh, we need to escape
them, which is what the ${@@Q} incantation achieves.
2024-10-30 00:21:20 +01:00
Justinas Stankevicius
47406c64bc nixos-rebuild: fix --file with --build-host 2024-10-27 16:03:47 +02:00
Will Fancher
6dcfaeb324
nixos-rebuild: Fix broken -I option (#348886) 2024-10-15 18:21:24 -04:00
Anders Kaseorg
42a12a0551 nixos-rebuild: Fix broken -I option
Commit 617a1a6e57 (#341402) broke this.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2024-10-15 15:16:33 -07:00
Robert Hensing
6f1890f3e6
nixos-rebuild: add --no-ssh-tty flag (#339388) 2024-10-15 10:10:21 +02:00
Jörg Thalheim
ed47a0bb77
nixos-rebuild.sh: pass flags to nix-copy-closure whenever possible (#341402) 2024-10-14 08:10:38 +02:00
K900
2f204572c6 nixos-rebuild: remove accidentally lost check
We should not set version to .git. when we don't know the commit.
2024-09-29 12:15:23 +03:00
K900
1bf0ffb22e nixos-rebuild: inline get-version-suffix script
It has no other consumers anyway. Also saves some work.
2024-09-19 20:05:58 +03:00
Eli Kogan-Wang
617a1a6e57 nixos-rebuild.sh: pass flags to nix-copy-closure whenever possible 2024-09-12 17:01:07 +02:00
Aleksana
de383830c4
nixos-rebuild: Fix repl with channels (#332705) 2024-09-06 23:07:25 +08:00
Cnly
c596592e73 nixos-rebuild: add --no-ssh-tty flag 2024-09-04 01:33:03 +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