use NIX_*_DIR env vars when defined

This commit is contained in:
Rob Vermaas 2011-03-16 13:08:12 +00:00
parent d5710b840b
commit 8f35d03bca
3 changed files with 7 additions and 5 deletions

View file

@ -30,6 +30,8 @@ sub index :Path :Args(0) {
$c->stash->{template} = 'overview.tt';
$c->stash->{projects} = [$c->model('DB::Projects')->search(isAdmin($c) ? {} : {hidden => 0}, {order_by => 'name'})];
$c->stash->{newsItems} = [$c->model('DB::NewsItems')->search({}, { order_by => ['createtime DESC'], rows => 5 })];
# $c->stash->{nrbuilds} = [nrbuildsQuery($c, 30, "day", "", "", "", "")];
# <img src="http://chart.apis.google.com/chart?cht=bvg&chtt=Nr%20builds%20over%20the%20last%2030%20days&chs=300x100&chd=t:1785,881,2863,2828,1472,2847,1449,5634,1625,1200,1576,700,839,8533,1439,361,991,1337,1234,1322,1883,2146,1553,883,378,1395,1204,527,1147,124&chco=BBCEBB&chds=0,8533&chbh=a&chxt=y&chxr=0,0,8533"/>
}
@ -186,7 +188,7 @@ sub end : ActionClass('RenderView') {
sub nar :Local :Args(1) {
my ($self, $c, $path) = @_;
$path = "/nix/store/$path";
$path = ($ENV{NIX_STORE_DIR}."/$path" || "/nix/store/$path" );
if (!isValidPath($path)) {
$c->response->status(410); # "Gone"

View file

@ -21,7 +21,7 @@ sub scmPath {
sub getBuildLog {
my ($drvPath) = @_;
my $logPath = "/nix/var/log/nix/drvs/" . basename $drvPath;
my $logPath = ($ENV{NIX_LOG_DIR} || "/nix/var/log/nix"). "/drvs/" . basename $drvPath;
return -e $logPath ? $logPath : undef;
}

View file

@ -30,8 +30,8 @@ sub getHydraPath {
}
sub getHydraConf {
my $conf = $ENV{"HYDRA_CONF"} || (getHydraPath . "/hydra.conf");
die "The HYDRA_CONF file ($conf) does not exist!\n" unless -f $conf;
my $conf = $ENV{"HYDRA_CONFIG"} || (getHydraPath . "/hydra.conf");
die "The HYDRA_CONFIG file ($conf) does not exist!\n" unless -f $conf;
return $conf;
}
@ -74,7 +74,7 @@ sub txn_do {
sub getGCRootsDir {
die unless defined $ENV{LOGNAME};
my $dir = "/nix/var/nix/gcroots/per-user/$ENV{LOGNAME}/hydra-roots";
my $dir = ($ENV{NIX_STATE_DIR} || "/nix/var/nix" ) . "/gcroots/per-user/$ENV{LOGNAME}/hydra-roots";
mkpath $dir if !-e $dir;
return $dir;
}