ALPHA: wire is a tool to deploy nixos systems wire.althaea.zone/
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

at trunk 72 lines 1.8 kB view raw
1// SPDX-License-Identifier: AGPL-3.0-or-later 2// Copyright 2024-2025 wire Contributors 3 4use std::fmt::Display; 5 6use tracing::instrument; 7 8use crate::{ 9 HiveLibError, 10 commands::common::push, 11 hive::node::{Context, ExecuteStep, SharedTarget}, 12}; 13 14#[derive(Debug)] 15#[cfg_attr(test, derive(PartialEq))] 16pub struct PushEvaluatedOutput { 17 pub substitute_on_destination: bool, 18 pub target: SharedTarget, 19} 20 21#[derive(Debug)] 22#[cfg_attr(test, derive(PartialEq))] 23pub struct PushBuildOutput { 24 pub substitute_on_destination: bool, 25 pub target: SharedTarget, 26} 27 28impl Display for PushEvaluatedOutput { 29 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 30 write!(f, "Push the evaluated output") 31 } 32} 33 34impl Display for PushBuildOutput { 35 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 36 write!(f, "Push the build output") 37 } 38} 39 40impl ExecuteStep for PushEvaluatedOutput { 41 #[instrument(skip_all, name = "push_eval")] 42 async fn execute(&self, ctx: &mut Context) -> Result<(), HiveLibError> { 43 let top_level = ctx.state.evaluation.as_ref().unwrap(); 44 45 push( 46 ctx, 47 &self.target, 48 crate::hive::node::Push::Derivation(top_level), 49 self.substitute_on_destination, 50 ) 51 .await?; 52 53 Ok(()) 54 } 55} 56 57impl ExecuteStep for PushBuildOutput { 58 #[instrument(skip_all, name = "push_build")] 59 async fn execute(&self, ctx: &mut Context) -> Result<(), HiveLibError> { 60 let built_path = ctx.state.build.as_ref().unwrap(); 61 62 push( 63 ctx, 64 &self.target, 65 crate::hive::node::Push::Path(built_path), 66 self.substitute_on_destination, 67 ) 68 .await?; 69 70 Ok(()) 71 } 72}