Added support for simple sessions
This commit is contained in:
		
							parent
							
								
									9a22c117b5
								
							
						
					
					
						commit
						4b5f812e95
					
				| @ -53,7 +53,7 @@ pub fn gather_sessions(user: &User) -> Vec<Session> { | |||||||
|         false => vec![Session { |         false => vec![Session { | ||||||
|             name: String::from("Shell"), |             name: String::from("Shell"), | ||||||
|             generation: user.shell.to_str().unwrap().to_owned(), |             generation: user.shell.to_str().unwrap().to_owned(), | ||||||
|             env: vec![], |             env: vec![String::from("NIXGREETY_SIMPLE=1")], | ||||||
|         }], |         }], | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -9,6 +9,15 @@ use std::{ | |||||||
| use crate::fs::resolve_link; | use crate::fs::resolve_link; | ||||||
| 
 | 
 | ||||||
| pub fn handle_session() -> io::Result<()> { | pub fn handle_session() -> io::Result<()> { | ||||||
|  |     match env::var("NIXGREETY_SIMPLE") { | ||||||
|  |         Ok(_) => handle_simple_session(), | ||||||
|  |         Err(_) => handle_hm_session(), | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     Ok(()) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | fn handle_hm_session() { | ||||||
|     println!(">>> Activating environment <<<"); |     println!(">>> Activating environment <<<"); | ||||||
|     let generation = env::var("NIXGREETY_GENERATION").unwrap(); |     let generation = env::var("NIXGREETY_GENERATION").unwrap(); | ||||||
|     Command::new(format!("{}/activate", generation)) |     Command::new(format!("{}/activate", generation)) | ||||||
| @ -48,6 +57,11 @@ pub fn handle_session() -> io::Result<()> { | |||||||
|     Command::new(format!("{}/activate", generation.display())) |     Command::new(format!("{}/activate", generation.display())) | ||||||
|         .status() |         .status() | ||||||
|         .unwrap(); |         .unwrap(); | ||||||
| 
 | } | ||||||
|     Ok(()) | 
 | ||||||
|  | fn handle_simple_session() { | ||||||
|  |     let generation = env::var("NIXGREETY_GENERATION").unwrap(); | ||||||
|  |     Command::new(&generation) | ||||||
|  |         .status() | ||||||
|  |         .expect("Failed to create session"); | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jan-Bulthuis
						Jan-Bulthuis