about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am4
-rw-r--r--scripts/nix-pull.in2
-rw-r--r--scripts/readconfig.pm.in17
3 files changed, 21 insertions, 2 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 428d3fa6985a..bffbdbde5ddd 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -5,13 +5,14 @@ bin_SCRIPTS = nix-collect-garbage \
 
 noinst_SCRIPTS = nix-profile.sh generate-patches.pl
 
-nix-pull nix-push: readmanifest.pm download-using-manifests.pl
+nix-pull nix-push: readmanifest.pm readconfig.pm download-using-manifests.pl
 
 install-exec-local: readmanifest.pm download-using-manifests.pl
 	$(INSTALL) -d $(DESTDIR)$(sysconfdir)/profile.d
 	$(INSTALL_PROGRAM) nix-profile.sh $(DESTDIR)$(sysconfdir)/profile.d/nix.sh
 	$(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) -d $(DESTDIR)$(sysconfdir)/nix
 
@@ -22,6 +23,7 @@ EXTRA_DIST = nix-collect-garbage.in \
   nix-prefetch-url.in nix-install-package.in \
   nix-channel.in \
   readmanifest.pm.in \
+  readconfig.pm.in \
   nix-build.in \
   download-using-manifests.pl.in \
   generate-patches.pl.in \
diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in
index eb14a1739549..67a7838f19f0 100644
--- a/scripts/nix-pull.in
+++ b/scripts/nix-pull.in
@@ -26,7 +26,7 @@ $stateDir = "@localstatedir@/nix" unless defined $stateDir;
 umask 0022;
 
 
-# Obtain URLs either from the command line or from a configuration file.
+# Process the URLs specified on the command line.
 my %narFiles;
 my %patches;
 my %successors;
diff --git a/scripts/readconfig.pm.in b/scripts/readconfig.pm.in
new file mode 100644
index 000000000000..aeb443aeed3a
--- /dev/null
+++ b/scripts/readconfig.pm.in
@@ -0,0 +1,17 @@
+use strict;
+
+sub readConfig {
+    my %config;
+    my $config = "@sysconfdir@/nix/nix.conf";
+    return unless -f $config;
+    
+    open CONFIG, "<$config" or die "cannot open `$config'";
+    while (<CONFIG>) {
+        /^\s*([\w|-]+)\s*=\s*(.*)$/ or next;
+        $config{$1} = $2;
+        print "|$1| -> |$2|\n";
+    }
+    close CONFIG;
+}
+
+return 1;