From f8a6a2854046d9316471faa51e893d90ac927ed6 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Tue, 9 Jul 2024 11:36:13 +0000 Subject: [PATCH] fix issue with nix trusted users on macos --- Cargo.lock | 14 +++++++------- crates/cli/Cargo.toml | 10 +++++----- crates/common/Cargo.toml | 6 +++--- crates/core/Cargo.toml | 4 ++-- crates/ext/Cargo.toml | 2 +- crates/ext/src/devenv.rs | 14 ++++++++++++-- crates/ext/src/flox.rs | 16 +++++++++++++--- crates/graphql/Cargo.toml | 8 ++++---- crates/server/Cargo.toml | 8 ++++---- crates/shared/Cargo.toml | 8 ++++---- 10 files changed, 55 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e059fb8..6958ef4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2093,7 +2093,7 @@ dependencies = [ [[package]] name = "fluentci-common" -version = "0.2.0" +version = "0.2.1" dependencies = [ "anyhow", "dirs 5.0.1", @@ -2108,7 +2108,7 @@ dependencies = [ [[package]] name = "fluentci-core" -version = "0.3.0" +version = "0.3.1" dependencies = [ "anyhow", "chrono", @@ -2133,7 +2133,7 @@ dependencies = [ [[package]] name = "fluentci-engine" -version = "0.4.2" +version = "0.4.3" dependencies = [ "anyhow", "clap", @@ -2151,7 +2151,7 @@ dependencies = [ [[package]] name = "fluentci-ext" -version = "0.2.0" +version = "0.2.1" dependencies = [ "anyhow", "async-trait", @@ -2174,7 +2174,7 @@ dependencies = [ [[package]] name = "fluentci-graphql" -version = "0.3.0" +version = "0.3.1" dependencies = [ "anyhow", "async-graphql", @@ -2248,7 +2248,7 @@ dependencies = [ [[package]] name = "fluentci-server" -version = "0.3.0" +version = "0.3.1" dependencies = [ "actix-cors", "actix-web", @@ -2265,7 +2265,7 @@ dependencies = [ [[package]] name = "fluentci-shared" -version = "0.2.0" +version = "0.2.1" dependencies = [ "anyhow", "extism", diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 05fffd3..c6b4719 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -8,7 +8,7 @@ license = "MPL-2.0" name = "fluentci-engine" readme = "../../README.md" repository = "https://github.com/fluentci-io/fluentci-engine" -version = "0.4.2" +version = "0.4.3" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -16,10 +16,10 @@ version = "0.4.2" anyhow = "1.0.81" clap = "3.2.20" extism = "1.2.0" -fluentci-core = {path = "../core", version = "0.3.0"} -fluentci-ext = {path = "../ext", version = "0.2.0"} -fluentci-server = {path = "../server", version = "0.3.0"} -fluentci-shared = {path = "../shared", version = "0.2.0"} +fluentci-core = {path = "../core", version = "0.3.1"} +fluentci-ext = {path = "../ext", version = "0.2.1"} +fluentci-server = {path = "../server", version = "0.3.1"} +fluentci-shared = {path = "../shared", version = "0.2.1"} get-port = "4.0.0" md5 = "0.7.0" regex = "1.10.3" diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml index 2ec3b11..846fd46 100644 --- a/crates/common/Cargo.toml +++ b/crates/common/Cargo.toml @@ -7,15 +7,15 @@ keywords = ["nix", "environment", "ci", "wasm", "devops"] license = "MPL-2.0" name = "fluentci-common" repository = "https://github.com/fluentci-io/fluentci-engine" -version = "0.2.0" +version = "0.2.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] anyhow = "1.0.81" dirs = "5.0.1" -fluentci-core = {path = "../core", version = "0.3.0"} -fluentci-ext = {path = "../ext", version = "0.2.0"} +fluentci-core = {path = "../core", version = "0.3.1"} +fluentci-ext = {path = "../ext", version = "0.2.1"} fluentci-secrets = {path = "../secrets", version = "0.1.0"} fluentci-types = {path = "../types", version = "0.1.7"} regex = "1.10.4" diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index e7bc608..be1ed6e 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["nix", "environment", "ci", "wasm", "devops"] license = "MPL-2.0" name = "fluentci-core" repository = "https://github.com/fluentci-io/fluentci-engine" -version = "0.3.0" +version = "0.3.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -15,7 +15,7 @@ version = "0.3.0" anyhow = "1.0.81" chrono = "0.4.35" dirs = "5.0.1" -fluentci-ext = {path = "../ext", version = "0.2.0"} +fluentci-ext = {path = "../ext", version = "0.2.1"} fluentci-logging = {path = "../logging", version = "0.1.0"} fluentci-secrets = {path = "../secrets", version = "0.1.0"} fluentci-types = {path = "../types", version = "0.1.7"} diff --git a/crates/ext/Cargo.toml b/crates/ext/Cargo.toml index e3b1e59..e21b558 100644 --- a/crates/ext/Cargo.toml +++ b/crates/ext/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["nix", "environment", "ci", "wasm", "devops"] license = "MPL-2.0" name = "fluentci-ext" repository = "https://github.com/fluentci-io/fluentci-engine" -version = "0.2.0" +version = "0.2.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/ext/src/devenv.rs b/crates/ext/src/devenv.rs index dc2ed9c..007a7d0 100644 --- a/crates/ext/src/devenv.rs +++ b/crates/ext/src/devenv.rs @@ -1,4 +1,5 @@ use std::{ + env::consts::OS, process::{Command, ExitStatus, Stdio}, sync::mpsc::Sender, }; @@ -67,12 +68,21 @@ impl Extension for Devenv { "echo \"trusted-users = root $USER\" | {} tee -a /etc/nix/nix.conf", sudo )) + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) .spawn()? .wait()?; + let sudo = if OS == "macos" { "sudo" } else { "" }; + Command::new("sh") .arg("-c") - .arg("nix profile install --accept-flake-config github:cachix/cachix") + .arg(&format!( + "{} nix profile install --accept-flake-config github:cachix/cachix", + sudo, + )) + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) .spawn()? .wait()?; @@ -84,7 +94,7 @@ impl Extension for Devenv { Command::new("sh") .arg("-c") - .arg("nix profile install --accept-flake-config tarball+https://install.devenv.sh/latest") + .arg(&format!("{} nix profile install --accept-flake-config tarball+https://install.devenv.sh/latest",sudo )) .spawn()? .wait()?; diff --git a/crates/ext/src/flox.rs b/crates/ext/src/flox.rs index 4a85a52..1e4377e 100644 --- a/crates/ext/src/flox.rs +++ b/crates/ext/src/flox.rs @@ -1,4 +1,5 @@ use std::{ + env::consts::OS, process::{Command, ExitStatus, Stdio}, sync::mpsc::Sender, }; @@ -65,23 +66,32 @@ impl Extension for Flox { "echo \"trusted-users = root $USER\" | {} tee -a /etc/nix/nix.conf", sudo )) + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) .spawn()? .wait()?; + let sudo = if OS == "macos" { "sudo" } else { "" }; + Command::new("sh") .arg("-c") .arg(&format!("echo 'extra-trusted-substituters = https://cache.floxdev.com' | {} tee -a /etc/nix/nix.conf && echo 'extra-trusted-public-keys = flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs=' | {} tee -a /etc/nix/nix.conf", sudo, sudo)) + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) .spawn()? .wait()?; Command::new("sh") .arg("-c") - .arg( - "nix profile install --impure \ + .arg(&format!( + "{} nix profile install --impure \ --experimental-features 'nix-command flakes' \ --accept-flake-config \ github:flox/flox", - ) + sudo + )) + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) .spawn()? .wait()?; diff --git a/crates/graphql/Cargo.toml b/crates/graphql/Cargo.toml index 17cdae2..3f99c7c 100644 --- a/crates/graphql/Cargo.toml +++ b/crates/graphql/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["nix", "environment", "ci", "wasm", "devops"] license = "MPL-2.0" name = "fluentci-graphql" repository = "https://github.com/fluentci-io/fluentci-engine" -version = "0.3.0" +version = "0.3.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -16,9 +16,9 @@ anyhow = "1.0.80" async-graphql = "7.0.2" async-graphql-actix-web = "7.0.2" dirs = "5.0.1" -fluentci-common = {path = "../common", version = "0.2.0"} -fluentci-core = {path = "../core", version = "0.3.0"} -fluentci-ext = {path = "../ext", version = "0.2.0"} +fluentci-common = {path = "../common", version = "0.2.1"} +fluentci-core = {path = "../core", version = "0.3.1"} +fluentci-ext = {path = "../ext", version = "0.2.1"} fluentci-secrets = {path = "../secrets", version = "0.1.0"} fluentci-types = {path = "../types", version = "0.1.7"} regex = "1.10.3" diff --git a/crates/server/Cargo.toml b/crates/server/Cargo.toml index 7f5327d..f5d7d6f 100644 --- a/crates/server/Cargo.toml +++ b/crates/server/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["nix", "environment", "ci", "wasm", "devops"] license = "MPL-2.0" name = "fluentci-server" repository = "https://github.com/fluentci-io/fluentci-engine" -version = "0.3.0" +version = "0.3.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -17,9 +17,9 @@ actix-web = "4.5.1" anyhow = "1.0.81" async-graphql = "7.0.2" async-graphql-actix-web = "7.0.2" -fluentci-core = {path = "../core", version = "0.3.0"} -fluentci-ext = {path = "../ext", version = "0.2.0"} -fluentci-graphql = {path = "../graphql", version = "0.3.0"} +fluentci-core = {path = "../core", version = "0.3.1"} +fluentci-ext = {path = "../ext", version = "0.2.1"} +fluentci-graphql = {path = "../graphql", version = "0.3.1"} mime_guess = "2.0.4" owo-colors = "4.0.0" tokio = "1.36.0" diff --git a/crates/shared/Cargo.toml b/crates/shared/Cargo.toml index cd89e76..44478de 100644 --- a/crates/shared/Cargo.toml +++ b/crates/shared/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["nix", "environment", "ci", "wasm", "devops"] license = "MPL-2.0" name = "fluentci-shared" repository = "https://github.com/fluentci-io/fluentci-engine" -version = "0.2.0" +version = "0.2.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -15,9 +15,9 @@ version = "0.2.0" anyhow = "1.0.82" extism = "1.2.0" extism-pdk = "1.1.0" -fluentci-common = {path = "../common", version = "0.2.0"} -fluentci-core = {path = "../core", version = "0.3.0"} -fluentci-ext = {path = "../ext", version = "0.2.0"} +fluentci-common = {path = "../common", version = "0.2.1"} +fluentci-core = {path = "../core", version = "0.3.1"} +fluentci-ext = {path = "../ext", version = "0.2.1"} fluentci-secrets = {path = "../secrets", version = "0.1.0"} fluentci-types = {path = "../types", version = "0.1.7"} serde = {version = "1.0.197", features = ["serde_derive", "derive"]}