* Implemented Eelco V.'s `nix-env -I' command to specify the default
path of the Nix expression to be used with the import, upgrade, and query commands. For instance, $ nix-env -I ~/nixpkgs/pkgs/system/i686-linux.nix $ nix-env --query --available [aka -qa] sylpheed-0.9.7 bison-1.875 pango-1.2.5 subversion-0.35.1 ... $ nix-env -i sylpheed $ nix-env -u subversion There can be only one default at a time. * If the path to a Nix expression is a symlink, follow the symlink prior to resolving relative path references in the expression.
This commit is contained in:
		
							parent
							
								
									f83c5e3e5f
								
							
						
					
					
						commit
						4a373a3e9a
					
				
					 7 changed files with 87 additions and 43 deletions
				
			
		| 
						 | 
				
			
			@ -29,16 +29,12 @@ struct Cleanup : TermFun
 | 
			
		|||
        ATMatcher m;
 | 
			
		||||
        string s;
 | 
			
		||||
 | 
			
		||||
        if (atMatch(m, e) >> "Str" >> s) {
 | 
			
		||||
        if (atMatch(m, e) >> "Str" >> s)
 | 
			
		||||
            return ATmake("Str(<str>)",
 | 
			
		||||
                string(s, 1, s.size() - 2).c_str());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (atMatch(m, e) >> "Path" >> s) {
 | 
			
		||||
            if (s[0] != '/')
 | 
			
		||||
                s = basePath + "/" + s;
 | 
			
		||||
            return ATmake("Path(<str>)", canonPath(s).c_str());
 | 
			
		||||
        }
 | 
			
		||||
        if (atMatch(m, e) >> "Path" >> s)
 | 
			
		||||
            return ATmake("Path(<str>)", absPath(s, basePath).c_str());
 | 
			
		||||
 | 
			
		||||
        if (atMatch(m, e) >> "Int" >> s) {
 | 
			
		||||
            istringstream s2(s);
 | 
			
		||||
| 
						 | 
				
			
			@ -147,8 +143,14 @@ Expr parseExprFromFile(Path path)
 | 
			
		|||
    if (e) return e;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    /* If `path' refers to a directory, append `/default.nix'. */
 | 
			
		||||
    /* If `path' is a symlink, follow it.  This is so that relative
 | 
			
		||||
       path references work. */
 | 
			
		||||
    struct stat st;
 | 
			
		||||
    if (lstat(path.c_str(), &st))
 | 
			
		||||
        throw SysError(format("getting status of `%1%'") % path);
 | 
			
		||||
    if (S_ISLNK(st.st_mode)) path = absPath(readLink(path), dirOf(path));
 | 
			
		||||
 | 
			
		||||
    /* If `path' refers to a directory, append `/default.nix'. */
 | 
			
		||||
    if (stat(path.c_str(), &st))
 | 
			
		||||
        throw SysError(format("getting status of `%1%'") % path);
 | 
			
		||||
    if (S_ISDIR(st.st_mode))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue