Hello! I’m fairly new to Nix, and I’m trying to write a derivation that will compile macaulay2, but I’ve run into an issue. If I’m understanding what’s going on correctly, it seems like it fails in the very beginning of the build phase, when it tries to git submodule update one of its dependencies.
Here’s the last 25 lines of the log:
configurePhase completed in 51 seconds
Running phase: buildPhase
make: Entering directory '/build/source/M2/BUILD/build'
: "checking for strings that look like undefined configure variables in all *.in files..."
: creating or removing symbolic link to common staging area, if necessary,
: based on comparison of these directories:
: pre_prefix : /build/source/M2/BUILD/build/usr-dist/common
: abs_builddir/usr-dist/common : /build/source/M2/BUILD/build/usr-dist/common
rm -f srcdir .link-test
echo "../../" >srcdir
rm -f M2
(echo '#! /bin/sh'; echo 'exec /build/source/M2/BUILD/build/usr-dist/x86_64-Linux-nixos/bin/M2 "$@"') >M2
chmod a+x M2
make -C libraries all
make[1]: Entering directory '/build/source/M2/BUILD/build/libraries'
make -C gc fetch
make[2]: Entering directory '/build/source/M2/BUILD/build/libraries/gc'
git submodule update --init /build/source/M2/BUILD/build/../../submodules/bdwgc
error: pathspec '/build/source/M2/BUILD/build/../../submodules/bdwgc' did not match any file(s) known to git
make[2]: *** [../Makefile.library:137: update-submodule] Error 1
make[2]: Leaving directory '/build/source/M2/BUILD/build/libraries/gc'
make[1]: *** [Makefile:7: fetch-in-gc] Error 2
make[1]: Leaving directory '/build/source/M2/BUILD/build/libraries'
make: *** [Makefile:57: all-in-libraries] Error 2
make: Leaving directory '/build/source/M2/BUILD/build'
And this is the contents of the derivation:
{ pkgs, ... }: (let
boost-static = (pkgs.boost.override {
enableShared = false;
enableStatic = true;
});
in (pkgs.stdenv.mkDerivation rec {
pname = "macaulay2";
version = "1.25.06";
# cf. [[https://github.com/NixOS/nixpkgs/issues/195117#issuecomment-1410398050]]
src = ((pkgs.fetchFromGitHub {
owner = "Macaulay2";
repo = "M2";
rev = "2cb101f52dfdd3abe788f2d5e1d0248adeb10b32";
fetchSubmodules = true;
leaveDotGit = true;
hash = "sha256-BU01garuNkyH7Z8AOD4EjgkggqJpMqANFdDUmJmwxm8=";
}).overrideAttrs (old-attrs: {
env = old-attrs.env or {} // {
GIT_CONFIG_COUNT = 1;
GIT_CONFIG_KEY_0 = "url.https://github.com/.insteadOf";
GIT_CONFIG_VALUE_0 = "git@github.com:";
};
}));
buildInputs = with pkgs; [
autoconf
automake
bison
boost-static
cddlib
cmake
eigen
fflas-ffpack
flex
flint
gcc
gfortran
gfan
git
givaro
glpk
gtest
icu
libffi
libtool
libxml2
libz
lrs
mpfi
nauty
ncurses
normaliz
ntl
openblas
patch
pkg-config
python3
singular
texinfo
time
wget
which
xz
];
configurePhase = ''
cd M2/BUILD/build
../../autogen.sh
../../configure --enable-shared --enable-download --with-issue='nixos' \
--with-boost-libdir=${boost-static.out}/lib
'';
buildPhase = ''
make
'';
installPhase = ''
mkdir -p $out/bin
mv M2 $out/bin
'';
}))
(Sorry if there are any formatting issues; this is my first post here!)