Skip to content

Feature request. More options to the default.nix #339

@relief-melone

Description

@relief-melone

Hey,

i am still pretty new to the contributing part of NixOS and the derivations. I am trying to create a nix vimPlugin for vscode-js-debug. I have stumbled over various buildInputs missing. In the readme I saw how to override it for specific packages. I was wondering if it would be a viable option to have something like additionalBuildInputs as well as additionalNativeBuildInputs added to the default.nix which would be inherited to the node-env.nix file. So something like this

default.nix

{pkgs ? import <nixpkgs> {
  inherit system;
}, system ? builtins.currentSystem, 
  nodejs ? pkgs."nodejs_18"
  additionalBuildInputs ? []
  additionalNativeBuildInputs * []
}:

let
nodeEnv = import ./node-env.nix {
  inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
  inherit pkgs nodejs additionalBuildInputs additonalNativeBuildInputs;
  libtool = if pkgs.stdenv.isDarwin then pkgs.cctools or pkgs.darwin.cctools else null;
};

#...

node-env.nix

#...
stdenv.mkDerivation ({
      name = "node-shell-${name}${if version == null then "" else "-${version}"}";
      
      nativeBuildInputs = [] ++ additionalNativeBuildInputs;
      buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs ++ additionalBuildInputs;
#...

There might have been some good reasons for not doing this but if not I think it would make it more accessible to tailor the build process for the end user of node2nix. In any case the project is a great contribution. Thanks for the effort put into this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions