Hey everyone, I am trying to debug an issue with Nix, where I am trying to install a new package. I am using opam-nix to manage my dependencies automatically in Nix. However, I added a new package called timedesc and ran into the issue
error: builder for '/nix/store/2xrb8jjl70y9bph3340fhc6yp8yi5yfc-timedesc-tzdb-2.0.0.drv' failed with exit code 1;
last 3 log lines:
> unpacking sources
> unpacking source archive /nix/store/7vk36zdb2sfy4x6sv7grfm87jgq414hk-timedesc-2.0.0.tar.gz
> unpacker produced multiple directories
For full logs, run 'nix log /nix/store/2xrb8jjl70y9bph3340fhc6yp8yi5yfc-timedesc-tzdb-2.0.0.drv'.
My nix config looks like this:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
opam-nix.url = "github:tweag/opam-nix";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.follows = "opam-nix/nixpkgs";
};
outputs = { self, flake-utils, opam-nix, nixpkgs }@inputs:
let package = "fixgen";
in flake-utils.lib.eachDefaultSystem (system:
let
sourceRoot = ".";
pkgs = nixpkgs.legacyPackages.${system};
on = opam-nix.lib.${system};
devPackagesQuery = {
ocaml-lsp-server = "*";
ocamlformat = "*";
ocamlfind = "1.9.5";
utop = "*";
};
query = devPackagesQuery // {
ocaml-base-compiler = "*";
};
scope = on.buildOpamProject' { } ./. query;
overlay = final: prev: {
# You can add overrides here
${package} = prev.${package}.overrideAttrs (_: {
});
};
scope' = scope.overrideScope' overlay;
# The main package containing the executable
main = scope'.${package};
# Packages from devPackagesQuery
devPackages = builtins.attrValues
(pkgs.lib.getAttrs (builtins.attrNames devPackagesQuery) scope');
in {
legacyPackages = scope';
packages.default = main;
devShells.default = pkgs.mkShell {
inputsFrom = [ main ];
buildInputs = devPackages ++ [
];
};
});
}
Googling around, it seems it might have something to do with the sourceRoot=“.” parameter missing, but I am not sure where and how to add it when using something like opam-nix on top. Any pointers?