nix-env: Create ~/.nix-profile automatically
(cherry picked from commit 9348f9291e5d9e4ba3c4347ea1b235640f54fd79)
This commit is contained in:
		
							parent
							
								
									2070d55b0b
								
							
						
					
					
						commit
						f66108f738
					
				
					 9 changed files with 31 additions and 42 deletions
				
			
		| 
						 | 
				
			
			@ -1425,9 +1425,14 @@ static int _main(int argc, char * * argv)
 | 
			
		|||
 | 
			
		||||
        if (globals.profile == "") {
 | 
			
		||||
            Path profileLink = getHome() + "/.nix-profile";
 | 
			
		||||
            globals.profile = pathExists(profileLink)
 | 
			
		||||
                ? absPath(readLink(profileLink), dirOf(profileLink))
 | 
			
		||||
                : canonPath(settings.nixStateDir + "/profiles/default");
 | 
			
		||||
            if (!pathExists(profileLink)) {
 | 
			
		||||
                replaceSymlink(
 | 
			
		||||
                    getuid() == 0
 | 
			
		||||
                    ? settings.nixStateDir + "/profiles/default"
 | 
			
		||||
                    : fmt("%s/profiles/per-user/%s/profile", settings.nixStateDir, getUserName()),
 | 
			
		||||
                    profileLink);
 | 
			
		||||
            }
 | 
			
		||||
            globals.profile = absPath(readLink(profileLink), dirOf(profileLink));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        op(globals, opFlags, opArgs);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue