Giter Club home page Giter Club logo

Comments (10)

DavHau avatar DavHau commented on June 26, 2024

Yes I think something like that might be a good idea. I mean, the cleaner solution would probably be to build these binaries from source if the source is vendored.

from dream2nix.

happysalada avatar happysalada commented on June 26, 2024

Here is what I think we should do.
have an override for minor versions that all patch versions will use.
Something like

 "add-binary-0.12" = {
        _condition = pkg: (lib.versionAtLeast pkg.version "0.12") && (lib.versionOlder pkg.version "0.13");
        ESBUILD_BINARY_PATH = let
          esbuild = pkgs.buildGoModule rec {
            pname = "esbuild";
            # using 0.12 latest version
            version = "0.12.17";

            src = pkgs.fetchFromGitHub {
              owner = "evanw";
              repo = "esbuild";
              rev = "v${version}";
              sha256 = "sha256-wZOBjNOgGmwIQNCrhzwGPmI/fW/yZiDqq8l4oSDTvZs=";
            };

            vendorSha256 = "sha256-2ABWPqhK2Cf4ipQH7XvRrd+ZscJhYPc3SV2cGT0apdg=";
          };
        in "${esbuild}/bin/esbuild";
      };

then we have one override for each "major" version. The api supposedly is compatible. So we should have only 3-4 versions that we need to write by hand that would be valid for everything.

If that sounds good to you, happy to give it a go in a PR.

from dream2nix.

DavHau avatar DavHau commented on June 26, 2024

Wonderful, I think this is a good approach.
You could shorten the condition by using satisfiesSemver "~0.12"

from dream2nix.

happysalada avatar happysalada commented on June 26, 2024

how do I get access from the satisfiesSemver function from outside of dream2nix. I wanted to test on a flake directly before submitting a merge request.
I tried checking into dlib, but didn't find a path after that. And nix repl . complains that there is no default.nix in the repo
dlib = inputs.dream2nix.lib.dlib.
I'm going to make an MR and work off the branch for now, but would be nice to have an example in the readme of how to access the satisfiesSemver function from an outside flake.

from dream2nix.

DavHau avatar DavHau commented on June 26, 2024

satisfiesSemver is currently not in dlib. I will put it there soon.
For now it can be used like this:

nix-repl> :lf ./.
Added 17 variables.

nix-repl> lib.x86_64-linux.utils.satisfiesSemver
«lambda @ /nix/store/jrsj7h4ibxlfiv99i5sxmiid3ixmjc8c-source/semver.nix:81:21»

from dream2nix.

happysalada avatar happysalada commented on June 26, 2024

nix repl complains for me that there is no default.nix probably my nix is too old.
oh, no, you just have to nix repl flake.nix, okay my brain is not working.
found the repl and learned about :lf
I've just submitted a PR for esbuild 0.14, I'll be doing more as I encounter them.
I think this can be closed for now.
Thanks for the help!

from dream2nix.

happysalada avatar happysalada commented on June 26, 2024

It's probably not the end for this one
Cannot start service: Host version "0.14.23" does not match binary version "0.14.38"
I'm looking for a way to de-activate the version check.

from dream2nix.

happysalada avatar happysalada commented on June 26, 2024

I've got a PR ready

from dream2nix.

happysalada avatar happysalada commented on June 26, 2024

also, last question, in the flake overrides, how will I access the pkgs representing nixpkgs. Do you re-export it or is my best alternative to do
pkgs = import inputs.dream2nix.inputs.nixpkgs { system = "x86_64-darwin"; };

was also thinking it would be good to include in the example flakes comment a more involved override just to give a good sense of how to do it.

from dream2nix.

DavHau avatar DavHau commented on June 26, 2024

No need to re-import nixpkgs if you don't use overlays (see: https://zimbatm.com/notes/1000-instances-of-nixpkgs). You can access it via:
inputs.dream2nix.inputs.nixpkgs.legacyPackages.x86_64-darwin.

Yes, I think it would be an amazing idea to add an example flake to the readme that uses all possible features and is commented.

from dream2nix.

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.