astrolog: switches for using optional ephemeris/atlas files

This commit is contained in:
Kierán Meinhardt 2021-12-27 09:57:53 +01:00
parent e3d7768843
commit b4b9096d66

View File

@ -1,4 +1,8 @@
{ lib, stdenv, fetchzip, fetchurl, xorg, gnused }:
{ lib, stdenv, fetchzip, fetchurl, xorg, gnused
, withBigAtlas ? true
, withEphemeris ? true
, withMoonsEphemeris ? true
}:
stdenv.mkDerivation rec {
pname = "astrolog";
version = "7.30";
@ -23,15 +27,30 @@ stdenv.mkDerivation rec {
sha256 = "1mwvpvfk3lxjcc79zvwl4ypqzgqzipnc01cjldxrmx56xkc35zn7";
stripRoot = false;
};
moonsEphemeris = fetchzip {
url = "https://www.astrolog.org/ftp/ephem/moons/sepm.zip";
sha256 = "0labcidm8mrwvww93nwpp5738m9ff9q48cqzbgd18xny1jf6f8xd";
stripRoot = false;
};
atlas = fetchurl {
url = "http://astrolog.org/ftp/atlas/atlasbig.as";
sha256 = "1k8cy8gpcvkwkhyz248qhvrv5xiwp1n1s3b7rlz86krh7vzz01mp";
sha256 = "001bmqyldsbk4bdliqfl4a9ydrh1ff13wccvfniwaxlmvkridx2q";
};
in ''
mkdir -p $out/bin $out/astrolog
cp -r ${ephemeris}/*.se1 $out/astrolog
cp *.as $out/astrolog
install astrolog $out/bin
${lib.optionalString withBigAtlas "cp ${atlas} $out/astrolog/atlas.as"}
${lib.optionalString withEphemeris ''
sed -i "/-Yi1/s#\".*\"#\"$out/ephemeris\"#" $out/astrolog/astrolog.as
mkdir -p $out/ephemeris
cp -r ${ephemeris}/*.se1 $out/ephemeris
''}
${lib.optionalString withMoonsEphemeris ''
sed -i "/-Yi1/s#\".*\"#\"$out/ephemeris\"#" $out/astrolog/astrolog.as
mkdir -p $out/ephemeris
cp -r ${moonsEphemeris}/*.se1 $out/ephemeris
''}
'';
meta = with lib; {