Hi I am trying to fetch and build a dependency from GitHub. This is a required for a larger Cabal project, but I am trying to see if I can accomplish the following actions:
- fetch the repo from GitHub with a specific revision
- build a derivation (assuming the wrapper
flake-utils
should supportautogen.sh
andconfigure
) - store the build in the
/nix/store/
I have the following flake:
{
description = "Bitcoin core security protocol 256k1.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
with flake-utils.lib; eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in rec {
packages = {
secp256k1 = pkgs.stdenv.mkDerivation rec {
name = "secp256k1";
src = builtins.fetchGit {
url = "https://github.com/bitcoin-core/secp256k1";
rev = "ac83be33d0956faf6b7f61a60ab524ef7d6a473a";
};
};
gcc = pkgs.gcc;
buildPhase = ''
./autogen.sh && ./configure && make
'';
installPhase = ''
runHook preInstall
sudo make install
runHook postInstall
'';
};
defaultPackage = packages.secp256k1;
});
}
However, the flake failed to build because of the following error:
warning: Git tree '${PARENT_DIR}/deps/secp256k1' is dirty
error: builder for '/nix/store/izj2klinw7m21r6ly55vak7g2h79qs5l-secp256k1.drv' failed to produce output path for output 'out' at '/nix/store/6cyg84v638g5dddvc0bdaj698kihpc3k-secp256k1'
Context: I am new to Nix, only started diving into the ecosystem a couple weeks ago. I think I want to stick with flakes since I like to keep projects isolated into dev shells.