GithubHelp home page GithubHelp logo

Feature request: Add nix build about elsa HOT 7 OPEN

elsaland avatar elsaland commented on May 12, 2024
Feature request: Add nix build

from elsa.

Comments (7)

littledivy avatar littledivy commented on May 12, 2024

@573 you need to run the bootstrap first.

go run ./bootstrap/

from elsa.

573 avatar 573 commented on May 12, 2024

With

# default.nix
{ stdenv, fetchFromGitHub, buildGoModule, go, go-bindata, go-bindata-assetfs }:

buildGoModule rec {
  pname = "elsa";
  version = "master";
  revision = "0375d76d2c802b497cec44e5069920643287cc98";
  goPackagePath = "github.com/elsaland/elsa";

  nativeBuildInputs = [ go go-bindata go-bindata-assetfs ];

  buildPhase = ''
    runHook preBuild
    # use make instead of go build
    runHook postBuild
    '';

  installPhase = ''
    runHook preInstall
    make build
    runHook postInstall
  '';

  src = fetchFromGitHub {
    owner = "elsaland";
    repo = "elsa";
    rev = revision;
    sha256 = "0ny2fsj7r05711d7k3xpl35k4pz86y2vnrk4bqqrdb5xqlh1i7aq";
  };

  doCheck = false;

  vendorSha256 = "1n3yj3p5nikbr5fwk44rpjk3wvay015k0gvl6pwdyx0yvpazrl4p";

  subPackages = [ "." ];

  meta = with stdenv.lib; {
    maintainer = with maintainers; [ ];
    license = licenses.mit;
    description = "Elsa is a minimal, fast and secure runtime for Javascript and Typescript written in Go";
  };
}

(go run ./bootstrap according to Makefile) I (still) get:

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/a5bg5xqns8lzal9a6f04sdc9d1pr1vjp-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
@nix { "action": "setPhase", "phase": "buildPhase" }
building
@nix { "action": "setPhase", "phase": "installPhase" }
installing
go run ./bootstrap
2020/09/30 08:37:51 Bundling 00_core.js
2020/09/30 08:37:51 Bundling 01_namespace.js
2020/09/30 08:37:51 Bundling 02_console.js
2020/09/30 08:37:51 Bundling 03_fetch.js
2020/09/30 08:37:51 Bundling 04_event.js
2020/09/30 08:37:51 Bundling 05_compiler.js
2020/09/30 08:37:51 Bundling 10_window.js
2020/09/30 08:37:51 Running command and waiting for it to finish...
2020/09/30 08:37:51 Command finished with error: exit status 1
go build -o elsa .
# github.com/elsaland/elsa/core
core/run.go:37:13: undefined: Asset
make: *** [Makefile:3: build] Error 2

from elsa.

littledivy avatar littledivy commented on May 12, 2024

Hmm looks like it is not perisisting the assets.go created by bootstrap at building. Can you try building on NixOS manually (make build) ?

I don't have much insight into how Nix works but I think building Elsa should be possible.

from elsa.

573 avatar 573 commented on May 12, 2024

@littledivy is it related to the 2020/09/30 08:37:51 Command finished with error: exit status 1 line maybe ?

EDIT: I added a find command to have assets.go's location printed directly after go run ./bootstrap:

{ stdenv, fetchFromGitHub, buildGoModule, go, go-bindata, go-bindata-assetfs, go2nix }:

buildGoModule rec {
  pname = "elsa";
  version = "master";
  revision = "0375d76d2c802b497cec44e5069920643287cc98";
  goPackagePath = "github.com/elsaland/elsa";

  nativeBuildInputs = [ go go-bindata go-bindata-assetfs go2nix ];

  buildPhase = ''
    runHook preBuild
    # run go run ./bootstrap manually
    go run ./bootstrap
    find . -path '*target' -print
    find . -path '*assets.go' -print
    # use make instead of go build
    runHook postBuild
    '';

  installPhase = ''
    runHook preInstall
    make
    runHook postInstall
  '';

  src = fetchFromGitHub {
    owner = "elsaland";
    repo = "elsa";
    rev = revision;
    sha256 = "0ny2fsj7r05711d7k3xpl35k4pz86y2vnrk4bqqrdb5xqlh1i7aq";
  };

  doCheck = false;

  vendorSha256 = "1n3yj3p5nikbr5fwk44rpjk3wvay015k0gvl6pwdyx0yvpazrl4p";

  subPackages = [ "." ];

  meta = with stdenv.lib; {
    maintainer = with maintainers; [ ];
    license = licenses.mit;
    description = "Elsa is a minimal, fast and secure runtime for Javascript and Typescript written in Go";
  };
}

Still no assets.go.

from elsa.

littledivy avatar littledivy commented on May 12, 2024

@573 I might've figured out the issue. Can you mkdir target. I think the bootstrap fails as it cannot create the path by itself.

from elsa.

573 avatar 573 commented on May 12, 2024

@littledivy when I add find . -path '*target' -print to the build clauses as in the edited comment above, I get:

these derivations will be built:
/nix/store/2bdw9cjkb89r51bkwqdanc9zzvngqlcp-elsa-master.drv
building '/nix/store/2bdw9cjkb89r51bkwqdanc9zzvngqlcp-elsa-master.drv'...
unpacking sources
unpacking source archive /nix/store/a5bg5xqns8lzal9a6f04sdc9d1pr1vjp-source
source root is source
patching sources
configuring
building
2020/09/30 11:56:16 Bundling 00_core.js
2020/09/30 11:56:16 Bundling 01_namespace.js
2020/09/30 11:56:16 Bundling 02_console.js
2020/09/30 11:56:16 Bundling 03_fetch.js
2020/09/30 11:56:16 Bundling 04_event.js
2020/09/30 11:56:16 Bundling 05_compiler.js
2020/09/30 11:56:16 Bundling 10_window.js
2020/09/30 11:56:16 Running command and waiting for it to finish...
2020/09/30 11:56:16 Command finished with error: exit status 1
./target
...

the target folder seems to be there already.

from elsa.

littledivy avatar littledivy commented on May 12, 2024

Alright, another reason could be go-bindata not being avaliable in your $GOSRC
go get github.com/go-bindata/go-bindata

PS: it needs to be retrieved via go get

from elsa.

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.