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, ...}: { | {osConfig, ...}: { | ||||||
|  |   impermanence.fallbackPersistence.enable = false; | ||||||
|  | 
 | ||||||
|   home = { |   home = { | ||||||
|     username = osConfig.users.users.git.name; |     username = osConfig.users.users.git.name; | ||||||
|     homeDirectory = osConfig.users.users.git.home; |     homeDirectory = osConfig.users.users.git.home; | ||||||
|  |  | ||||||
|  | @ -12,6 +12,8 @@ | ||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|   config = { |   config = { | ||||||
|  |     impermanence.enable = osConfig.host.impermanence.enable; | ||||||
|  | 
 | ||||||
|     # Home Manager needs a bit of information about you and the paths it should |     # Home Manager needs a bit of information about you and the paths it should | ||||||
|     # manage. |     # manage. | ||||||
|     home = { |     home = { | ||||||
|  |  | ||||||
|  | @ -8,21 +8,25 @@ | ||||||
| in { | in { | ||||||
|   options.impermanence = { |   options.impermanence = { | ||||||
|     enable = lib.mkEnableOption "impermanence for home directory"; |     enable = lib.mkEnableOption "impermanence for home directory"; | ||||||
|  |     fallbackPersistence.enable = lib.mkOption { | ||||||
|  |       type = lib.types.bool; | ||||||
|  |       default = true; | ||||||
|  |     }; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   config = lib.mkMerge [ |   config = lib.mkMerge [ | ||||||
|     (lib.mkIf config.impermanence.enable { |     (lib.mkIf config.impermanence.enable { | ||||||
|       assertions = [ |       assertions = [ | ||||||
|         { |         { | ||||||
|           assertion = osConfig.impermanence.enable; |           assertion = osConfig.host.impermanence.enable; | ||||||
|           message = "impermanence can not be enabled for a user when it is not enabled for a configuration"; |           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, | ||||||
|       # If impermanence is not enabled for this user but system impermanence is enabled, |     # persist the entire home directory as fallback | ||||||
|       # persist the entire home directory as fallback |     (lib.mkIf (osConfig.host.impermanence.enable && !cfg.enable && cfg.fallbackPersistence.enable) { | ||||||
|       home.persistence."/persist/home/${config.home.username}" = lib.mkIf (!cfg.enable) { |       home.persistence."/persist/home/${config.home.username}" = { | ||||||
|         directories = ["."]; |         directories = ["."]; | ||||||
|         allowOther = true; |         allowOther = true; | ||||||
|       }; |       }; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue