File tree 4 files changed +56
-27
lines changed 4 files changed +56
-27
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- perSystem =
3
- {
4
- buildRustProgram ,
5
- ...
6
- } :
7
- {
8
- packages = {
9
- agent = buildRustProgram {
10
- name = "agent" ;
11
- pname = "agent" ;
12
- cargoExtraArgs = "-p agent" ;
13
- } ;
14
- } ;
15
- } ;
2
+ config ,
3
+ withSystem ,
4
+ lib ,
5
+ ...
6
+ } :
7
+ {
8
+
9
+ flake . packages =
10
+ # macos is not supported with the agent
11
+ lib . genAttrs ( builtins . filter ( system : ! lib . hasSuffix "darwin" system ) config . systems )
12
+
13
+ (
14
+ system :
15
+ withSystem system (
16
+ { buildRustProgram , ... } :
17
+ {
18
+ agent = buildRustProgram {
19
+ name = "agent" ;
20
+ pname = "agent" ;
21
+ cargoExtraArgs = "-p agent" ;
22
+ } ;
23
+ }
24
+ )
25
+ ) ;
16
26
}
Original file line number Diff line number Diff line change
1
+ { self , ... } :
1
2
{
2
3
perSystem =
3
4
{
4
5
pkgs ,
6
+ lib ,
5
7
self' ,
6
8
buildRustProgram ,
7
9
...
29
31
nativeBuildInputs = [
30
32
pkgs . makeWrapper
31
33
] ;
32
- postBuild = ''
33
- wrapProgram $out/bin/wire \
34
- --set WIRE_RUNTIME ${ ../../runtime } \
35
- --set WIRE_AGENT ${ self' . packages . agent }
36
- '' ;
34
+ postBuild =
35
+ let
36
+ agents = lib . mapAttrsToList ( name : value : {
37
+ inherit name ;
38
+ path = value . agent ;
39
+ } ) ( lib . filterAttrs ( _ : value : value ? agent ) self . packages ) ;
40
+
41
+ in
42
+ ''
43
+ wrapProgram $out/bin/wire \
44
+ --set WIRE_RUNTIME ${ ../../runtime } \
45
+ --set WIRE_AGENT ${ pkgs . linkFarm "wire-agents-farm" agents }
46
+ '' ;
37
47
meta . mainProgram = "wire" ;
38
48
} ;
39
49
} ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use prost::Message;
4
4
use serde:: { Deserialize , Serialize } ;
5
5
use std:: env;
6
6
use std:: fmt:: Display ;
7
+ use std:: path:: Path ;
7
8
use std:: pin:: Pin ;
8
9
use std:: process:: { ExitStatus , Stdio } ;
9
10
use std:: str:: from_utf8;
@@ -284,14 +285,22 @@ impl ExecuteStep for PushAgentStep {
284
285
}
285
286
286
287
async fn execute ( & self , ctx : & mut Context < ' _ > ) -> Result < ( ) , HiveLibError > {
287
- let agent_directory = match env:: var_os ( "WIRE_AGENT" ) {
288
- Some ( agent) => agent. into_string ( ) . unwrap ( ) ,
289
- None => panic ! ( "WIRE_AGENT environment variable not set" ) ,
290
- } ;
288
+ let mut agent_directory = PathBuf :: from (
289
+ env:: var_os ( "WIRE_AGENT" )
290
+ . expect ( "WIRE_AGENT environment variable not set!" )
291
+ . into_string ( )
292
+ . unwrap ( ) ,
293
+ ) ;
294
+
295
+ agent_directory. push ( ctx. node . system . as_str ( ) ) ;
296
+
297
+ let path = String :: from ( agent_directory. to_str ( ) . unwrap ( ) ) ;
298
+
299
+ debug ! ( "agent path: {path}" ) ;
291
300
292
- push ( ctx. node , ctx. name , Push :: Path ( & agent_directory ) ) . await ?;
301
+ push ( ctx. node , ctx. name , Push :: Path ( & path ) ) . await ?;
293
302
294
- ctx. state . agent_directory = Some ( agent_directory ) ;
303
+ ctx. state . agent_directory = Some ( path ) ;
295
304
296
305
Ok ( ( ) )
297
306
}
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ pub struct Node {
62
62
#[ serde( ) ]
63
63
// system is the architecture of the host, this is mainly used for
64
64
// determining the correct binary to push to the host's machine.
65
- pub system : Option < String > ,
65
+ pub system : String ,
66
66
}
67
67
68
68
#[ cfg( test) ]
@@ -74,7 +74,7 @@ impl Default for Node {
74
74
tags : im:: HashSet :: new ( ) ,
75
75
allow_local_deployment : true ,
76
76
build_remotely : false ,
77
- system : None ,
77
+ system : String :: from ( "x86_64-linux" ) ,
78
78
}
79
79
}
80
80
}
You can’t perform that action at this time.
0 commit comments