Hi, I’m trying to create a flake from a custom package build.
The setup is simple
{ lib, stdenv, buildGoModule, fetchFromGitHub, libobjc, IOKit, nixosTests }:
let
# A list of binaries to put into separate outputs
bins = [
"geth"
"clef"
];
in buildGoModule rec {
pname = "core";
version = "1.12.0";
src = fetchFromGitHub {
owner = "LarissaBlockchain";
repo = pname;
rev = "v${version}";
sha256 = "sha256-UbRsY9fSUYAwPcLfGGDHeqvSsLKUKR+2a93jH5xA9uQ=";
};
vendorHash = "sha256-dOvpOCMxxmcAaticSLVlro1L4crAVJWyvgx/JZZ7buE=";
doCheck = false;
outputs = [ "out" ] ++ bins;
# Move binaries to separate outputs and symlink them back to $out
postInstall = lib.concatStringsSep "\n" (
builtins.map (bin: "mkdir -p \$${bin}/bin && mv $out/bin/${bin} \$${bin}/bin/ && ln -s \$${bin}/bin/${bin} $out/bin/") bins
);
subPackages = [
"cmd/abidump"
"cmd/abigen"
"cmd/bootnode"
"cmd/clef"
"cmd/devp2p"
"cmd/ethkey"
"cmd/evm"
"cmd/faucet"
"cmd/geth"
"cmd/p2psim"
"cmd/rlpdump"
"cmd/utils"
];
# Following upstream: https://github.com/ethereum/go-ethereum/blob/ea9e62ca3db5c33aa7438ebf39c189afd53c6bf8/build/ci.go#L218
tags = [ "urfave_cli_no_docs" ];
# Fix for usb-related segmentation faults on darwin
propagatedBuildInputs =
lib.optionals stdenv.isDarwin [ libobjc IOKit ];
passthru.tests = { inherit (nixosTests) geth; };
meta = with lib; {
homepage = "https://geth.ethereum.org/";
description = "Official golang implementation of the Ethereum protocol";
license = with licenses; [ lgpl3Plus gpl3Plus ];
maintainers = with maintainers; [ RaghavSood ];
};
}
And then the flake.nix
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {self, nixpkgs, flake-utils } :
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
larissa = pkgs.callPackage ./larissa.nix { };
in {
devShell = pkgs.mkShell { buildInputs = [ larissa ]; };
});
}
This is the error that I get:
[vini@nixos:~/Workstation/larissa]$ nix develop
error:
… while calling the 'derivationStrict' builtin
at /builtin/derivation.nix:9:12: (source not available)
… while evaluating derivation 'nix-shell'
whose name attribute is located at /nix/store/n9yn7ayjjzgk9r2arawr0sb8mhb64y1z-source/pkgs/stdenv/generic/make-derivation.nix:331:7
… while evaluating attribute 'buildInputs' of derivation 'nix-shell'
at /nix/store/n9yn7ayjjzgk9r2arawr0sb8mhb64y1z-source/pkgs/stdenv/generic/make-derivation.nix:378:7:
377| depsHostHost = elemAt (elemAt dependencies 1) 0;
378| buildInputs = elemAt (elemAt dependencies 1) 1;
| ^
379| depsTargetTarget = elemAt (elemAt dependencies 2) 0;
error: evaluation aborted with the following error message: 'lib.customisation.callPackageWith: Function called without required argument "IOKit" at /nix/store/kivpsajmivdvy9ak212xl6i172xivqzf-source/larissa.nix:1'