File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ use std::{cmp::Ordering, env};
22
33use color_eyre:: { eyre, Result } ;
44use semver:: Version ;
5+ use tracing:: warn;
56
67use crate :: util;
78
@@ -48,12 +49,13 @@ pub fn check_nix_version() -> Result<()> {
4849 match current. cmp ( & required) {
4950 Ordering :: Less => {
5051 let binary_name = if is_lix_binary { "Lix" } else { "Nix" } ;
51- Err ( eyre :: eyre !(
52- "{} version {} is too old. Minimum required version is {} " ,
52+ warn ! (
53+ "Warning: {} version {} is older than the recommended minimum version {}. You may encounter issues. " ,
5354 binary_name,
5455 version,
5556 min_version
56- ) )
57+ ) ;
58+ Ok ( ( ) )
5759 }
5860 _ => Ok ( ( ) ) ,
5961 }
Original file line number Diff line number Diff line change @@ -21,22 +21,25 @@ const NH_VERSION: &str = env!("CARGO_PKG_VERSION");
2121const NH_REV : Option < & str > = option_env ! ( "NH_REV" ) ;
2222
2323fn main ( ) -> Result < ( ) > {
24- let do_warn = checks:: setup_environment ( ) ?;
25-
2624 let args = <crate :: interface:: Main as clap:: Parser >:: parse ( ) ;
25+
26+ // Set up logging
2727 crate :: logging:: setup_logging ( args. verbose ) ?;
2828 tracing:: debug!( "{args:#?}" ) ;
2929 tracing:: debug!( %NH_VERSION , ?NH_REV ) ;
3030
31- if do_warn {
31+ // Verify the Nix environment before running commands
32+ checks:: verify_nix_environment ( ) ?;
33+
34+ // Once we assert required Nix features, validate NH environment checks
35+ // For now, this is just NH_* variables being set. More checks may be
36+ // added to setup_environment in the future.
37+ if checks:: setup_environment ( ) ? {
3238 tracing:: warn!(
3339 "nh {NH_VERSION} now uses NH_FLAKE instead of FLAKE, please modify your configuration"
3440 ) ;
3541 }
3642
37- // Verify the Nix environment before running commands
38- checks:: verify_nix_environment ( ) ?;
39-
4043 args. command . run ( )
4144}
4245
You can’t perform that action at this time.
0 commit comments