Skip to content

Commit

Permalink
Merge pull request #29 from fluentci-io/fix/nix-trusted-users
Browse files Browse the repository at this point in the history
fix issue with nix trusted users on macos
  • Loading branch information
tsirysndr authored Jul 9, 2024
2 parents 1ad35ba + f8a6a28 commit e891606
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 35 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ 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

[dependencies]
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"
Expand Down
6 changes: 3 additions & 3 deletions crates/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ 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

[dependencies]
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"}
Expand Down
2 changes: 1 addition & 1 deletion crates/ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 12 additions & 2 deletions crates/ext/src/devenv.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{
env::consts::OS,
process::{Command, ExitStatus, Stdio},
sync::mpsc::Sender,
};
Expand Down Expand Up @@ -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()?;

Expand All @@ -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()?;

Expand Down
16 changes: 13 additions & 3 deletions crates/ext/src/flox.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{
env::consts::OS,
process::{Command, ExitStatus, Stdio},
sync::mpsc::Sender,
};
Expand Down Expand Up @@ -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()?;

Expand Down
8 changes: 4 additions & 4 deletions crates/graphql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions crates/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"
8 changes: 4 additions & 4 deletions crates/shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ 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

[dependencies]
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"]}
Expand Down

0 comments on commit e891606

Please sign in to comment.