mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
* Use the copy-from-other-stores substituter by default. Of course,
it only does something if $NIX_OTHER_STORES (not really a good name...) is set. * Do globbing on the elements of $NIX_OTHER_STORES. E.g. you could set it to /mnts/*/nix or something. * Install substituters in libexec/nix/substituters.
This commit is contained in:
parent
15f39aba8c
commit
8bc591a6f0
3 changed files with 20 additions and 12 deletions
|
@ -15,10 +15,12 @@ install-exec-local: readmanifest.pm download-using-manifests.pl copy-from-other-
|
|||
$(INSTALL) -d $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL_DATA) readmanifest.pm $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL_DATA) readconfig.pm $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL_PROGRAM) download-using-manifests.pl $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL_PROGRAM) find-runtime-roots.pl $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL_PROGRAM) generate-patches.pl $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL_PROGRAM) build-remote.pl $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL) -d $(DESTDIR)$(libexecdir)/nix/substituters
|
||||
$(INSTALL_PROGRAM) download-using-manifests.pl $(DESTDIR)$(libexecdir)/nix/substituters
|
||||
$(INSTALL_PROGRAM) copy-from-other-stores.pl $(DESTDIR)$(libexecdir)/nix/substituters
|
||||
$(INSTALL) -d $(DESTDIR)$(sysconfdir)/nix
|
||||
|
||||
include ../substitute.mk
|
||||
|
|
|
@ -3,17 +3,18 @@
|
|||
use strict;
|
||||
use File::Basename;
|
||||
|
||||
#print STDERR "FOO: @ARGV\n";
|
||||
my @remoteStoresAll = split ':', ($ENV{"NIX_OTHER_STORES"} or "");
|
||||
|
||||
die unless defined $ENV{"NIX_OTHER_STORES"};
|
||||
my @remoteStores = split ':', $ENV{"NIX_OTHER_STORES"};
|
||||
my @remoteStores;
|
||||
foreach my $dir (@remoteStoresAll) {
|
||||
push @remoteStores, glob($dir);
|
||||
}
|
||||
|
||||
|
||||
sub findStorePath {
|
||||
my $storePath = shift;
|
||||
|
||||
my $storePathName = basename $storePath;
|
||||
#print STDERR "GET $storePath\n";
|
||||
|
||||
foreach my $store (@remoteStores) {
|
||||
# Determine whether $storePath exists by looking for the
|
||||
|
@ -26,7 +27,6 @@ sub findStorePath {
|
|||
my $infoFile = "$store/var/nix/db/info/$storePathName";
|
||||
my $storePath2 = "$store/store/$storePathName";
|
||||
if (-f $infoFile && -e $storePath2) {
|
||||
#print STDERR "FOUND IN $infoFile\n";
|
||||
return ($infoFile, $storePath2);
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,11 @@ sub findStorePath {
|
|||
|
||||
|
||||
if ($ARGV[0] eq "--query-paths") {
|
||||
# !!! not implemented yet; needed for `nix-env -qas'
|
||||
foreach my $store (@remoteStores) {
|
||||
opendir DIR, "$store/var/nix/db/info" or next;
|
||||
print "@storedir@/$_\n" foreach readdir DIR;
|
||||
closedir DIR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,7 +48,7 @@ elsif ($ARGV[0] eq "--query-info") {
|
|||
foreach my $storePath (@ARGV) {
|
||||
|
||||
(my $infoFile) = findStorePath $storePath;
|
||||
#print STDERR "XXX $infoFile\n";
|
||||
next unless $infoFile;
|
||||
|
||||
my $deriver = "";
|
||||
my @references = ();
|
||||
|
@ -73,8 +77,9 @@ elsif ($ARGV[0] eq "--substitute") {
|
|||
die unless scalar @ARGV == 2;
|
||||
my $storePath = $ARGV[1];
|
||||
(my $infoFile, my $sourcePath) = findStorePath $storePath;
|
||||
die unless $infoFile;
|
||||
print "\n*** Copying `$storePath' from `$sourcePath'\n\n";
|
||||
system("nix-store --dump $sourcePath | nix-store --restore $storePath") == 0
|
||||
system("@bindir@/nix-store --dump $sourcePath | @bindir@/nix-store --restore $storePath") == 0
|
||||
or die "cannot copy `$sourcePath' to `$storePath'";
|
||||
}
|
||||
|
||||
|
|
|
@ -111,9 +111,10 @@ static void initAndRun(int argc, char * * argv)
|
|||
nixBinDir = canonPath(getEnv("NIX_BIN_DIR", NIX_BIN_DIR));
|
||||
|
||||
string subs = getEnv("NIX_SUBSTITUTERS", "default");
|
||||
if (subs == "default")
|
||||
substituters.push_back(nixLibexecDir + "/nix/download-using-manifests.pl");
|
||||
else
|
||||
if (subs == "default") {
|
||||
substituters.push_back(nixLibexecDir + "/nix/substituters/copy-from-other-stores.pl");
|
||||
substituters.push_back(nixLibexecDir + "/nix/substituters/download-using-manifests.pl");
|
||||
} else
|
||||
substituters = tokenizeString(subs, ":");
|
||||
|
||||
/* Get some settings from the configuration file. */
|
||||
|
|
Loading…
Reference in a new issue