Skip to content

Commit 573d647

Browse files
chores: cleanup version constants (#33)
1 parent 56bb730 commit 573d647

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/image_builder.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ use tempfile::tempdir;
2626
use crate::nixos;
2727
use crate::shell::*;
2828

29-
const NIX_VERSION: &str = "2.28.3";
30-
3129
const NIX_CONF: &str = formatcp!(
3230
"experimental-features = nix-command flakes
3331
extra-nix-path = nixpkgs=github:nixos/nixpkgs/nixos-{}
3432
build-users-group =
3533
sandbox = false
3634
",
37-
nixos::NIXOS_VERSION
35+
crate::NIXOS_VERSION
3836
);
3937

4038
static BASE_SHA256: &str = "/nix/.base.sha256";
@@ -464,16 +462,16 @@ where
464462
let nix_store = dest.join("store");
465463
if !nix_store.exists() {
466464
log::info!("installing Nix in {}", dest.display());
467-
let nix_url = nix_installer_url(NIX_VERSION, arch);
468-
download_and_install_nix(NIX_VERSION, arch, &nix_url, dest)?;
465+
let nix_url = nix_installer_url(crate::NIX_VERSION, arch);
466+
download_and_install_nix(crate::NIX_VERSION, arch, &nix_url, dest)?;
469467
}
470468

471469
let nix_bin = dest.join(".bin");
472470
let gcroots = dest.join("var/nix/gcroots");
473471
fs::create_dir_all(&gcroots)?;
474472

475473
if !symlink_exists(&nix_bin) {
476-
let nix_store_path = find_nix(&nix_store, NIX_VERSION)?;
474+
let nix_store_path = find_nix(&nix_store, crate::NIX_VERSION)?;
477475
let nix_path = Path::new("/nix/store").join(nix_store_path);
478476
symlink(nix_path.join("bin"), nix_bin).unwrap();
479477
symlink(&nix_path, gcroots.join("nix")).unwrap();

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ mod embedded_image;
1313

1414
mod pid_file;
1515

16+
pub(crate) const NIX_VERSION: &str = "2.28.3";
17+
pub(crate) const NIXOS_VERSION: &str = "25.05";
18+
1619
pub(crate) const CACHE_HOME: &str = "/nix/.cache";
1720
pub(crate) const CONFIG_HOME: &str = "/nix/.config";
1821

src/nixos.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ use std::{
88
use anyhow::{bail, Context, Result};
99
use regex::Regex;
1010

11-
pub(crate) const NIXOS_VERSION: &str = "25.05";
12-
1311
pub(crate) const ENV_VARS: [(&str, &str); 4] = [
1412
("PATH", "/nix/.bin"),
1513
("NIX_CONF_DIR", "/nix/etc"),
@@ -78,7 +76,7 @@ pub fn build_flake_from_package_list(
7876
match &caps[1] {
7977
"name" => name,
8078
"description" => description,
81-
"version" => NIXOS_VERSION,
79+
"version" => crate::NIXOS_VERSION,
8280
"packages" => &package_list,
8381
_ => "",
8482
}

0 commit comments

Comments
 (0)