forked from lix-project/lix
* Generate the scripts so that we can substitute the prefix
etc. correctly. * Fixed nix-switch.
This commit is contained in:
parent
5304a1eb3a
commit
9c620e4afa
|
@ -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 $@
|
||||
|
|
|
@ -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
|
|
@ -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;
|
|
@ -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;
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue