forked from jan-leila/nix-config
		
	fix: fixed home manager impermanence activation on defiant
This commit is contained in:
		
							parent
							
								
									539af51473
								
							
						
					
					
						commit
						3f107f8d1e
					
				
					 3 changed files with 14 additions and 6 deletions
				
			
		|  | @ -1,4 +1,6 @@ | |||
| {osConfig, ...}: { | ||||
|   impermanence.fallbackPersistence.enable = false; | ||||
| 
 | ||||
|   home = { | ||||
|     username = osConfig.users.users.git.name; | ||||
|     homeDirectory = osConfig.users.users.git.home; | ||||
|  |  | |||
|  | @ -12,6 +12,8 @@ | |||
|   ]; | ||||
| 
 | ||||
|   config = { | ||||
|     impermanence.enable = osConfig.host.impermanence.enable; | ||||
| 
 | ||||
|     # Home Manager needs a bit of information about you and the paths it should | ||||
|     # manage. | ||||
|     home = { | ||||
|  |  | |||
|  | @ -8,21 +8,25 @@ | |||
| in { | ||||
|   options.impermanence = { | ||||
|     enable = lib.mkEnableOption "impermanence for home directory"; | ||||
|     fallbackPersistence.enable = lib.mkOption { | ||||
|       type = lib.types.bool; | ||||
|       default = true; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkMerge [ | ||||
|     (lib.mkIf config.impermanence.enable { | ||||
|       assertions = [ | ||||
|         { | ||||
|           assertion = osConfig.impermanence.enable; | ||||
|           message = "impermanence can not be enabled for a user when it is not enabled for a configuration"; | ||||
|           assertion = osConfig.host.impermanence.enable; | ||||
|           message = "impermanence can not be enabled for a user when it is not enabled for the system"; | ||||
|         } | ||||
|       ]; | ||||
|     }) | ||||
|     (lib.mkIf osConfig.host.impermanence.enable { | ||||
|     # If impermanence is not enabled for this user but system impermanence is enabled, | ||||
|     # persist the entire home directory as fallback | ||||
|       home.persistence."/persist/home/${config.home.username}" = lib.mkIf (!cfg.enable) { | ||||
|     (lib.mkIf (osConfig.host.impermanence.enable && !cfg.enable && cfg.fallbackPersistence.enable) { | ||||
|       home.persistence."/persist/home/${config.home.username}" = { | ||||
|         directories = ["."]; | ||||
|         allowOther = true; | ||||
|       }; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue