A fork of attic a self-hostable Nix Binary Cache server
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

attic/nix_store: Generate NIX_VERSION integer from major and minor

Zhaofeng Li 496826a6 1424e4b7

+6 -5
+6 -5
attic/build.rs
··· 11 11 mod nix_store { 12 12 use cc::Build; 13 13 use system_deps::Dependencies; 14 - use version_compare::Version; 14 + use version_compare::{Part, Version}; 15 15 16 16 fn apply_variant_flags(build: &mut Build, deps: &Dependencies) { 17 17 let nix_main = deps ··· 21 21 22 22 build.define("ATTIC_VARIANT_NIX", None); 23 23 24 - let version = if version >= Version::from("2.26").unwrap() { 25 - 226 26 - } else { 27 - 225 24 + let (major, minor) = match (version.part(0), version.part(1)) { 25 + (Ok(Part::Number(major)), Ok(Part::Number(minor))) if minor < 100 => (major, minor), 26 + _ => panic!("Nix version {version} is not supported"), 28 27 }; 28 + 29 + let version = major * 100 + minor; 29 30 build.define("NIX_VERSION", &*format!("{version}")); 30 31 } 31 32