Giter Site home page Giter Site logo

RFC: File based config about nixpacks HOT 5 CLOSED

coffee-cup avatar coffee-cup commented on July 25, 2024
RFC: File based config

from nixpacks.

Comments (5)

aleksrutins avatar aleksrutins commented on July 25, 2024

Would it be feasible to do this through a .nix file? In my opinion, the declarative configuration syntax is one of Nix's greatest strengths, and it would be great to integrate that with Nixpacks. I don't know how it would be implemented, and I don't know that much about Nix, but I was thinking about something along these lines in terms of syntax:

{stdenv, nixpacks}: rec {
  derivation = stdenv.mkDerivation {
    # ...
  };
  deploy = nixpacks.configure {
    inherit derivation;
    startCommand = "./whatever";
    # Since the package is already built by the derivation, you shouldn't need a separate build command here
  };
}

Or something like that.

from nixpacks.

coffee-cup avatar coffee-cup commented on July 25, 2024

That could work. And I do think it is a good idea to be able to import/build Nix projects with zero-config. However, I am not sure this is the right approach for all projects. Ideally, users can use all features of Nixpacks without having to know and understand the Nix expression language (see core ideas in readme). This is also something you have to opt into completely and means that if you want to save the start command to version control you will have to also figure out how to build your app with Nix and cannot take advantage of the providers.

That being said, looking for and building a default.nix or a flake.nix is a great idea. We could have a NixProvider that does this.

from nixpacks.

aleksrutins avatar aleksrutins commented on July 25, 2024

An idea: if Nixpacks were to export some sort of interface to Nix expressions, then would it be possible to also export the providers? Maybe even provide some sort of wrapper around mkDerivation, to allow the user to have the best of both worlds (zero-config Nix expressions)? Something like this, maybe:

{nixpacks, stdenv, myDependency}:
nixpacks.mkDerivation {
  # All options are optional; `extends` would default to stdenv, most likely.
  extends = stdenv;
  buildCommand = "whatever";
  runCommand = "./whatever";
  packages = [ myDependency ];
}

That might take whatever the extends option is and then wrap extends.mkDerivation with the required build steps and dependencies.

from nixpacks.

coffee-cup avatar coffee-cup commented on July 25, 2024

Oh yeah that is a neat idea. It would allow us to leverage the Nix ecosystem a bit more too. I'll play around with it.

from nixpacks.

 avatar commented on July 25, 2024

Moved to discussions (#120)

from nixpacks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.