Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: The option `public.drvPath' is used but not defined. #1025

Open
winston0410 opened this issue Jul 20, 2024 · 2 comments
Open

error: The option `public.drvPath' is used but not defined. #1025

winston0410 opened this issue Jul 20, 2024 · 2 comments

Comments

@winston0410
Copy link

I have a flake like this, where there is a simple npm project(it is sveltekit, but doesn't matter I guess) in the root directory

{
  description = "closesource repo flake";

  inputs = {
    dream2nix.url = "github:nix-community/dream2nix";
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixpkgs-24.05-darwin";
    unstable.url = "github:nixos/nixpkgs?ref=nixpkgs-unstable";

    flake-utils.url =
      "github:numtide/flake-utils?rev=ff7b65b44d01cf9ba6a71320833626af21126384";
  };

  outputs = { self, nixpkgs, unstable, flake-utils, dream2nix, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs {
          inherit system;
          overlays = [ ];
        };

        unstablePkgs = unstable.legacyPackages.${system};

        buildInputs = with pkgs; [
          nodejs_20
          deno
        ];
      in {
        packages = {
          defaultPackage = pkgs.buildEnv {
            name = "ezdrop";
            paths = buildInputs;
          };

          sveltekit = dream2nix.lib.evalModules {
            packageSets.nixpkgs = nixpkgs.legacyPackages.${system};
            modules = [
              {
                paths.projectRoot = ./.;
                paths.projectRootFile = "flake.nix";
                paths.package = ./.;
              }
            ];
          };
        };

        devShell = (({ pkgs, ... }:
          pkgs.mkShell {
            buildInputs = buildInputs;

            shellHook = ''

            '';
          }) { inherit pkgs; });
      });
}

When I run nix build .#sveltekit, I get the following error:

warning: Git tree '/Users/hugosum/Desktop/ezdrop' is dirty
error:
       … while calling the 'head' builtin

         at /nix/store/g2ysyzdx76m4z7lnmyddcwdz25lx7kn1-source/lib/attrsets.nix:1575:11:

         1574|         || pred here (elemAt values 1) (head values) then
         1575|           head values
             |           ^
         1576|         elsewhile evaluating the attribute 'value'

         at /nix/store/g2ysyzdx76m4z7lnmyddcwdz25lx7kn1-source/lib/modules.nix:821:9:

          820|     in warnDeprecation opt //
          821|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          822|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: The option `public.drvPath' is used but not defined.

Do I need to define drvPath myself? Where should I do that?

@winston0410
Copy link
Author

My nix version is
❯ nix --version
nix (Nix) 2.17.0

@DavHau
Copy link
Member

DavHau commented Jul 20, 2024

You need to import a module like nodejs-package-lock-v3, etc. See some examples under dream2nix/examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants