-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store::getFSAccessor
: Do not include the store dir
Rather than "mounting" the store inside an empty virtual filesystem, just return the store as a virtual filesystem. This is more modular. (FWIW, it also supports two long term hopes of mind: 1. More capability-based Nix language mode. I dream of a "super pure eval" where you can only use relative path literals (See #8738), and any `fetchTree`-fetched stuff + the store are all disjoint (none is mounted in another) file systems. 2. Windows, where the store dir may include drive letters, etc., and is thus unsuitable to be the prefix of any `CanonPath`s. )
- Loading branch information
1 parent
c47ba7d
commit e98041b
Showing
16 changed files
with
173 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include "source-accessor.hh" | ||
|
||
namespace nix { | ||
|
||
struct SubdirSourceAccessor : SourceAccessor | ||
{ | ||
ref<SourceAccessor> parent; | ||
|
||
CanonPath subdirectory; | ||
|
||
SubdirSourceAccessor(ref<SourceAccessor> && parent, CanonPath && subdirectory) | ||
: parent(std::move(parent)) | ||
, subdirectory(std::move(subdirectory)) | ||
{ | ||
displayPrefix.clear(); | ||
|
||
ownLocationForSymlinkResolution = this->parent->ownLocationForSymlinkResolution + subdirectory.abs(); | ||
} | ||
|
||
std::string readFile(const CanonPath & path) override | ||
{ | ||
return parent->readFile(subdirectory / path); | ||
} | ||
|
||
bool pathExists(const CanonPath & path) override | ||
{ | ||
return parent->pathExists(subdirectory / path); | ||
} | ||
|
||
std::optional<Stat> maybeLstat(const CanonPath & path) override | ||
{ | ||
return parent->maybeLstat(subdirectory / path); | ||
} | ||
|
||
DirEntries readDirectory(const CanonPath & path) override | ||
{ | ||
return parent->readDirectory(subdirectory / path); | ||
} | ||
|
||
std::string readLink(const CanonPath & path) override | ||
{ | ||
return parent->readLink(subdirectory / path); | ||
} | ||
|
||
std::string showPath(const CanonPath & path) override | ||
{ | ||
return displayPrefix + parent->showPath(subdirectory / path) + displaySuffix; | ||
} | ||
}; | ||
|
||
ref<SourceAccessor> projectSubdirSourceAccessor(ref<SourceAccessor> parent, CanonPath subdirectory) | ||
{ | ||
return make_ref<SubdirSourceAccessor>(std::move(parent), std::move(subdirectory)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.