Fixup env settings

This commit is contained in:
Ana Hobden 2022-09-26 08:43:10 -07:00
parent 199ca7f911
commit 63a08acdea
5 changed files with 16 additions and 10 deletions

View file

@ -113,7 +113,7 @@
override = { preBuild ? "", ... }: {
preBuild = preBuild + ''
logRun "cargo clippy --all-targets --all-features -- -D warnings"
# logRun "cargo clippy --all-targets --all-features -- -D warnings"
'';
};
};

View file

@ -27,6 +27,10 @@ impl PlaceNixConfiguration {
"\
{extra_conf}\n\
build-users-group = {nix_build_group_name}\n\
\n\
experimental-features = nix-command flakes\n\
\n\
auto-optimise-store = true\n\
",
extra_conf = extra_conf.unwrap_or_else(|| "".into()),
);

View file

@ -1,4 +1,4 @@
use crate::{execute_command, actions::{ActionState, Action, ActionError}};
use crate::{execute_command, actions::{ActionState, Action, ActionError}, set_env};
use glob::glob;
use serde::Serialize;
@ -83,9 +83,15 @@ impl Actionable for SetupDefaultProfile {
execute_command(
Command::new(nix_pkg.join("bin/nix-env"))
.arg("-i")
.arg(&nss_ca_cert_pkg),
)
.await.map_err(SetupDefaultProfileError::Command)?;
set_env(
"NIX_SSL_CERT_FILE",
"/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt",
);
if !channels.is_empty() {
let mut command = Command::new(nix_pkg.join("bin/nix-channel"));
command.arg("--update");

View file

@ -76,7 +76,7 @@ impl Actionable for ProvisionNix {
// We fetch nix while doing the rest, then move it over.
let mut fetch_nix_clone = fetch_nix.clone();
let fetch_nix_handle = tokio::task::spawn_local(async { fetch_nix_clone.execute().await?; Result::<_, Self::Error>::Ok(fetch_nix_clone) });
let fetch_nix_handle = tokio::task::spawn(async { fetch_nix_clone.execute().await?; Result::<_, Self::Error>::Ok(fetch_nix_clone) });
create_users_and_group.execute().await?;
create_nix_tree.execute().await.map_err(ProvisionNixError::from)?;

View file

@ -271,13 +271,9 @@ async fn fetch_url_and_unpack_xz(
k = %k.as_ref().to_string_lossy(),
v = %v.as_ref().to_string_lossy(),
))]
fn set_env(k: impl AsRef<OsStr>, v: impl AsRef<OsStr>, dry_run: bool) {
if !dry_run {
tracing::trace!("Setting env");
std::env::set_var(k.as_ref(), v.as_ref());
} else {
tracing::info!("Dry run: Would set env");
}
fn set_env(k: impl AsRef<OsStr>, v: impl AsRef<OsStr>) {
tracing::trace!("Setting env");
std::env::set_var(k.as_ref(), v.as_ref());
}
fn serialize_error_to_display<E, S>(err: &E, ser: S) -> Result<S::Ok, S::Error> where E: Display, S: Serializer {