Created
November 24, 2018 16:05
-
-
Save FeepingCreature/cacd64155882c4ea8e54dc9fcef766ba to your computer and use it in GitHub Desktop.
replace _ with /
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
imports = | |
[ | |
... | |
./python-override-setup.nix | |
... | |
]; | |
... | |
nixpkgs.overlays = [ | |
(import ./overlays/uranium.nix) | |
(import ./overlays/arcus.nix) | |
(import ./overlays/savitar.nix) | |
(import ./overlays/curaengine.nix) | |
(import ./overlays/cura.nix)]; | |
... | |
environment.systemPackages = with pkgs; [ | |
... | |
cura | |
... | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self: super: | |
{ | |
pythonOverrides = super.buildPythonOverrides (python-self: python-super: { | |
libarcus = python-super.libarcus.overridePythonAttrs (oldAttrs: rec { | |
version = "3.6.0"; | |
src = super.fetchFromGitHub { | |
owner = "Ultimaker"; | |
repo = "libArcus"; | |
rev = version; | |
sha256 = "1zbp6axai47k3p2q497wiajls1h17wss143zynbwbwrqinsfiw43"; | |
}; | |
}); | |
}) super.pythonOverrides; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let unstable = import <unstable> {}; in | |
self: super: | |
{ | |
cura = super.cura.overrideAttrs (oldAttrs: with self; rec { | |
name = "cura-${version}"; | |
version = "3.6.0"; | |
src = fetchFromGitHub { | |
owner = "Ultimaker"; | |
repo = "Cura"; | |
rev = version; | |
sha256 = "0wzkbqdd1670smw1vnq634rkpcjwnhwcvimhvjq904gy2fylgr90"; | |
}; | |
materials = fetchFromGitHub { | |
owner = "Ultimaker"; | |
repo = "fdm_materials"; | |
rev = "3.6.0"; | |
sha256 = "0g2dkph0ll7d9109n17vmfwb4fpc8lhyb1z1q68j8vblyvg08d12"; | |
}; | |
propagatedBuildInputs = with python3Packages; [ | |
libsavitar uranium | |
] ++ (with unstable.python3.pkgs; [ | |
requests shapely zeroconf pyserial | |
numpy-stl | |
]); | |
cmakeFlags = [ | |
"-DURANIUM_DIR=${self.python3.pkgs.uranium.src}" | |
"-DCURA_VERSION=${version}" | |
]; | |
}); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self: super: | |
{ | |
curaengine = super.curaengine.overrideAttrs (oldAttrs: with self; rec { | |
name = "curaengine-${version}"; | |
version = "3.6.0"; | |
src = fetchFromGitHub { | |
owner = "Ultimaker"; | |
repo = "CuraEngine"; | |
rev = version; | |
sha256 = "1iwmblvs3qw57698i8bbazyxha18bj9irnkcscdb0596g8q93fcm"; | |
}; | |
patches = []; | |
buildInputs = with python3Packages; [ libarcus stb ]; | |
cmakeFlags = [ "-DCURA_ENGINE_VERSION=${version}" ]; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self: super: { | |
pythonOverrides = super.buildPythonOverrides (python-self: python-super: with self; with python-self; { | |
libsavitar = python-super.buildPythonPackage rec { | |
pname = "libsavitar"; | |
version = "3.6.0"; | |
format = "other"; | |
src = fetchFromGitHub { | |
owner = "Ultimaker"; | |
repo = "libSavitar"; | |
rev = version; | |
sha256 = "1bz8ga0n9aw65hqzajbr93dcv5g555iaihbhs1jq2k47cx66klzv"; | |
}; | |
disabled = pythonOlder "3.4.0"; | |
propagatedBuildInputs = [ sip protobuf ]; | |
nativeBuildInputs = [ cmake ]; | |
postPatch = '' | |
# To workaround buggy SIP detection which overrides PYTHONPATH | |
sed -i '/SET(ENV{PYTHONPATH}/d' cmake/FindSIP.cmake | |
''; | |
meta = with stdenv.lib; { | |
description = "libSavitar is a c++ implementation of 3mf loading with SIP python bindings."; | |
homepage = https://github.com/Ultimaker/libSavitar; | |
license = licenses.agpl3; | |
platforms = platforms.linux; | |
# maintainers = with maintainers; [ abbradar ]; | |
}; | |
}; | |
}) super.pythonOverrides; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let unstable = import <unstable> {}; in | |
self: super: { | |
pythonOverrides = super.buildPythonOverrides (python-self: python-super: with self; with python-self; { | |
uranium = python-super.uranium.overridePythonAttrs (oldAttrs: rec { | |
version = "3.6.0"; | |
src = fetchFromGitHub { | |
owner = "Ultimaker"; | |
repo = "Uranium"; | |
rev = version; | |
sha256 = "02hid13h8anb9bgv2hhrcdg10bxdxa9hj9pbdv3gw3lpn9r2va98"; | |
}; | |
propagatedBuildInputs = [ libarcus ] ++ (with unstable.python3.pkgs; [ pyqt5 numpy scipy ]); | |
postPatch = '' | |
sed -i 's,/python''${PYTHON_VERSION_MAJOR}/dist-packages,/python''${PYTHON_VERSION_MAJOR}.''${PYTHON_VERSION_MINOR}/site-packages,g' CMakeLists.txt | |
sed -i \ | |
-e "s,Resources.addSearchPath(os.path.join(os.path.abspath(os.path.dirname(__file__)).*,Resources.addSearchPath(\"$out/share/uranium/resources\")," \ | |
-e "s,self._plugin_registry.addPluginLocation(os.path.join(os.path.abspath(os.path.dirname(__file__)).*,self._plugin_registry.addPluginLocation(\"$out/lib/uranium/plugins\")," \ | |
UM/Application.py | |
sed -i -e "s,self.closing.connect(self.preClosing),," UM/Qt/Bindings/MainWindow.py | |
''; | |
}); | |
}) super.pythonOverrides; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see https://github.com/NixOS/nixpkgs/issues/44426 | |
{ config, lib, pkgs, ... }: | |
{ | |
# Setup for https://github.com/NixOS/nixpkgs/issues/44426 python | |
# overrides not being composable... | |
nixpkgs.overlays = lib.mkBefore [ | |
(self: super: let | |
pyNames = [ | |
"python27" "python34" "python35" "python36" "python37" | |
"pypy" | |
]; | |
overriddenPython = name: [ | |
{ inherit name; value = super.${name}.override { packageOverrides = self.pythonOverrides; }; } | |
{ name = "${name}Packages"; value = super.recurseIntoAttrs self.${name}.pkgs; } | |
]; | |
overriddenPythons = builtins.concatLists (map overriddenPython pyNames); | |
in { | |
pythonOverrides = pyself: pysuper: {}; | |
# The below is just a wrapper for clarity of intent, use like: | |
# pythonOverrides = buildPythonOverrides (pyself: pysuper: { ... # overrides }) super.pythonOverrides; | |
buildPythonOverrides = newOverrides: currentOverrides: super.lib.composeExtensions newOverrides currentOverrides; | |
} // builtins.listToAttrs overriddenPythons) | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment