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

[Feature Request] Allow adding a package from file system #668

Closed
amok opened this issue Feb 22, 2023 · 2 comments
Closed

[Feature Request] Allow adding a package from file system #668

amok opened this issue Feb 22, 2023 · 2 comments
Labels
feature New feature or request rfc Looking for feedback and comments

Comments

@amok
Copy link

amok commented Feb 22, 2023

It'd be nice to be able to install packages from nix files from local FS.

F.i.:

devbox add /path/to/default.nix
devbox add path/to/package

Usecases

Let say you have a small dev proxy server my-development-proxy-server written in node and It's not part of the main app. my-development-proxy-server/default.nix would be something like

# This is a minimal `default.nix` by yarn-plugin-nixify. You can customize it
# as needed, it will not be overwritten by the plugin.

{ pkgs ? import <nixpkgs> { } }:

pkgs.callPackage ./yarn-project.nix { } { src = ./.; }

Then shell.nix would look something like

let
  pkgs = import <nixpkgs> { };
  myDevelopemntProxyServer = import ./my-development-proxy-server;
  python = pkgs.python38;
  .....
in
pkgs.mkShell {
  packages = [
		python
		myDevelopemntProxyServer
		....
  ];
}

For the time being as far as I know it's not possible to devbox add ./my-development-proxy-server

Another use case is overriding package attrs. Is there a way to implement the following with devbox?:

let
  pkgs = import <nixpkgs> { };
  nginx = pkgs.nginx.override { modules = [ pkgs.nginxModules.njs ]; };
  nodejs = pkgs.nodejs-slim-14_x;
  yarn = pkgs.yarn.override { inherit nodejs; };
  ...

As an option, we could have yarn.nix like:

let
  pkgs = import <nixpkgs> { };
  nodejs = pkgs.nodejs-slim-14_x;
in
pkgs.yarn.override { inherit nodejs; }

and do devbox add ./yarn.nix


Unfortunately, this blocks me switching from "raw" nix to devbox (the tool looks very exciting)
Let me please know if I am missing something.

Similar issues: #267 #117 #21

PS Thank you for the awesome tool

@amok amok changed the title [Feature request] Allow adding a package from file system [Feature Request] Allow adding a package from file system Feb 22, 2023
@Lagoja
Copy link
Contributor

Lagoja commented Feb 22, 2023

Hey @amok, thanks for filing this issue. We really love the idea and have been discussing it within our team, since this could be a great bridge for existing nix projects to take advantage of Devbox.

We're reviewing the idea internally to see if we can slot it for an upcoming release.

@Lagoja Lagoja added feature New feature or request rfc Looking for feedback and comments labels Mar 14, 2023
@Lagoja
Copy link
Contributor

Lagoja commented Apr 6, 2023

See #866, which will allow developers to add local flakes as a source. Would be great to get your thoughts on what else to include.

@Lagoja Lagoja closed this as completed Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request rfc Looking for feedback and comments
Development

No branches or pull requests

2 participants