Commit graph

42 commits

Author SHA1 Message Date
Michal Sojka 611e9302f9 nixos-rebuild: add --no-flake switch
When a NixOS system uses flakes, i.e., /etc/nixos/flake.nix exists, it
is impossible to use nixos-rebuild to build a pre-flake
configuration.nix. Of course, one can directly use nix command to
build the configuration, but not everybody remembers the correct nix
options to do that.

With the new option, it is possible to build a pre-flake configuration
with command like this:

    nixos-rebuild build-vm -I nixos-config=./vm.nix --no-flake

The option might be useful for people following older pre-flake
tutorials on a flake-based system.
2022-03-22 19:03:10 +01:00
polykernel 4a9d9928dc nixos/nix-daemon: use structural settings
The `nix.*` options, apart from options for setting up the
daemon itself, currently provide a lot of setting mappings
for the Nix daemon configuration. The scope of the mapping yields
convience, but the line where an option is considered essential
is blurry. For instance, the `extra-sandbox-paths` mapping is
provided without its primary consumer, and the corresponding
`sandbox-paths` option is also not mapped.

The current system increases the maintenance burden as maintainers have to
closely follow upstream changes. In this case, there are two state versions
of Nix which have to be maintained collectively, with different options
avaliable.

This commit aims to following the standard outlined in RFC 42[1] to
implement a structural setting pattern. The Nix configuration is encoded
at its core as key-value pairs which maps nicely to attribute sets, making
it feasible to express in the Nix language itself. Some existing options are
kept such as `buildMachines` and `registry` which present a simplified interface
to managing the respective settings. The interface is exposed as `nix.settings`.

Legacy configurations are mapped to their corresponding options under `nix.settings`
for backwards compatibility.

Various options settings in other nixos modules and relevant tests have been
updated to use structural setting for consistency.

The generation and validation of the configration file has been modified to
use `writeTextFile` instead of `runCommand` for clarity. Note that validation
is now mandatory as strict checking of options has been pushed down to the
derivation level due to freeformType consuming unmatched options. Furthermore,
validation can not occur when cross-compiling due to current limitations.

A new option `publicHostKey` was added to the `buildMachines`
submodule corresponding to the base64 encoded public host key settings
exposed in the builder syntax. The build machine generation was subsequently
rewritten to use `concatStringsSep` for better performance by grouping
concatenations.

[1] - https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md
2022-01-26 21:04:50 -05:00
rembo10 3898a66cc4 Update nixos-rebuild man page to reflect target-host change
See:
https://github.com/NixOS/nixpkgs/pull/126614
2021-12-22 00:56:19 -08:00
Timothy DeHerrera 6dbeb3190d
Merge pull request #126544 from jonringer/nixos-rebuild-use-substitutes
nixos-rebuild: add --use-substitutes option
2021-09-09 13:53:37 -06:00
Lara 22a7874024 nixos/doc: Fix synopsis for nixos-rebuild(8) 2021-07-07 21:26:09 +00:00
Jonathan Ringer bf185eaa69
nixos-rebuild: add --use-substitutes option 2021-06-11 12:46:16 -07:00
Jörg Thalheim 26c487ee99 nixos-rebuild: document override-input 2021-06-07 01:14:09 -04:00
Eelco Dolstra 4cffb1212a nixos-rebuild --fast: Don't imply --show-trace
There is no logical reason for --fast to imply --show-trace, and this
seems to be a historical accident. Using --show-trace by default is
bad UX since it can give very long error messages (e.g. 550 lines for
a non-existent attribute in environment.systemPackages).
2021-06-03 19:01:09 +02:00
WORLDofPEACE 3ad3041918 doc/nixos-rebuild(8): add Nix --impure option to summary 2020-09-28 19:41:05 -04:00
Graham Christensen d9a93852d4
nixos-rebuild: support --upgrade-all and document --upgrade (#83327) 2020-09-25 17:22:11 +02:00
Julien Moutinho c6a3a0f4f5 nixos-rebuild: do not depend on nix.conf to activate flakes 2020-09-04 06:56:09 +02:00
Niklas Hambüchen 2fa351b6a5 qemu-vm.nix: Do not mount /boot read-only.
There does not seem to be a good reason to do this, and it breaks running
`nixos-rebuild boot --install-bootloader` inside the VM.
2020-07-04 14:44:33 +02:00
Eelco Dolstra fb051f0dec nixos-{rebuild,container}: Use flakeref#attrpath syntax
This makes them consistent with the 'nix' command line.
2020-02-05 23:15:18 +01:00
Eelco Dolstra cfd468adbb nixos-rebuild: Use /etc/nixos/flake.nix if it exists 2020-02-05 23:15:18 +01:00
Eelco Dolstra 22cc7ab78c nixos-rebuild: Add --flake option 2020-02-05 23:15:18 +01:00
Bjørn Forsman 2c09cfc097 nixos-rebuild: add explicit option to enable (remote) sudo
Add --use-remote-sudo option. When set, remote commands will be prefixed
with 'sudo'. This allows using sudo remotely _without_ having to use
sudo locally (when using --build-host/--taget-host).
2019-11-07 17:03:12 +01:00
Albert Safin 0eaf29433e nixos/doc: fix manpage format
Spaces inside <refname> cause stray double underscore in generated manual pages.

Fixes #70468
2019-10-05 15:55:49 +00:00
Eelco Dolstra b0ccd6dd16
Revert "nixos/doc: re-format"
This reverts commit ea6e8775bd. The new
format is not an improvement.
2019-09-19 19:17:30 +02:00
Jan Tojnar ea6e8775bd
nixos/doc: re-format 2019-09-18 22:13:35 +02:00
Eelco Dolstra 054f01ee1b
man-nixos-rebuild.xml: Improve layout 2019-09-16 14:42:59 +02:00
WilliButz 7a29431da9
Merge pull request #66561 from Ma27/document-user-services-on-rebuild
nixos/doc: document that services defined with `systemd.users` aren't restarted by nixos-rebuild
2019-08-13 16:43:40 +02:00
Maximilian Bosch 551230b7f6
nixos/doc: document that services defined with systemd.users aren't restarted by nixos-rebuild 2019-08-13 16:26:09 +02:00
WilliButz bab5455d80
Merge pull request #62914 from Ma27/improve-nixos-rebuild-manpage
doc/nixos-rebuild(8): add Nix options to summary
2019-08-13 15:54:51 +02:00
Jan Tojnar a3f2131eb6 doc: Use prompt more often 2019-06-17 13:25:50 +02:00
Maximilian Bosch eacd1b75dc
doc/nixos-rebuild(8): add Nix options to summary
It seems as the sentence at the bottom of the option summary about
Nix-specific options isn't enough, it's probably more helpful to list
those options in the synopsis as well.
2019-06-10 02:10:23 +02:00
Vladimír Čunát 4c3ec0e325
nixos docs: run the formatting tool (no content change)
As documented in the docs themselves :-)
2019-03-22 14:44:11 +01:00
Piotr Bogdan b01302b85e nixos/manual: fix build 2019-03-02 10:32:24 +00:00
Daiderd Jordan ad0b82d067
nixos-rebuild: add changelog/docs for edit subcommand 2019-02-25 19:36:23 +01:00
Vladimír Čunát 9d16949d42
nixos manual: fix a typo that made it invalid XML
The problem was merge to master in the bfbadab4 commit.
2019-01-13 23:23:32 +01:00
Frederik Rietdijk 9f827d66f5
Update nixos/doc/manual/man-nixos-rebuild.xml
Co-Authored-By: Mic92 <Mic92@users.noreply.github.com>
2019-01-12 18:26:00 +00:00
Frederik Rietdijk f45195fb44
Update nixos/doc/manual/man-nixos-rebuild.xml
Co-Authored-By: Mic92 <Mic92@users.noreply.github.com>
2019-01-12 18:25:52 +00:00
Jörg Thalheim e40bfa4d85
nixos-rebuild: allow to override builders
Since nix 2.0 the no-build-hook option was replaced by the builders options
that allows to override remote builders ad-hoc.
Since it is useful to disable remote builders updating nixos without network,
this commit reintroduces the option.
2019-01-11 11:40:25 +00:00
Samuel Dionne-Riel 15fa70cd78 nixos/doc+man: Fixes squishedtogether definitions. 2018-05-31 21:07:15 -04:00
Samuel Dionne-Riel 88ca2b1ec4 nixos/doc: ran make format
With visual inspection that nothing got worse.
2018-05-31 21:03:51 -04:00
Graham Christensen eca5c99bf8
nixos docs: format =) 2018-05-01 19:57:09 -04:00
Théo Zimmermann fba6537341 doc: correct typo (#21176) 2016-12-15 17:13:44 +01:00
Shea Levy b4954a8f38 Deprecate --install-grub in favor of --install-bootloader for nixos-rebuild.
Fixes #14293
2016-08-16 07:51:58 -04:00
Rickard Nilsson 448a2af041 nixos-rebuild: Document --build-host and --target-host options 2016-01-01 18:22:11 +01:00
Eelco Dolstra a574065a81 nixos-rebuild: Add ‘dry-activate’ command
‘nixos-rebuild dry-activate’ builds the new configuration and then
prints what systemd services would be stopped, restarted etc. if the
configuration were actually activated. This could be extended later to
show other activation actions (like uids being deleted).

To prevent confusion, ‘nixos-rebuild dry-run’ has been renamed to
‘nixos-rebuild dry-build’.
2015-03-09 16:50:59 +01:00
Evgeny Egorochkin 9cb699f587 nixos manual: replace /etc/nixos/nixos which no longer exists with more generic and more
correct /path/to/nixpkgs/nixos
2013-10-27 08:39:32 +02:00
Eelco Dolstra a042d91290 nixos-rebuild: Document --profile-name 2013-10-13 17:35:54 +02:00
Eelco Dolstra 5c1f8cbc70 Move all of NixOS to nixos/ in preparation of the repository merge 2013-10-10 13:28:20 +02:00
Renamed from doc/manual/man-nixos-rebuild.xml (Browse further)