I try to build solvespace for my own fork GitHub - nobodyinperson/solvespace: Parametric 2d/3d CAD with this solvespace.nix
mostly copied from nixpkgs:
{ lib
, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, wrapGAppsHook4
, at-spi2-core
, cairo
, dbus
, eigen
, freetype
, fontconfig
, glew
, gtkmm3
, json_c
, libdatrie
, libepoxy
, libGLU
, libpng
, libselinux
, libsepol
, libspnav
, libthai
, libxkbcommon
, pangomm
, pcre
, util-linuxMinimal # provides libmount
, xorg
, zlib
}:
stdenv.mkDerivation rec {
pname = "solvespace";
version = "3.1";
# from nixpkgs
# src = fetchFromGitHub {
# owner = pname;
# repo = pname;
# rev = "v${version}";
# hash = "sha256-sSDht8pBrOG1YpsWfC/CLTTWh2cI5pn2PXGH900Z0yA=";
# fetchSubmodules = true;
# };
src = fetchFromGitHub {
owner = "nobodyinperson"; # my fork
repo = pname;
rev = "b3e703c222beaae3f03c60b5d7a6e45cf14cfd29"; # master 14.03.2024
hash = "sha256-5tALOyFVzJgUb2hnlr+2XfqZ9PZO559vCBAji6Qs2nY=";
fetchSubmodules = true;
};
nativeBuildInputs = [
cmake
pkg-config
wrapGAppsHook4
];
buildInputs = [
at-spi2-core
cairo
dbus
eigen
freetype
fontconfig
glew
gtkmm3
json_c
libdatrie
libepoxy
libGLU
libpng
libselinux
libsepol
libspnav
libthai
libxkbcommon
pangomm
pcre
util-linuxMinimal
xorg.libpthreadstubs
xorg.libXdmcp
xorg.libXtst
zlib
];
postPatch = ''
patch CMakeLists.txt <<EOF
@@ -20,9 +20,9 @@
# NOTE TO PACKAGERS: The embedded git commit hash is critical for rapid bug triage when the builds
# can come from a variety of sources. If you are mirroring the sources or otherwise build when
# the .git directory is not present, please comment the following line:
-include(GetGitCommitHash)
+# include(GetGitCommitHash)
# and instead uncomment the following, adding the complete git hash of the checkout you are using:
-# set(GIT_COMMIT_HASH 0000000000000000000000000000000000000000)
+set(GIT_COMMIT_HASH $version)
EOF
'';
cmakeFlags = [ "-DENABLE_OPENMP=ON" ];
meta = with lib; {
description = "A parametric 3d CAD program";
license = licenses.gpl3Plus;
maintainers = [ maintainers.edef ];
platforms = platforms.linux;
homepage = "https://solvespace.com";
changelog = "https://github.com/solvespace/solvespace/raw/v${version}/CHANGELOG.md";
};
}
I build it like this:
nix-build -E 'with import <nixpkgs> {}; callPackage ./solvespace.nix {}'
# ...
# fatal: dumb http transport does not support shallow capabilities
# ...
# Failed to clone 'extlib/freetype' a second time, aborting
# ...
# [then sha256 mismatch]
… it seems to have a problem with the extlib/freetype
submodule which seems to be hosted on a dumb git remote which doesn’t support shallow clones. But even with deepClone=true
it works sometimes but not all the time stopped working a while ago as one constantly runs into hash mismatches. deepClone=true
is also painfully slow.
The same happens for nixpkgs’ own solvespace btw:
# prefetch all dependencies for solvespace
nix-shell -p solvespace --run ''
# delete only the source archive
nix-store --delete "$(nix eval --impure --raw --expr '(let pkgs = import <nixpkgs> {}; in "${toString pkgs.solvespace.src}")')"
# then rebuild solvespace without the cache
nix-build --no-substitute -E 'with import <nixpkgs> {}; solvespace'
# ...
# fatal: dumb http transport does not support shallow capabilities
# ...
# Failed to clone 'extlib/freetype' a second time, aborting
# ...
# [then sha256 mismatch]
So apparently Hydra (or whatever builds cache.nixos.org) has some extra magic in place that manages to build the source archive including the submodules.
I’d like to see the Hydra logs for the source archive only, but I can’t find it. Here in the log for solvespace it just says that it fetches the source from the cache, wow that doesn’t help…
unpacking source archive /nix/store/9mnamza2ixl64p5hla4q82pl8kfd0mxn-source