Skip to content

update flake and rust dependencies #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,037 changes: 648 additions & 389 deletions Cargo.lock

Large diffs are not rendered by default.

27 changes: 11 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,23 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { version = "3.0.0-beta.2", features = [ "wrap_help" ] }
dirs = "5.0.1"
clap = { version = "4", features = [ "wrap_help", "derive" ] }
dirs = "6"
flexi_logger = "0.16"
fork = "0.1"
futures-util = "0.3.6"
fork = "0.2"
futures-util = "0.3.31"
log = "0.4"
merge = "0.1.0"
notify = "5.1.0"
notify = "8.0"
rnix = "0.8"
serde = { version = "1.0.104", features = [ "derive" ] }
serde_json = "1.0.48"
serde = { version = "1.0.219", features = [ "derive" ] }
serde_json = "1.0.140"
signal-hook = "0.3"
thiserror = "1.0"
tokio = { version = "1.9.0", features = [ "process", "macros", "sync", "rt-multi-thread", "fs", "time", "io-util" ] }
toml = "0.5"
whoami = "0.9.0"
thiserror = "2.0"
tokio = { version = "1.44.0", features = [ "process", "macros", "sync", "rt-multi-thread", "fs", "time", "io-util" ] }
toml = "0.8"
whoami = "1.6"
yn = "0.1"

# smol_str is required by rnix, but 0.1.17 doesn't build on rustc
# 1.45.2 (shipped in nixos-20.09); it requires rustc 1.46.0. See
# <https://github.com/serokell/deploy-rs/issues/27>:
smol_str = "=0.1.16"
rpassword = "7.3.1"


Expand Down
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
outputs = { self, nixpkgs, utils, ... }@inputs:
rec {
overlay = final: prev: let
system = final.stdenv.hostPlatform.system;
darwinOptions = final.lib.optionalAttrs final.stdenv.isDarwin {
buildInputs = with final.darwin.apple_sdk.frameworks; [
SystemConfiguration
Expand Down Expand Up @@ -166,22 +165,20 @@
};
in
{
defaultPackage = self.packages."${system}".deploy-rs;
packages.default = self.packages."${system}".deploy-rs;
packages.deploy-rs = pkgs.deploy-rs.deploy-rs;

defaultApp = self.apps."${system}".deploy-rs;
apps.default = self.apps."${system}".deploy-rs;
apps.deploy-rs = {
type = "app";
program = "${self.packages."${system}".default}/bin/deploy";
};

devShell = pkgs.mkShell {
devShells.default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.deploy-rs ];
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
buildInputs = with pkgs; [
nixUnstable
nix
cargo
rustc
rust-analyzer
Expand Down
4 changes: 2 additions & 2 deletions nix/tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

{ pkgs , inputs , ... }:
let
inherit (pkgs) system lib;
inherit (pkgs) lib;

inherit (import "${pkgs.path}/nixos/tests/ssh-keys.nix" pkgs) snakeOilPrivateKey;

# Include all build dependencies to be able to build profiles offline
allDrvOutputs = pkg: pkgs.runCommand "allDrvOutputs" { refs = pkgs.writeReferencesToFile pkg.drvPath; } ''
allDrvOutputs = pkg: pkgs.runCommand "allDrvOutputs" { refs = pkgs.writeClosure pkg.drvPath; } ''
touch $out
while read ref; do
case $ref in
Expand Down
52 changes: 26 additions & 26 deletions src/bin/activate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use signal_hook::{consts::signal::SIGHUP, iterator::Signals};

use clap::Clap;
use clap::Parser;

use tokio::fs;
use tokio::process::Command;
Expand All @@ -25,99 +25,99 @@ use thiserror::Error;
use log::{debug, error, info, warn};

/// Remote activation utility for deploy-rs
#[derive(Clap, Debug)]
#[clap(version = "1.0", author = "Serokell <https://serokell.io/>")]
#[derive(Parser, Debug)]
#[command(version = "1.0", author = "Serokell <https://serokell.io/>")]
struct Opts {
/// Print debug logs to output
#[clap(short, long)]
#[arg(short, long)]
debug_logs: bool,
/// Directory to print logs to
#[clap(long)]
#[arg(long)]
log_dir: Option<String>,

#[clap(subcommand)]
#[command(subcommand)]
subcmd: SubCommand,
}

#[derive(Clap, Debug)]
#[derive(Parser, Debug)]
enum SubCommand {
Activate(ActivateOpts),
Wait(WaitOpts),
Revoke(RevokeOpts),
}

/// Activate a profile
#[derive(Clap, Debug)]
#[clap(group(
#[derive(Parser, Debug)]
#[command(group(
clap::ArgGroup::new("profile")
.required(true)
.multiple(false)
.args(&["profile-path","profile-user"])
.args(&["profile_path","profile_user"])
))]
struct ActivateOpts {
/// The closure to activate
closure: String,
/// The profile path to install into
#[clap(long)]
#[arg(long)]
profile_path: Option<String>,
/// The profile user if explicit profile path is not specified
#[clap(long, requires = "profile-name")]
#[arg(long, requires = "profile_name")]
profile_user: Option<String>,
/// The profile name
#[clap(long, requires = "profile-user")]
#[arg(long, requires = "profile_user")]
profile_name: Option<String>,

/// Maximum time to wait for confirmation after activation
#[clap(long)]
#[arg(long)]
confirm_timeout: u16,

/// Wait for confirmation after deployment and rollback if not confirmed
#[clap(long)]
#[arg(long)]
magic_rollback: bool,

/// Auto rollback if failure
#[clap(long)]
#[arg(long)]
auto_rollback: bool,

/// Show what will be activated on the machines
#[clap(long)]
#[arg(long)]
dry_activate: bool,

/// Don't activate, but update the boot loader to boot into the new profile
#[clap(long)]
#[arg(long)]
boot: bool,

/// Path for any temporary files that may be needed during activation
#[clap(long)]
#[arg(long)]
temp_path: PathBuf,
}

/// Wait for profile activation
#[derive(Clap, Debug)]
#[derive(Parser, Debug)]
struct WaitOpts {
/// The closure to wait for
closure: String,

/// Path for any temporary files that may be needed during activation
#[clap(long)]
#[arg(long)]
temp_path: PathBuf,

/// Timeout to wait for activation
#[clap(long)]
#[arg(long)]
activation_timeout: Option<u16>,
}

/// Revoke profile activation
#[derive(Clap, Debug)]
#[derive(Parser, Debug)]
struct RevokeOpts {
/// The profile path to install into
#[clap(long)]
#[arg(long)]
profile_path: Option<String>,
/// The profile user if explicit profile path is not specified
#[clap(long, requires = "profile-name")]
#[arg(long, requires = "profile_name")]
profile_user: Option<String>,
/// The profile name
#[clap(long, requires = "profile-user")]
#[arg(long, requires = "profile_user")]
profile_name: Option<String>,
}

Expand Down
Loading