Error: attribute 'libpcap' missing

my error:

sudo nixos-rebuild switch
 │building Nix...
 │building the system configuration...
 │error: attribute 'libpcap' missing
 │
 │       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:512:28:
 │
 │          511|         builtins.addErrorContext (context 
 │          512|           (args.${name} or config._module.args.${name})
               |                            ^
            513|       ) (lib.functionArgs f);

my proxy-service.nix

{ config, pkgs, libpcap, … }:

let dhcpproxy = pkgs.buildGoModule rec {
pname = “dhcpproxy”;
version = “6.0.8”
src = fetchGit {
url = “ssh://buildingbot@mygiturl”;
rev = “77f1e25e11309a32f9657436341eedd31e110e”;
ref = “v6.0.8”;
};
subPackages = [ “proxy” ];
buildInputs = [ libpcap ];
vendorSha256 = “sha256-z/a2YIcdjdjdcziFHHjfgdfdgXwUsjHowPQv93VicmF4+E=”;
};
in
{
config = {
systemd.services.proxy = {
description = “proxy”;
serviceConfig = {
Type = “simple”;
ExecStart = “${proxy}/bin/proxy”;
Restart = “on-failure”;
};
wantedBy = [ “multi-user.target” ];
};
};
}

I used to import above file in /etc/nixos/configuration.nix and run nixos-rebuild switch
what I am missing here??? please help

@abathur could you please help

libcap is not a module import, you find it under pkgs.libpcap.

2 Likes

I need to declare

nixpkgs = import <nixpkgs> {};
inherit (nixpkgs) libpcap;

inside the let in derivation