Error installing custom package

I’m trying to install Nord VPN on NixOS from their provided .deb release. It isn’t on Nixpkgs (although I could add it once I get this working), so for now I’m using a local package definition. I’m starting out with a super simple package definition:

{ stdenv
, lib
, fetchurl

stdenv.mkDerivation rec {
  pname = "nord-vpn";
  version = "1.0.0";

  src = fetchurl {
    url = "";
    sha256 = "0qqbfzk0428a97h5n1i9m2gzmwrbx1fj62pmqllwchk56ag0il04";

  meta = with lib; {
    homepage = "";
    description = "Client for Nord VPN";
    platforms = [ "x86_64-linux" ];

I include this in my configuration.nix by doing:

nixpkgs.config.packageOverrides = pkgs: import ./packages pkgs;
environments.systemPackages = [ pkgs.nord-vpn ];

Where ./packages/default.nix is:


  nord-vpn = pkgs.callPackage ./nord-vpn { };

I think I understand everything in here so far, but when I try to build this I just get an error:

error: getting status of '/etc/nixos/packages/nord-vpn': No such file or directory

There must be something fundamental I’m missing here. Why is it looking for an existing file for a totally new package I’ve defined? Is this the right way to create a totally new package locally?

I did a bit more searching 1 2 and now I think overlays is what I should be using? I tried changing to

nixpkgs.overlays = [ import ./packages ];


self: super:

  nord-vpn = super.callPackage ./nord-vpn { };

but now I just get error: infinite recursion encountered, at undefined position.

Okay I fixed the infinite recursion by doing

nixpkgs.overlays = [ (import ./packages) ];

but now I’m getting the other error again about /etc/nixos/packages/nord-vpn being missing.

Resolved that, I had to import it like ./nord-vpn.nix instead of ./nord-vpn.

Could you post the final solution, we can just copy and paste the configuration easily?

Sorry I didn’t really get any further with this. Someone else is already working on adding a package for NordVPN though: Add NordVPN Package and Module by juliosueiras · Pull Request #132082 · NixOS/nixpkgs · GitHub