diff options
-rw-r--r-- | scripts/Makefile.am | 10 | ||||
-rw-r--r-- | scripts/nix-profile.sh.in (renamed from scripts/nix-profile.sh) | 10 | ||||
-rw-r--r-- | scripts/nix-pull.in (renamed from scripts/nix-pull) | 7 | ||||
-rw-r--r-- | scripts/nix-push.in (renamed from scripts/nix-push) | 0 | ||||
-rwxr-xr-x | scripts/nix-switch.in (renamed from scripts/nix-switch) | 17 | ||||
-rw-r--r-- | src/Makefile.am | 3 |
6 files changed, 23 insertions, 24 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 2f4dbacc93f0..a8cbe8222b07 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,9 +1,19 @@ bin_SCRIPTS = nix-switch nix-collect-garbage \ nix-pull nix-push +noinst_SCRIPTS = nix-profile.sh + install-exec-local: $(INSTALL) -d $(sysconfdir)/profile.d $(INSTALL_PROGRAM) nix-profile.sh $(sysconfdir)/profile.d/nix.sh $(INSTALL) -d $(sysconfdir)/nix # !!! don't overwrite local modifications $(INSTALL_DATA) prebuilts.conf $(sysconfdir)/nix/prebuilts.conf + +%: %.in Makefile + sed \ + -e s^@prefix\@^$(prefix)^g \ + -e s^@sysconfdir\@^$(sysconfdir)^g \ + -e s^@localstatedir\@^$(localstatedir)^g \ + < $< > $@ || rm $@ + chmod +x $@ diff --git a/scripts/nix-profile.sh b/scripts/nix-profile.sh.in index fb526a239ef5..3a64caa04989 100644 --- a/scripts/nix-profile.sh +++ b/scripts/nix-profile.sh.in @@ -1,10 +1,10 @@ -if test -z "$NIX_SET"; then +#if test -z "$NIX_SET"; then - export NIX_SET=1 +# export NIX_SET=1 - NIX_LINKS=/nix/var/nix/links/current + NIX_LINKS=@localstatedir@/nix/links/current - export PATH=$NIX_LINKS/bin:/nix/bin:$PATH + export PATH=$NIX_LINKS/bin:@prefix@/bin:$PATH export LD_LIBRARY_PATH=$NIX_LINKS/lib:$LD_LIBRARY_PATH @@ -17,4 +17,4 @@ if test -z "$NIX_SET"; then # export MANPATH=$NIX_LINKS/man:$MANPATH -fi +#fi diff --git a/scripts/nix-pull b/scripts/nix-pull.in index 320322585364..a75c1f258b1e 100644 --- a/scripts/nix-pull +++ b/scripts/nix-pull.in @@ -1,10 +1,7 @@ #! /usr/bin/perl -w -my $prefix = $ENV{"NIX"} || "/tmp/nix"; # !!! use prefix -my $etcdir = "$prefix/etc/nix"; -my $tmpfile = "$prefix/var/nix/pull.tmp"; - -my $conffile = "$etcdir/prebuilts.conf"; +my $tmpfile = "@localstatedir@/nix/pull.tmp"; +my $conffile = "@sysconfdir@/nix/prebuilts.conf"; my @subs; my @sucs; diff --git a/scripts/nix-push b/scripts/nix-push.in index bf30f3a49d7f..bf30f3a49d7f 100644 --- a/scripts/nix-push +++ b/scripts/nix-push.in diff --git a/scripts/nix-switch b/scripts/nix-switch.in index d58a5f249e18..55305418c7f6 100755 --- a/scripts/nix-switch +++ b/scripts/nix-switch.in @@ -12,29 +12,24 @@ if (scalar @ARGV > 0 && $ARGV[0] eq "--keep") { my $hash = $ARGV[0]; $hash || die "no package hash specified"; -my $prefix = $ENV{"NIX"} || "/nix"; # !!! use prefix -my $linkdir = "$prefix/var/nix/links"; +my $linkdir = "@localstatedir@/nix/links"; # Build the specified package, and all its dependencies. -my $pkgdir = `nix getpkg $hash`; -if ($?) { die "`nix getpkg' failed"; } +my $pkgdir = `nix -qph $hash`; +if ($?) { die "`nix -qph' failed"; } chomp $pkgdir; -my $id = `nix info $hash | cut -c 34-`; -if ($?) { die "`nix info' failed"; } -chomp $id; - # Figure out a generation number. my $nr = 0; -while (-e "$linkdir/$id-$nr") { $nr++; } -my $link = "$linkdir/$id-$nr"; +while (-e "$linkdir/$nr") { $nr++; } +my $link = "$linkdir/$nr"; # Create a symlink from $link to $pkgdir. symlink($pkgdir, $link) or die "cannot create $link: $!"; # Also store the hash of $pkgdir. This is useful for garbage # collection and the like. -my $hashfile = "$linkdir/$id-$nr.hash"; +my $hashfile = "$linkdir/$nr.hash"; open HASH, "> $hashfile" or die "cannot create $hashfile"; print HASH "$hash\n"; close HASH; diff --git a/src/Makefile.am b/src/Makefile.am index b22a56e3a036..4b21f12b3a26 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,9 +25,6 @@ libnix_a_SOURCES = util.cc hash.cc archive.cc md5.c \ install-data-local: $(INSTALL) -d $(localstatedir)/nix $(INSTALL) -d $(localstatedir)/nix/links -# $(INSTALL) -d $(localstatedir)/nix/prebuilts -# $(INSTALL) -d $(localstatedir)/nix/prebuilts/imports -# $(INSTALL) -d $(localstatedir)/nix/prebuilts/exports $(INSTALL) -d $(localstatedir)/log/nix $(INSTALL) -d $(prefix)/store $(bindir)/nix --init |