Last active
July 7, 2020 20:24
-
-
Save nh2/5d35a0a85948882baf992b6512290461 to your computer and use it in GitHub Desktop.
Packaging PTGui with nix
This file contains hidden or 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
# This is for installing ptgui conveniently via nix | |
# or into NixOS. | |
# Build using e.g.: | |
# | |
# nix-build -E '((import <nixpkgs> {}).callPackage (import ./ptgui-pro.nix) { })' | |
# | |
# and then run via | |
# | |
# result/bin/PTGui | |
# | |
# or alternatively add it to ~/.config/nixpkgs/config.nix like: | |
# | |
# { | |
# packageOverrides = pkgs: rec { | |
# ptgui-pro = pkgs.callPackage ./ptgui-pro.nix {}; | |
# | |
# myPackages = pkgs.buildEnv { | |
# name = "my-packages"; | |
# paths = [ | |
# ptgui-pro | |
# ]; | |
# pathsToLink = [ "/bin" ]; | |
# }; | |
# }; | |
# } | |
# | |
# and then using (e.g. on NixOS): | |
# | |
# nix-env -iA nixos.myPackages | |
{ | |
stdenv, | |
lib, | |
fetchurl, | |
autoPatchelfHook, | |
makeWrapper, | |
wrapGAppsHook, | |
cairo, | |
expat, | |
gdk-pixbuf, | |
glib, | |
gsettings-desktop-schemas, | |
gtk3, | |
libGL, | |
ocl-icd, | |
pango, | |
xlibs, | |
}: | |
stdenv.mkDerivation rec { | |
version = "12-beta9-trial"; | |
pname = "ptgui-pro"; | |
src = fetchurl { | |
url = "https://www.ptgui.com/downloads/118909/trial/linux/pro/18450/8d19f5ef3465fa1530d459ce90d78fbbe6075ff4182389afa2a05a48b43264ee/PTGui_Pro_12_beta_9_trial.tar.gz"; | |
sha256 = "0nnkg3ksrwhraraz8lf9ym5awblfkg7015mph35363ml2pv8gx8b"; | |
}; | |
sourceRoot = "."; | |
nativeBuildInputs = [ | |
autoPatchelfHook | |
makeWrapper | |
wrapGAppsHook | |
]; | |
buildInputs = [ | |
cairo | |
expat | |
gdk-pixbuf | |
glib | |
# `wrapGAppsHook` with `gtk3` fixes the GTK file open dialog, e.g. the error | |
# GLib-GIO-ERROR **: 15:24:37.738: Settings schema 'org.gtk.Settings.FileChooser' does not contain a key named 'show-type-column' | |
gtk3 | |
libGL # required for the PTGui Viewer | |
ocl-icd # for OpenCL | |
pango | |
stdenv.cc.cc.lib # for openmp | |
xlibs.libX11 | |
]; | |
dontConfigure = true; | |
dontBuild = true; | |
installPhase = '' | |
mkdir -p $out | |
cp -R * $out | |
mkdir $out/bin | |
ln -s ../PTGui $out/bin/PTGui | |
ln -s ../PTGuiViewer $out/bin/PTGuiViewer | |
''; | |
# Set `LC_ALL=C.UTF-8` to work around error popup showing: | |
# locale::facet::_S_create_c_locale name not valid | |
preFixup = '' | |
for program in "$out/bin/"*; do | |
wrapProgram "$program" --prefix LC_ALL : C.UTF-8 | |
done; | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment