1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-02 18:42:15 +00:00
nixpkgs/pkgs/applications/networking/cluster/panamax/api/default.nix
Eelco Dolstra 55932c1bec Don't statically depend on cacert for certificates
This reverts commit cd52c04456 and
others.

Managing certificates (including revoking certificates and adding
custom certificates) becomes extremely painful if every package in the
system potentially depends on a different copy of cacert. Also, it
makes updating cacert rather expensive.
2015-07-31 01:34:58 +02:00

77 lines
2.2 KiB
Nix

{ stdenv, buildEnv, fetchgit, fetchurl, makeWrapper, bundlerEnv, bundler_HEAD
, ruby, libxslt, libxml2, sqlite, openssl, docker
, dataDir ? "/var/lib/panamax-api" }:
with stdenv.lib;
stdenv.mkDerivation rec {
name = "panamax-api-${version}";
version = "0.2.16";
env = bundlerEnv {
name = "panamax-api-gems-${version}";
inherit ruby;
gemset = ./gemset.nix;
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
buildInputs = [ openssl ];
};
bundler = bundler_HEAD.override { inherit ruby; };
database_yml = builtins.toFile "database.yml" ''
production:
adapter: sqlite3
database: <%= ENV["PANAMAX_DATABASE_PATH"] || "${dataDir}/db/mnt/db.sqlite3" %>
timeout: 5000
'';
src = fetchgit {
rev = "refs/tags/v${version}";
url = "git://github.com/CenturyLinkLabs/panamax-api";
sha256 = "1g75y25asj33gcczpb9iwnk6f7afm1xjqyw803rr3y2h7dm6jivy";
};
buildInputs = [ makeWrapper sqlite openssl env.ruby bundler ];
setSourceRoot = ''
mkdir -p $out/share
cp -R panamax-api $out/share/panamax-api
export sourceRoot="$out/share/panamax-api"
'';
postPatch = ''
find . -type f -exec sed -e 's|/usr/bin/docker|${docker}/bin/docker|g' -i "{}" \;
'';
configurePhase = ''
export HOME=$PWD
export GEM_HOME=${env}/${env.ruby.gemPath}
export RAILS_ENV=production
ln -sf ${database_yml} config/database.yml
'';
installPhase = ''
rm -rf log tmp
mv ./db ./_db
ln -sf ${dataDir}/{db,state/log,state/tmp} .
mkdir -p $out/bin
makeWrapper bin/bundle "$out/bin/bundle" \
--run "cd $out/share/panamax-api" \
--prefix "PATH" : "$out/share/panamax-api/bin:${env.ruby}/bin:$PATH" \
--prefix "HOME" : "$out/share/panamax-api" \
--prefix "GEM_HOME" : "${env}/${env.ruby.gemPath}" \
--prefix "SSL_CERT_FILE" : /etc/ssl/certs/ca-certificates.crt \
--prefix "GEM_PATH" : "$out/share/panamax-api:${bundler}/${env.ruby.gemPath}"
'';
meta = with stdenv.lib; {
homepage = https://github.com/CenturyLinkLabs/panamax-api;
description = "The API behind The Panamax UI";
license = licenses.asl20;
maintainers = with maintainers; [ matejc offline ];
platforms = platforms.linux;
};
}