{
  self,
  nix-filter,
  pkgs,
}: let
  inherit (pkgs.lib) cleanSource;

  node_modules_attrs = {
    # Dependencies that should be available in the node build
    buildInputs = with pkgs; [
      pkg-config
      python3
      vips
      glib
    ];
  };

  # Dependencies that should be available outside of the node build
  buildInputs = with pkgs; [
    util-linux
  ];
in {
  package = pkgs.npmlock2nix.build {
    inherit buildInputs node_modules_attrs;

    src = cleanSource self;

    buildCommands = ["npm run build-dist"];

    installPhase = ''
      cp -r dist $out/
    '';
  };

  shell = pkgs.npmlock2nix.shell {
    inherit buildInputs node_modules_attrs;

    src = nix-filter {
      root = self;
      include = [
        "package.json"
        "package-lock.json"
      ];
    };
  };
}
