Commit Graph

17 Commits

Author SHA1 Message Date
Artturi 0cc1a01d6a
Merge pull request #126960 from NixOS/backport-123720-to-release-21.05
[Backport release-21.05] nixos-rebuild: fix creating ./result symlink for flakes
2021-08-06 16:59:35 +03:00
Eelco Dolstra 8f5794cbda nixos-rebuild: Set inherit_errexit
Without this, failure of nixBuild() and nixFlakeBuild() was ignored
(since bash doesn't inherit 'set -e' in subshells by default), so the
script would proceed with a bogus ./result link, e.g.

  ++ readlink -f /tmp/nixos-rebuild.NfHKxx/result
  + pathToConfig='/nix/store/m7dvk6an18cpr95qn5wnig2600qhv6w7-nix-2.4pre20210727_706777a/bin/nix
  /tmp/nixos-rebuild.NfHKxx/result'
  + '[' test = switch -o test = boot ']'
  + copyToTarget '/nix/store/m7dvk6an18cpr95qn5wnig2600qhv6w7-nix-2.4pre20210727_706777a/bin/nix
  /tmp/nixos-rebuild.NfHKxx/result'
  + '[' '' = '' ']'
  + '[' test = switch -o test = boot -o test = test -o test = dry-activate ']'
  + targetHostCmd /nix/store/m7dvk6an18cpr95qn5wnig2600qhv6w7-nix-2.4pre20210727_706777a/bin/nix /tmp/nixos-rebuild.NfHKxx/result/bin/switch-to-configuration test
  + '[' -z '' ']'
  + sudo -- /nix/store/m7dvk6an18cpr95qn5wnig2600qhv6w7-nix-2.4pre20210727_706777a/bin/nix /tmp/nixos-rebuild.NfHKxx/result/bin/switch-to-configuration test
  error: '/tmp/nixos-rebuild.NfHKxx/result/bin/switch-to-configuration' is not a recognised command
  Try '/nix/store/m7dvk6an18cpr95qn5wnig2600qhv6w7-nix-2.4pre20210727_706777a/bin/nix --help' for more information.
  + echo 'warning: error(s) occurred while switching to the new configuration'
  warning: error(s) occurred while switching to the new configuration

(cherry picked from commit 0ad27c8653daaf59cf0fb2e0b30561a8d86303fa)
2021-07-28 16:32:56 +00:00
rnhmjoj d81e14f491 nixos-rebuild: fix --use-remote-sudo
Currently fails with:

  $ nixos-rebuild test --target-host myhost --use-remote-sudo
  building Nix...
  sudo: /run/current-system/sw/bin/sudo must be owned by uid 0 and have the setuid bit set

It seems setting an explicit PATH in the ssh command overrides the
remote setuid wrappers.

(cherry picked from commit 35a8d78e44d566d6d2ddba42ae5137f7a511a090)
2021-06-20 09:23:20 +00:00
Samuel Gräfenstein 044a0d06c7 nixos-rebuild: fix creating ./result symlink for flakes
(cherry picked from commit 531dc2e0f12673cce9cc6ea3dc5fd8bfef39c9bf)
2021-06-15 15:21:24 +00:00
Chuck c764b9f946 nixos-rebuild: Pass flakes flags when doing local flakes build
(cherry picked from commit 1c80856545fd1234ba84b8981d26ca8e786376c2)
2021-06-10 22:31:01 +00:00
Robert Hensing 3c6fcc9073
Merge pull request #122987 from alyssais/nixos-rebuild-aarch64
nixos-rebuild: support prebuilt Nix on aarch64
2021-05-16 22:00:39 +02:00
Théophane Hufschmitt 601ceec28d
nixos-rebuild: Don’t reset the experimental features
Make sure that the Nix `experimental-features` set by a user aren’t overwritten when running `nixos-rebuild --flake` by using `--extra-experimental-features` rather than `--experimental-features`.

Fix https://github.com/NixOS/nix/issues/4784
2021-05-16 16:17:42 +02:00
Alyssa Ross 341836ced2
nixos-rebuild: support prebuilt Nix on aarch64
We have a fallback hashes entry for aarch64-linux, but it was unused
by nixos-rebuild.
2021-05-14 12:53:57 +00:00
Charlotte Van Petegem fa827f3f62
nixos-rebuild: Use old-style nix command when building flake on a remote host 2021-04-16 12:42:26 +02:00
Charlotte Van Petegem 456aa2db49
nixos-rebuild: Allow remote building when using flakes 2021-04-16 11:59:21 +02:00
Cole Helbling 85f5d9a6ed
nixos-rebuild: nix flake info -> nix flake metadata
As of
66fa1c7375,
the `nix flake info` and `nix flake list-inputs` commands were merged into
`nix flake metadata`.
2021-03-18 17:26:51 -07:00
Jörg Thalheim e7c8a73390
Merge pull request #108879 from kreisys/nixos-rebuild-no-systemctl
nixos-rebuild: Remove ambient systemctl dependency
2021-03-07 14:09:39 +00:00
fricklerhandwerk 283eaaff3e nixos-rebuild: use remote $PATH in buildHostCmd
this fixes the issue when using

    nixos-rebuild switch --target-host <target> --use-remote-sudo

when the local machine does not have anything in `$PATH` that would
resolve to `sudo` on the remote machine.

the single quotes prevent expansion of `$PATH` on the local machine,
such that the remote machine's value of that variable is used.
2021-02-10 23:13:37 -08:00
Domen Kožar 9e1c01f500
--no-net is now --offline 2021-02-05 11:57:42 +00:00
Shay Bergmann 4cf09dd98c
Remove unnecessary check that uses systemctl
The use of systemctl makes this incompatible with darwin even though
building/deploying a nixos closure from darwin is a perfectly valid use case.

NIX_DAEMON is pretty much unnecessary nowadays as nix uses other
indicators for deciding whether to use the daemon or not.
2021-02-02 10:26:50 -05:00
Dominik Xaver Hörl e9abfbde62 nixos-rebuild: put some important dependencies in PATH 2021-01-16 13:24:18 +01:00
Domen Kožar c32f5b22f1
move nixos-rebuild into pkgs 2021-01-15 20:07:38 +01:00