@@ -6,10 +6,14 @@ use elasticsearch_dsl::*;
66use interface:: SearchArgs ;
77use regex:: Regex ;
88use serde:: Deserialize ;
9- use tracing:: { debug, trace} ;
9+ use tracing:: { debug, trace, warn } ;
1010
1111use crate :: * ;
1212
13+ // List of deprecated NixOS versions
14+ // Add new versions as they become deprecated.
15+ const DEPRECATED_VERSIONS : & [ & str ] = & [ "nixos-24.05" ] ;
16+
1317#[ derive( Debug , Deserialize ) ]
1418#[ allow( non_snake_case, dead_code) ]
1519struct SearchResult {
@@ -211,6 +215,12 @@ fn supported_branch<S: AsRef<str>>(branch: S) -> bool {
211215 return true ;
212216 }
213217
218+ if DEPRECATED_VERSIONS . contains ( & branch) {
219+ warn ! ( "Channel {} is deprecated and not supported" , branch) ;
220+ return false ;
221+ }
222+
223+ // Support for current version pattern
214224 let re = Regex :: new ( r"nixos-[0-9]+\.[0-9]+" ) . unwrap ( ) ;
215225 re. is_match ( branch)
216226}
@@ -219,7 +229,8 @@ fn supported_branch<S: AsRef<str>>(branch: S) -> bool {
219229fn test_supported_branch ( ) {
220230 assert ! ( supported_branch( "nixos-unstable" ) ) ;
221231 assert ! ( !supported_branch( "nixos-unstable-small" ) ) ;
222- assert ! ( supported_branch( "nixos-24.05" ) ) ;
232+ assert ! ( !supported_branch( "nixos-24.05" ) ) ;
233+ assert ! ( supported_branch( "nixos-24.11" ) ) ;
223234 assert ! ( !supported_branch( "24.05" ) ) ;
224235 assert ! ( !supported_branch( "nixpkgs-darwin" ) ) ;
225236 assert ! ( !supported_branch( "nixpks-21.11-darwin" ) ) ;
0 commit comments