Commit Graph

54 Commits

Author SHA1 Message Date
Sergey Gulin
f10a3aa17c
[Chore] Fix overlay
Problem: In my recent PR(#264), I accidentally picked overlay output
changes from the philtaken/nixos-vm-tests branch, which broke existing
overlay imports after updating the deploy-rs input.

Solution: Add backwards compatibility so that users don't have to make
changes to their nix flakes.
2024-04-01 15:02:55 +03:00
Sergey Gulin
a928352641
[OPS-1384] Introduce NixOS VM tests
Problem: Currently, the only way to test deploy-rs deployments is to
actually do a deployment to an existing NixOS instance (either in VM,
or a real machine) manually. This is a bit inconvenient and one can
forget to test changes when developing/reviewing deploy-rs changes.

Solution: Add NixOS VM tests.
2024-03-29 20:25:47 +03:00
Simon Menke
b5625de9c9
Replace jsonschema-cli with check-jsonschema
jsonschema-cli is deprecated and will be removed in the future.
The recommended replacement is check-jsonschema.
2023-09-17 10:34:25 +02:00
Roman Melnikov
65211db63b
Merge pull request #213 from serokell/rvem/darwin-activation
[#210] Add activation script for darwin system and provide a usage example
2023-06-05 14:59:10 +08:00
Roman Melnikov
f406295680
[#210] Add activation script for darwin system and provide a usage example
Problem: It's possible to use 'deploy-rs' for deploying 'darwinSystem'
configuration from 'nix-darwin' to a darwin system. However, there is no
dedicated activatiot script for darwin and thus one has to come up with
'custom' activation script.

Solution:
1) Add 'darwin' attribute to 'lib.activate' that provides a script that
   should be used to activate 'darwinSystem' config with 'deploy-rs'.
2) Add a new 'examples/darwin' example that provides simple flake for
   deploying configuration to a darwin target.
2023-05-11 16:02:01 +08:00
Flakebi
03b02d2097
Make it possible to not rebuild deploy-rs
Use the deploy-rs from the final packages set. This can avoid rebuilding
deploy-rs when using it in a nixos config. It can use the version cached
in nixpkgs.

Also add instructions to the readme on how to craft an overlay that uses
nixpkgs deploy-rs.
2023-04-16 16:38:12 +02:00
Alexander Bantyev
3878dd40f6
Merge pull request #176 from Ma27/activate-boot
Add new activation strategy `boot` as equivalent to `nixos-rebuild boot`
2022-12-29 18:25:47 +04:00
Philipp Herzog
38d9005a73
More unique names for the checks generated by deploy-rs
Closes #162
2022-11-11 14:03:07 +01:00
Maximilian Bosch
068372aad1
Add new activation strategy boot as equivalent to nixos-rebuild boot
This can be useful when e.g. deploying a kernel update to a target host.
You usually plan a reboot (or kexec) after that to activate the new
kernel. However you don't want to wait for services to be restarted
first since these will be "restarted" anyways on the reboot. In cases
like GitLab or the Atlassian stack this actually makes a difference.

This patch changes the following things:

* If `--boot` is provided, `nix-env -p profile-to-activate --set` is
  called for each deployed profile to make sure that it is activated
  automatically after a reboot.

* However, the actual activation (e.g. `switch-to-configuration switch`)
  is skipped. Instead:

  * For NixOS, `switch-to-configuration boot` is called to set the new
    profile as default in the bootloader.

  * For everything else, nothing else is done. The profile is already
    the new default (and thus picked up on the next boot).
2022-10-09 18:47:08 +02:00
Robert Helgesson
9e79e4028a
Fetch system from stdenv.hostPlatform
The top-level `system` attribute has been deprecated for quite a
while. See

  4246d6ce21
2022-08-04 22:44:47 +02:00
Robert Helgesson
6564bee9ee
Replace runCommandNoCC by runCommand
The `runCommand` function has been using `stdenvNoCC` for quite a
while and `runCommandNoCC` is correspondingly deprecated. See

  9feb144c8c
2022-08-04 21:43:35 +02:00
Xavier Vello
ebc4577990 Update flake to support nix 2.8
nix 2.7 renamed defaultApp and defaultPackage. Both the
old and new names are supported in 2.7, but 2.8 has removed
support for the old names, breaking the nix run invocation.

Old names are kept in this PR to keep compatibility with nix 2.6,
but could be removed if support of this version is not needed anymore.
2022-05-14 22:09:00 +02:00
Alexander Bantyev
9a02de4373
Fix darwin build
Frameworks are libraries used at runtime, so should be in buildInputs
and not nativeBuildInputs.

Closes https://github.com/serokell/deploy-rs/issues/132
2021-09-28 12:51:24 +03:00
Peter Woodman
ed1ee1d866
add aarch64-darwin to built systems 2021-09-27 11:16:11 -04:00
Bernardo Meurer
dc6e17b86f
flake: replace naersk with buildRustPackage 2021-09-15 10:03:29 -07:00
notgne2
63ccbd7cdd
Add .envrc and fix devShell to work with more tools 2021-08-04 00:06:51 -07:00
Alexander Bantyev
587cbcfe8d
Merge pull request #97 from blaggacao/patch-1
fix: add meta.description
2021-07-08 10:24:53 +03:00
David Arnold
4bc3bea502
fix: add meta.description 2021-06-25 20:49:54 -05:00
Alexander Bantyev
f973cb571c
Add rustfmt and rust-analyzer to devShell 2021-06-25 11:27:05 +03:00
Alexander Bantyev
6424e7519f
flake.nix: refactor as overlay 2021-06-22 00:46:08 +03:00
Alexander Bantyev
c8854cee19
flake.nix: clean up dry-activation logic 2021-05-20 14:14:01 +03:00
Alexander Bantyev
86fecf7db2
Fix rollback to old profiles
In 5d5da48 (https://github.com/serokell/deploy-rs/pull/81), $DRY_ACTIVATE
is used in a bash script with -u. When DRY_ACTIVATE is not set (which it
is not for older profiles), the script fails. Fix this by setting a fallback.
2021-05-18 22:11:35 +03:00
notgne2
8dd6e23b95
Add helper activation function for home-manager 2021-05-10 21:43:16 -07:00
Oleg Pykhalov
920c9d2ed4
Apply notgne2 suggestions. 2021-04-16 12:38:37 +03:00
Oleg Pykhalov
6093dc02e9
flake: Add optional dryActivate argument to activate.custom 2021-04-07 19:40:17 +03:00
Oleg Pykhalov
46ac71aa24
Add dry activate argument. 2021-04-07 19:40:15 +03:00
notgne2
64f84aaf87
Work around NixOS/nixpkgs#73404 by cd-ing into /tmp during NixOS activation 2021-02-08 15:28:31 -07:00
notgne2
dac53d9c9a
Add Nix-flake check for checking build and Rust tests 2021-01-26 04:51:08 -07:00
notgne2
501bfa6b72
Run set -euo pipefail in generated activation scripts 2021-01-22 16:30:24 -07:00
notgne2
330a73e329
Check if systemd-boot is enabled before attempting to delete default entry line 2021-01-08 14:54:00 -07:00
notgne2
1021191b90
Use boot path from configuration and ignore failures when updating loader conf 2021-01-06 22:07:02 -07:00
notgne2
a9a5c4bd1e
Automatically filter out default line from loader.conf after NixOS activation 2021-01-05 16:44:00 -07:00
Andreas Fuchs
4ed33219a9 Build "activate" binary on all platforms
Now that activate uses a cross-platform fs notification library, we
can build it on Darwin again (and build its deps separately, speeding
up recompiles there).
2020-12-15 13:00:01 -07:00
Andreas Fuchs
05d21e0b66 Add SPDX-FileCopyrightText to the three files that I changed substantially 2020-12-02 10:24:23 -07:00
Alexander Bantyev
2d0ad40c64 activate flake check: confirm that activate-rs exists in the profile 2020-12-02 10:24:23 -07:00
Andreas Fuchs
6ccc0b7ae9 Write an "activate-rs" script into the profile path
This should point to the correct path if the target platform differs
fro the deploying platform.
2020-12-02 10:24:23 -07:00
Andreas Fuchs
42cbe751a8
Fix running & building under macOS (Big Sur) (#9)
* Add xcbuild as native build input 2 ways & pass --verbose to cargo build

* Make "deploy" build on macOS

* Bump the nixpkgs version to one that ships Rust 1.47, which can
  produce binaries under macOS 11 (Big Sur).

* Use darwin-specific options that let Naersk build the "deploy"
  binary under macOS. (With a work-around for
  https://github.com/nmattia/naersk/issues/127, which prevents this
  from being much more straight-forward).

Unfortunately, the "activate" binary can't be built under macOS due to
the inotify dependency; that means the best we can do is to run the
deploy under macOS, not deploy *to* macOS.
2020-11-24 22:11:15 -07:00
notgne2
08c6bd8b73
Update activate.nixos to take a configuration, not a derivation 2020-11-22 18:12:29 -07:00
Alexander Bantyev
ef53906075 Scope activation commands, deprecate setActivate 2020-11-16 12:54:05 -07:00
Alexander Bantyev
54b6b551a1 Add activation presets for NixOS and noop activation 2020-11-16 12:54:05 -07:00
Christian Höppner
1c84cace61
fixup! [OPS-1085] Add CI 2020-11-16 11:49:00 +00:00
notgne2
a5d4390606
Format flake.nix 2020-11-14 20:06:56 -07:00
notgne2
9a9d9b5c3e
Remove deprecated checkSchema 2020-11-14 20:05:50 -07:00
Christian Höppner
f32a6f17f6 [OPS-1085] Add CI 2020-11-14 14:12:29 -07:00
notgne2
6ff3994dbb
Greatly expand documentation 2020-11-07 11:56:22 -07:00
notgne2
8e82b2a7c9
Show name of profiles missing activation 2020-10-30 19:11:16 -07:00
notgne2
0446a2f431
Add deprecation warning to checkSchema 2020-10-29 11:03:09 -07:00
notgne2
8b3b91344a
Improve checks usage, add check for activation script existing 2020-10-26 11:29:01 -07:00
notgne2
e463c62922
Move activate script location, use buildEnv for setActivate 2020-10-11 15:08:02 -07:00
notgne2
219d55e99e Minor flake and documentation fixes 2020-10-08 20:01:01 -07:00