Skip to content

Commit ea722ee

Browse files
grahamccole-h
andauthored
Write user config to nix.custom.conf, defer nix.conf to determinate when using determinate (#1379)
* Delete the determinate-specific config generation, and leave it up to determinate-nixd init * Write out the default config options to nix.conf, and the custom nix.conf settings to nix.custom.conf, which are included by nix.conf. * optional standard nix config * derp tests * Apply suggestions from code review Co-authored-by: Cole Helbling <cole.helbling@determinate.systems> * flake.lock: Add Flake lock file updates: • Added input 'crane': 'github:ipetkov/crane/72e2d02dbac80c8c86bf6bf3e785536acf8ee926?narHash=sha256-3aH/0Y6ajIlfy7j52FGZ%2Bs4icVX0oHhqBzRdlOeztqg%3D' (2024-12-21) • Added input 'determinate': 'https://api.flakehub.com/f/pinned/DeterminateSystems/determinate/0.1.165%2Brev-657395244a854da1bc71e38454958ecd57c0e241/0193b781-6c27-7703-bca6-fc9648fca81d/source.tar.gz?narHash=sha256-nUTutqzg/Z0eEXrC1ACTa4a9Ik5Iyxgqo8uL9DYib7I%3D' (2024-12-11) • Added input 'determinate/determinate-nixd-aarch64-darwin': 'https://install.determinate.systems/determinate-nixd/rev/0de4fff87b3bbf09c3e510c4a57eb014f98ab247/macOS?narHash=sha256-QF2Zi8Avz39kbh9iZMZoKiZLU5pdTPlicYE21291QSY%3D' • Added input 'determinate/determinate-nixd-aarch64-linux': 'https://install.determinate.systems/determinate-nixd/rev/0de4fff87b3bbf09c3e510c4a57eb014f98ab247/aarch64-linux?narHash=sha256-brFdvFUU9BLrwwDuwi841peDI/kwN1tzi9RZEIdPM%2B0%3D' • Added input 'determinate/determinate-nixd-x86_64-darwin': follows '' • Added input 'determinate/determinate-nixd-x86_64-linux': 'https://install.determinate.systems/determinate-nixd/rev/0de4fff87b3bbf09c3e510c4a57eb014f98ab247/x86_64-linux?narHash=sha256-WapB5UqrZpK32/TrUltUhE9Rp%2BwYAQj/0asXtL0OUSY%3D' • Added input 'determinate/nix': follows 'nix' • Added input 'determinate/nixpkgs': follows 'nixpkgs' • Added input 'flake-compat': 'https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz?narHash=sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U%3D' (2023-10-04) • Added input 'nix': 'https://api.flakehub.com/f/pinned/DeterminateSystems/nix/2.25.3/01939864-5191-788c-b898-163d916a3333/source.tar.gz?narHash=sha256-rOFE8TSwWoup%2BLPNbmtTs6oLy7lYZ12L9GN%2BaZuQQaA%3D' (2024-12-03) • Added input 'nix/nix': 'https://api.flakehub.com/f/pinned/NixOS/nix/2.25.3/01938786-bc70-79e3-b7ee-bb61f8e7f238/source.tar.gz?narHash=sha256-T%2BwFMm3cj8pGJSwXmPuxG5pz%2B1gRDJoToF9OBxtzocA%3D' (2024-11-29) • Added input 'nix/nix/flake-compat': 'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33?narHash=sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U%3D' (2023-10-04) • Added input 'nix/nix/flake-parts': 'github:hercules-ci/flake-parts/9227223f6d922fee3c7b190b2cc238a99527bbb7?narHash=sha256-pQMhCCHyQGRzdfAkdJ4cIWiw%2BJNuWsTX7f0ZYSyz0VY%3D' (2024-07-03) • Added input 'nix/nix/flake-parts/nixpkgs-lib': follows 'nix/nix/nixpkgs' • Added input 'nix/nix/git-hooks-nix': 'github:cachix/git-hooks.nix/f451c19376071a90d8c58ab1a953c6e9840527fd?narHash=sha256-6FPUl7HVtvRHCCBQne7Ylp4p%2BdpP3P/OYuzjztZ4s70%3D' (2024-07-15) • Added input 'nix/nix/git-hooks-nix/flake-compat': follows 'nix/nix' • Added input 'nix/nix/git-hooks-nix/gitignore': follows 'nix/nix' • Added input 'nix/nix/git-hooks-nix/nixpkgs': follows 'nix/nix/nixpkgs' • Added input 'nix/nix/git-hooks-nix/nixpkgs-stable': follows 'nix/nix/nixpkgs' • Added input 'nix/nix/libgit2': 'github:libgit2/libgit2/36f7e21ad757a3dacc58cf7944329da6bc1d6e96?narHash=sha256-J2rCxTecyLbbDdsyBWn9w7r3pbKRMkI9E7RvRgAqBdY%3D' (2024-05-16) • Added input 'nix/nix/nixpkgs': 'github:NixOS/nixpkgs/c3d4ac725177c030b1e289015989da2ad9d56af0?narHash=sha256-sqLwJcHYeWLOeP/XoLwAtYjr01TISlkOfz%2BNG82pbdg%3D' (2024-08-15) • Added input 'nix/nix/nixpkgs-23-11': 'github:NixOS/nixpkgs/a62e6edd6d5e1fa0329b8653c801147986f8d446?narHash=sha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw%3D' (2024-05-31) • Added input 'nix/nix/nixpkgs-regression': 'github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2?narHash=sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw%3D' (2022-01-24) • Added input 'nix/nixpkgs': 'https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.710194%2Brev-f9f0d5c5380be0a599b1fb54641fa99af8281539/01938be8-64ce-75c6-94d4-dbc2e4d547fe/source.tar.gz?narHash=sha256-En%2BgSoVJ3iQKPDU1FHrR6zIxSLXKjzKY%2Bpnh9tt%2BYts%3D' (2024-12-02) • Added input 'nixpkgs': 'https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.737298%2Brev-ed4a395ea001367c1f13d34b1e01aa10290f67d6/01945f5f-4175-7e72-8809-a1e482c4a443/source.tar.gz?narHash=sha256-jG/%2BMvjVY7SlTakzZ2fJ5dC3V1PrKKrUEOEE30jrOKA%3D' (2025-01-12) * Override dnixd * relock * pr 190 * flake.lock: Update Flake lock file updates: • Updated input 'determinate/determinate-nixd-aarch64-darwin': 'https://install.determinate.systems/determinate-nixd/rev/0de4fff87b3bbf09c3e510c4a57eb014f98ab247/macOS?narHash=sha256-QF2Zi8Avz39kbh9iZMZoKiZLU5pdTPlicYE21291QSY%3D' → 'https://install.determinate.systems/determinate-nixd/pr/190/macOS?narHash=sha256-KnMWMa4tBS2xl8hLhzxFDj502O9vdO94qMKcXwTRmWs%3D' • Updated input 'determinate/determinate-nixd-aarch64-linux': 'https://install.determinate.systems/determinate-nixd/rev/0de4fff87b3bbf09c3e510c4a57eb014f98ab247/aarch64-linux?narHash=sha256-brFdvFUU9BLrwwDuwi841peDI/kwN1tzi9RZEIdPM%2B0%3D' → 'https://install.determinate.systems/determinate-nixd/pr/190/aarch64-linux?narHash=sha256-KsslatIeQWAjUw5QcJbLH5kfAiyUQ5lQI/7D2tTYp7Q%3D' • Updated input 'determinate/determinate-nixd-x86_64-linux': 'https://install.determinate.systems/determinate-nixd/rev/0de4fff87b3bbf09c3e510c4a57eb014f98ab247/x86_64-linux?narHash=sha256-WapB5UqrZpK32/TrUltUhE9Rp%2BwYAQj/0asXtL0OUSY%3D' → 'https://install.determinate.systems/determinate-nixd/pr/190/x86_64-linux?narHash=sha256-nC9ITu%2BlDhNjmnIA4uQgIxNkL4j/1hbkhVoj/KBzIwY%3D' * breakpoint * cole-h * derp * drop bph * flake.lock: Update Flake lock file updates: • Updated input 'determinate/determinate-nixd-aarch64-darwin': 'https://install.determinate.systems/determinate-nixd/pr/190/macOS?narHash=sha256-KnMWMa4tBS2xl8hLhzxFDj502O9vdO94qMKcXwTRmWs%3D' → 'https://install.determinate.systems/determinate-nixd/pr/190/macOS?narHash=sha256-fUzQzO1z3HyWyVWQeL/beHbVFf%2BKldW0xLXqyM3vwWA%3D' • Updated input 'determinate/determinate-nixd-aarch64-linux': 'https://install.determinate.systems/determinate-nixd/pr/190/aarch64-linux?narHash=sha256-KsslatIeQWAjUw5QcJbLH5kfAiyUQ5lQI/7D2tTYp7Q%3D' → 'https://install.determinate.systems/determinate-nixd/pr/190/aarch64-linux?narHash=sha256-TEg1lA%2BZgbjIxLaoRPEy/tWrYI317ICdXgZPFyWfgW8%3D' • Updated input 'determinate/determinate-nixd-x86_64-linux': 'https://install.determinate.systems/determinate-nixd/pr/190/x86_64-linux?narHash=sha256-nC9ITu%2BlDhNjmnIA4uQgIxNkL4j/1hbkhVoj/KBzIwY%3D' → 'https://install.determinate.systems/determinate-nixd/pr/190/x86_64-linux?narHash=sha256-rk4VkdEsVjmiomTpza4ja3WggoNkeq8eMO9RoTujzZI%3D' * bpa * flake.lock: Update Flake lock file updates: • Updated input 'determinate/determinate-nixd-aarch64-darwin': 'https://install.determinate.systems/determinate-nixd/pr/190/macOS?narHash=sha256-fUzQzO1z3HyWyVWQeL/beHbVFf%2BKldW0xLXqyM3vwWA%3D' → 'https://install.determinate.systems/determinate-nixd/pr/190/macOS?narHash=sha256-XQ/0tqIfx4tWluxDjFnknQ9OeukSaiu0GIPex/bLfRY%3D' * flake.lock: Update Flake lock file updates: • Updated input 'determinate/determinate-nixd-aarch64-darwin': 'https://install.determinate.systems/determinate-nixd/pr/190/macOS?narHash=sha256-XQ/0tqIfx4tWluxDjFnknQ9OeukSaiu0GIPex/bLfRY%3D' → 'https://install.determinate.systems/determinate-nixd/pr/190/macOS?narHash=sha256-hbYsDT0JfedS64dIRxlTfOzKqZ6St6n%2B8ekOM7kSZLs%3D' • Updated input 'determinate/determinate-nixd-aarch64-linux': 'https://install.determinate.systems/determinate-nixd/pr/190/aarch64-linux?narHash=sha256-TEg1lA%2BZgbjIxLaoRPEy/tWrYI317ICdXgZPFyWfgW8%3D' → 'https://install.determinate.systems/determinate-nixd/pr/190/aarch64-linux?narHash=sha256-qhRnkCOIl8N5gUUd5csCDSKOwEypbL0Cubg7BPQ1JNc%3D' • Updated input 'determinate/determinate-nixd-x86_64-linux': 'https://install.determinate.systems/determinate-nixd/pr/190/x86_64-linux?narHash=sha256-rk4VkdEsVjmiomTpza4ja3WggoNkeq8eMO9RoTujzZI%3D' → 'https://install.determinate.systems/determinate-nixd/pr/190/x86_64-linux?narHash=sha256-xKSPWKe/Q1yymVui/eI3SP1xl6oUBkWNFnmeSa61HiM%3D' * update comment we're not using yet * flake.lock: Update Flake lock file updates: • Updated input 'determinate/determinate-nixd-aarch64-darwin': 'https://install.determinate.systems/determinate-nixd/pr/190/macOS?narHash=sha256-hbYsDT0JfedS64dIRxlTfOzKqZ6St6n%2B8ekOM7kSZLs%3D' → 'https://install.determinate.systems/determinate-nixd/pr/190/macOS?narHash=sha256-KzLWlikcqKqgYTZqt6E71RjYc7ybREz%2BHLFNqxOjpoQ%3D' • Updated input 'determinate/determinate-nixd-aarch64-linux': 'https://install.determinate.systems/determinate-nixd/pr/190/aarch64-linux?narHash=sha256-qhRnkCOIl8N5gUUd5csCDSKOwEypbL0Cubg7BPQ1JNc%3D' → 'https://install.determinate.systems/determinate-nixd/pr/190/aarch64-linux?narHash=sha256-/EPA3KEa9uIcbHx3dIsJOOML2v6YMegb8%2B2o3MGlyTo%3D' • Updated input 'determinate/determinate-nixd-x86_64-linux': 'https://install.determinate.systems/determinate-nixd/pr/190/x86_64-linux?narHash=sha256-xKSPWKe/Q1yymVui/eI3SP1xl6oUBkWNFnmeSa61HiM%3D' → 'https://install.determinate.systems/determinate-nixd/pr/190/x86_64-linux?narHash=sha256-1deA6Rexdk7A9FlUNjLrxDeevO1RI6olIgIkPBhbryE%3D' * stop after nix configuration * Don't write the group name to nix.conf if it is the default * drop breakpoint * drop overrides * flake.lock: Update Flake lock file updates: • Updated input 'determinate': 'https://api.flakehub.com/f/pinned/DeterminateSystems/determinate/0.1.165%2Brev-657395244a854da1bc71e38454958ecd57c0e241/0193b781-6c27-7703-bca6-fc9648fca81d/source.tar.gz?narHash=sha256-nUTutqzg/Z0eEXrC1ACTa4a9Ik5Iyxgqo8uL9DYib7I%3D' (2024-12-11) → 'https://api.flakehub.com/f/pinned/DeterminateSystems/determinate/0.1.168%2Brev-29d4697d480dc9ed0e0a1d260d621ac8d4b7fa41/019461c4-62df-70e8-9684-46317d87e052/source.tar.gz?narHash=sha256-guIdbsg1LBURqqoeHYIkU4ECPvYjXX2NI%2BgGeJTR9us%3D' (2025-01-13) • Updated input 'determinate/determinate-nixd-aarch64-darwin': 'https://install.determinate.systems/determinate-nixd/pr/190/macOS?narHash=sha256-KzLWlikcqKqgYTZqt6E71RjYc7ybREz%2BHLFNqxOjpoQ%3D' → 'https://install.determinate.systems/determinate-nixd/tag/v0.3.0/macOS?narHash=sha256-yLy38fgeC%2BorxYylwUwLUuRUdgi9WLEflLX9j9NDIUI%3D' • Updated input 'determinate/determinate-nixd-aarch64-linux': 'https://install.determinate.systems/determinate-nixd/pr/190/aarch64-linux?narHash=sha256-/EPA3KEa9uIcbHx3dIsJOOML2v6YMegb8%2B2o3MGlyTo%3D' → 'https://install.determinate.systems/determinate-nixd/tag/v0.3.0/aarch64-linux?narHash=sha256-9/HjI0v/ZLoTqOy%2B5%2BviIQh8iGjf49qMLRVthVZ3V9U%3D' • Updated input 'determinate/determinate-nixd-x86_64-linux': 'https://install.determinate.systems/determinate-nixd/pr/190/x86_64-linux?narHash=sha256-1deA6Rexdk7A9FlUNjLrxDeevO1RI6olIgIkPBhbryE%3D' → 'https://install.determinate.systems/determinate-nixd/tag/v0.3.0/x86_64-linux?narHash=sha256-cyvqGm%2BWT5l3N40wSO6FSJTm7Lxm9w1owpXjAYtGAm4%3D' --------- Co-authored-by: Cole Helbling <cole.helbling@determinate.systems>
1 parent e10f304 commit ea722ee

File tree

12 files changed

+294
-260
lines changed

12 files changed

+294
-260
lines changed

flake.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/action/base/create_or_merge_nix_config.rs

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,22 @@ impl From<CreateOrMergeNixConfigError> for ActionErrorKind {
4747
pub struct CreateOrMergeNixConfig {
4848
pub(crate) path: PathBuf,
4949
pending_nix_config: NixConfig,
50+
header: String,
5051
}
5152

5253
impl CreateOrMergeNixConfig {
5354
#[tracing::instrument(level = "debug", skip_all)]
5455
pub async fn plan(
5556
path: impl AsRef<Path>,
5657
pending_nix_config: NixConfig,
58+
header: String,
5759
) -> Result<StatefulAction<Self>, ActionError> {
5860
let path = path.as_ref().to_path_buf();
5961

6062
let this = Self {
6163
path,
6264
pending_nix_config,
65+
header,
6366
};
6467

6568
if this.path.exists() {
@@ -170,7 +173,7 @@ impl Action for CreateOrMergeNixConfig {
170173
}
171174
fn tracing_synopsis(&self) -> String {
172175
format!(
173-
"Merge or create nix.conf file `{path}`",
176+
"Merge or create Nix configuration file `{path}`",
174177
path = self.path.display(),
175178
)
176179
}
@@ -216,16 +219,11 @@ impl Action for CreateOrMergeNixConfig {
216219

217220
#[tracing::instrument(level = "debug", skip_all)]
218221
async fn execute(&mut self) -> Result<(), ActionError> {
219-
let Self {
220-
path,
221-
pending_nix_config,
222-
} = self;
223-
224222
if tracing::enabled!(tracing::Level::TRACE) {
225223
let span = tracing::Span::current();
226224
span.record(
227225
"pending_nix_config",
228-
pending_nix_config
226+
self.pending_nix_config
229227
.settings()
230228
.iter()
231229
.map(|(k, v)| format!("{k}='{v}'"))
@@ -237,7 +235,7 @@ impl Action for CreateOrMergeNixConfig {
237235
// Create a temporary file in the same directory as the one
238236
// that the final file goes in, so that we can rename it
239237
// atomically
240-
let parent_dir = path.parent().expect("File must be in a directory");
238+
let parent_dir = self.path.parent().expect("File must be in a directory");
241239
let mut temp_file_path = parent_dir.to_owned();
242240
{
243241
let mut rng = rand::thread_rng();
@@ -259,20 +257,20 @@ impl Action for CreateOrMergeNixConfig {
259257
Self::error(ActionErrorKind::Open(temp_file_path.clone(), e))
260258
})?;
261259

262-
let (mut merged_nix_config, mut existing_nix_config) = if path.exists() {
260+
let (mut merged_nix_config, mut existing_nix_config) = if self.path.exists() {
263261
let (merged_nix_config, existing_nix_config) =
264-
Self::validate_existing_nix_config(pending_nix_config, path)?;
262+
Self::validate_existing_nix_config(&self.pending_nix_config, &self.path)?;
265263
(merged_nix_config, Some(existing_nix_config))
266264
} else {
267-
(pending_nix_config.clone(), None)
265+
(self.pending_nix_config.clone(), None)
268266
};
269267

270268
let mut new_config = String::new();
271269

272270
if let Some(existing_nix_config) = existing_nix_config.as_mut() {
273-
let mut discovered_buf = tokio::fs::read_to_string(&path)
271+
let mut discovered_buf = tokio::fs::read_to_string(&self.path)
274272
.await
275-
.map_err(|e| Self::error(ActionErrorKind::Read(path.to_path_buf(), e)))?;
273+
.map_err(|e| Self::error(ActionErrorKind::Read(self.path.to_path_buf(), e)))?;
276274

277275
// We append a newline to ensure that, in the case there are comments at the end of the
278276
// file and _NO_ trailing newline, we still preserve the entire block of comments.
@@ -397,9 +395,7 @@ impl Action for CreateOrMergeNixConfig {
397395
new_config.push('\n');
398396
}
399397

400-
new_config
401-
.push_str("# Generated by https://github.com/DeterminateSystems/nix-installer.\n");
402-
new_config.push_str("# See `/nix/nix-installer --version` for the version details.\n");
398+
new_config.push_str(&self.header);
403399
new_config.push('\n');
404400

405401
for (name, value) in merged_nix_config.settings() {
@@ -418,20 +414,20 @@ impl Action for CreateOrMergeNixConfig {
418414
.map_err(|e| {
419415
Self::error(ActionErrorKind::SetPermissions(
420416
NIX_CONF_MODE,
421-
path.to_owned(),
417+
self.path.to_owned(),
422418
e,
423419
))
424420
})?;
425421
temp_file
426422
.sync_all()
427423
.await
428424
.map_err(|e| Self::error(ActionErrorKind::Sync(temp_file_path.clone(), e)))?;
429-
tokio::fs::rename(&temp_file_path, &path)
425+
tokio::fs::rename(&temp_file_path, &self.path)
430426
.await
431427
.map_err(|e| {
432428
Self::error(ActionErrorKind::Rename(
433429
temp_file_path.to_owned(),
434-
path.to_owned(),
430+
self.path.to_owned(),
435431
e,
436432
))
437433
})?;
@@ -440,27 +436,17 @@ impl Action for CreateOrMergeNixConfig {
440436
}
441437

442438
fn revert_description(&self) -> Vec<ActionDescription> {
443-
let Self {
444-
path,
445-
pending_nix_config: _,
446-
} = &self;
447-
448439
vec![ActionDescription::new(
449-
format!("Delete file `{}`", path.display()),
450-
vec![format!("Delete file `{}`", path.display())],
440+
format!("Delete file `{}`", self.path.display()),
441+
vec![format!("Delete file `{}`", self.path.display())],
451442
)]
452443
}
453444

454445
#[tracing::instrument(level = "debug", skip_all)]
455446
async fn revert(&mut self) -> Result<(), ActionError> {
456-
let Self {
457-
path,
458-
pending_nix_config: _,
459-
} = self;
460-
461-
remove_file(&path)
447+
remove_file(&self.path)
462448
.await
463-
.map_err(|e| Self::error(ActionErrorKind::Remove(path.to_owned(), e)))?;
449+
.map_err(|e| Self::error(ActionErrorKind::Remove(self.path.to_owned(), e)))?;
464450

465451
Ok(())
466452
}
@@ -480,7 +466,9 @@ mod test {
480466
nix_config
481467
.settings_mut()
482468
.insert("experimental-features".into(), "ca-references".into());
483-
let mut action = CreateOrMergeNixConfig::plan(&test_file, nix_config).await?;
469+
let mut action =
470+
CreateOrMergeNixConfig::plan(&test_file, nix_config, "# Generated by".to_string())
471+
.await?;
484472

485473
action.try_execute().await?;
486474

@@ -506,7 +494,9 @@ mod test {
506494
nix_config
507495
.settings_mut()
508496
.insert("experimental-features".into(), "ca-references".into());
509-
let mut action = CreateOrMergeNixConfig::plan(&test_file, nix_config).await?;
497+
let mut action =
498+
CreateOrMergeNixConfig::plan(&test_file, nix_config, "# Generated by".to_string())
499+
.await?;
510500

511501
action.try_execute().await?;
512502

@@ -534,7 +524,9 @@ mod test {
534524
nix_config
535525
.settings_mut()
536526
.insert("experimental-features".into(), "flakes".into());
537-
let mut action = CreateOrMergeNixConfig::plan(&test_file, nix_config).await?;
527+
let mut action =
528+
CreateOrMergeNixConfig::plan(&test_file, nix_config, "# Generated by".to_string())
529+
.await?;
538530

539531
action.try_execute().await?;
540532

@@ -566,7 +558,9 @@ mod test {
566558
nix_config
567559
.settings_mut()
568560
.insert("allow-dirty".into(), "false".into());
569-
let mut action = CreateOrMergeNixConfig::plan(&test_file, nix_config).await?;
561+
let mut action =
562+
CreateOrMergeNixConfig::plan(&test_file, nix_config, "# Generated by".to_string())
563+
.await?;
570564

571565
action.try_execute().await?;
572566

@@ -611,7 +605,7 @@ mod test {
611605
nix_config
612606
.settings_mut()
613607
.insert("warn-dirty".into(), "false".into());
614-
match CreateOrMergeNixConfig::plan(&test_file, nix_config).await {
608+
match CreateOrMergeNixConfig::plan(&test_file, nix_config, "".to_string()).await {
615609
Err(err) => {
616610
if let ActionErrorKind::Custom(e) = err.kind() {
617611
match e.downcast_ref::<CreateOrMergeNixConfigError>() {
@@ -653,7 +647,9 @@ mod test {
653647
nix_config
654648
.settings_mut()
655649
.insert("experimental-features".into(), "ca-references".into());
656-
let mut action = CreateOrMergeNixConfig::plan(&test_file, nix_config).await?;
650+
let mut action =
651+
CreateOrMergeNixConfig::plan(&test_file, nix_config, "# Generated by".to_string())
652+
.await?;
657653

658654
action.try_execute().await?;
659655

@@ -685,7 +681,9 @@ mod test {
685681
nix_config
686682
.settings_mut()
687683
.insert("experimental-features".into(), "ca-references".into());
688-
let mut action = CreateOrMergeNixConfig::plan(&test_file, nix_config).await?;
684+
let mut action =
685+
CreateOrMergeNixConfig::plan(&test_file, nix_config, "# Generated by".to_string())
686+
.await?;
689687

690688
action.try_execute().await?;
691689

src/action/common/configure_nix.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ impl ConfigureNix {
2929
pub async fn plan(
3030
shell_profile_locations: ShellProfileLocations,
3131
settings: &CommonSettings,
32-
extra_internal_conf: Option<nix_config_parser::NixConfig>,
3332
) -> Result<StatefulAction<Self>, ActionError> {
3433
let setup_default_profile = SetupDefaultProfile::plan(PathBuf::from(SCRATCH_DIR))
3534
.await
@@ -53,9 +52,9 @@ impl ConfigureNix {
5352
settings.nix_build_group_name.clone(),
5453
settings.proxy.clone(),
5554
settings.ssl_cert_file.clone(),
56-
extra_internal_conf.clone(),
5755
settings.extra_conf.clone(),
5856
settings.force,
57+
settings.determinate_nix,
5958
)
6059
.await
6160
.map_err(Self::error)?,

0 commit comments

Comments
 (0)