Skip to content

Instantly share code, notes, and snippets.

@dtzWill
Last active June 22, 2017 15:29
Show Gist options
  • Save dtzWill/7c348429978b6f3212403d944c7117c2 to your computer and use it in GitHub Desktop.
Save dtzWill/7c348429978b6f3212403d944c7117c2 to your computer and use it in GitHub Desktop.
panda3d nix IRC help
with import <nixpkgs> {};
callPackage ./python.nix { pythonPackages = python3Packages; }
{ pkgs, pythonPackages }:
with builtins;
with pythonPackages;
with { inherit (pkgs) lib; };
let removeNulls = lib.filterAttrs (n: v: v != null);
srcHelper = url: sha256: curlOpts: name:
assert url != null;
assert sha256 != null;
pkgs.fetchurl (removeNulls { inherit url sha256 name curlOpts; });
mkPython =
{ packageName # < A package name.
, version # < A package version.
, srcURL ? null # < A url to download from.
, srcSHA ? null # < A SHA256 checksum for the download.
, srcName ? null # < A name for the downloaded file.
, srcCurlOpts ? null # < A curl options for the download.
, src ? null # < A source to use (overrides other options).
, buildDeps ? [] # < Build dependencies to add.
, propDeps ? [] # < Propagated dependencies to add.
, nativeBuildDeps ? [] # < Native build dependencies to add.
, nativePropDeps ? [] # < Native propagated dependencies to add.
# The following attributes are equivalent to those in meta:
, homepage ? null # < A homepage of the project.
, description ? null # < A description.
, longDescription ? null # < A longer description.
, maintainers ? null # < A list of maintainers.
, license ? null # < A license.
, platforms ? null # < A list of supported platforms.
, ... # Any other options will be passed to buildPythonPackage directly
} @ args:
buildPythonPackage (removeNulls ({
name = "${packageName}-${version}";
src = if isNull src
then srcHelper srcURL srcSHA srcCurlOpts srcName
else src;
buildInputs = buildDeps;
propagatedBuildInputs = propDeps;
nativeBuildInputs = nativeBuildDeps;
propagatedNativeBuildInputs = nativePropDeps;
meta = removeNulls {
inherit homepage description longDescription
license maintainers platforms;
};
} // args));
isNonEmptyString = x: stringLength x > 0;
strHead = x: (assert isNonEmptyString x; substring 0 1 x);
pypiURL = name: version:
assert isNonEmptyString name;
assert isNonEmptyString version;
"mirror://pypi/${strHead name}/${name}/${name}-${version}.tar.gz";
in pythonPackages // (rec {
# bobbuilder = pkgs.callPackage ./bobbuilder {};
# No longer used, Theano was finally added to nix main channel
# theano-deep = mkPython (rec {
# packageName = "theano-deep";
# version = "0.8.2";
# srcURL = pypiURL "Theano" version;
# srcSHA = "0c49mz3bg57vigkyfz3yd6302587hsikhvgkh7w7ny0sxpvwhqvl";
# propDeps = with pkgs; [ six scipy ];
# homepage = http://deeplearning.net/software/theano/;
# description = "Optimizing compiler for evaluating mathematical expressions on CPUs and GPUs.";
# license = null;#lib.licenses.bsd;
# maintainers = null;
# platforms = with lib.platforms; all;
#
# });
# panda3d = pkgs.stdenv.mkDerivation (rec {
panda3d = mkPython (rec {
packageName = "panda3d";
version = "1.10.0";
src = ./panda3d;
propDeps = with pkgs; [ ];
homepage = "https://www.panda3d.org";
description = "Panda3D for python3";
license = null;
maintainers = null;
platforms = with lib.platforms; all;
doCheck = false;
#name = "panda3d";
#buildInputs = [ pkgs.python3 ];
buildPhase = ''
python3 makepanda/makepanda.py --everything --no-egl --no-gles --no-gles2 --no-opencv --wheel --threads ''${NIX_BUILD_CORES:-1}
mkdir dist
mv panda3d-1.10.0-cp35-cp35m-linux_x86_64.whl dist
'';
postInstall = ''
ln -s ${pkgs.stdenv.cc.cc.lib}/lib/libstdc++.so.6 $out/lib/python3.5/site-packages/panda3d/
'';
# rpath pain
# dontPatchELF = true;
#installPhase = ''
# mv dist $out
#'';
});
})
let
inherit (import <nixpkgs> {}) stdenv;
inherit (import ./default.nix) panda3d;
in stdenv.mkDerivation {
name = "test";
buildInputs = [ panda3d ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment