git.delta.rocks / jrsonnet / refs/commits / 1d31a621fa6f

difftreelog

feat(build-systems) builders/jobs/fail_fast args

Yaroslav Bolyukin2020-12-02parent: #af40576.patch.diff
in: trunk

1 file changed

modifiedsrc/cmds/build_systems.rsdiffbeforeafterboth
17 /// Host, which should be threaten as localhost17 /// Host, which should be threaten as localhost
18 #[clap(long, env = "FLEET_LOCALHOST")]18 #[clap(long, env = "FLEET_LOCALHOST")]
19 localhost: Option<String>,19 localhost: Option<String>,
20 /// --builders arg for nix
21 #[clap(long)]
22 builders: Option<String>,
23 /// Jobs to run locally
24 #[clap(long)]
25 jobs: Option<usize>,
26 /// Do not continue on error
27 #[clap(long)]
28 fail_fast: bool,
20 #[clap(subcommand)]29 #[clap(subcommand)]
21 subcommand: Option<Subcommand>,30 subcommand: Option<Subcommand>,
22}31}
61 dir.path().to_owned()70 dir.path().to_owned()
62 };71 };
6372
64 Command::new("nix")73 let mut nix_build = Command::new("nix");
74 nix_build
65 .args(&["build", "--impure", "--no-link", "--out-link"])75 .args(&["build", "--impure", "--no-link", "--out-link"])
66 .arg(&built)76 .arg(&built)
67 .arg(format!(77 .arg(format!(
68 "{}.{}.config.system.build.toplevel",78 "{}.{}.config.system.build.toplevel",
69 SYSTEMS_ATTRIBUTE, host,79 SYSTEMS_ATTRIBUTE, host,
70 ))80 ))
71 .env("SECRET_DATA", data.clone())81 .env("SECRET_DATA", data.clone());
82
83 if let Some(builders) = &self.builders {
84 println!("Using builders: {}", builders);
85 nix_build.arg("--builders").arg(builders);
86 }
87 if let Some(jobs) = &self.jobs {
88 nix_build.arg("--jobs");
89 nix_build.arg(format!("{}", jobs));
90 }
91 if !self.fail_fast {
92 nix_build.arg("--keep-going");
93 }
94
72 .inherit_stdio()95 nix_build.inherit_stdio().run()?;
73 .run()?;
74 let built = std::fs::canonicalize(built)?;96 let built = std::fs::canonicalize(built)?;
75 info!("Built closure: {:?}", built);97 info!("Built closure: {:?}", built);
86 if subcommand.should_switch_profile() {108 if subcommand.should_switch_profile() {
87 info!("Switching generation");109 info!("Switching generation");
88 if !is_local {110 if !is_local {
89 Command::ssh_on(host, "nix-env")111 Command::ssh_on(host, "sudo")
90 } else {112 } else {
91 Command::new("nix-env")113 Command::new("sudo")
92 }114 }
93 .args(&["-p", "/nix/var/nix/profiles/system", "--set"])115 .args(&["nix-env", "-p", "/nix/var/nix/profiles/system", "--set"])
94 .arg(&built)116 .arg(&built)
95 .inherit_stdio()117 .inherit_stdio()
96 .run()?;118 .run()?;