-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
encore: init at version 1.39.0 #328519
base: master
Are you sure you want to change the base?
encore: init at version 1.39.0 #328519
Conversation
05a0f04
to
f2db02d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, @luisnquin 🙂
Please find below a few questions and suggestions for improvement.
If you wanted to go above and beyond, please consider formatting the files using nixfmt.
pkgs/by-name/en/encore/package.nix
Outdated
name = "${pname}-source"; | ||
owner = "encoredev"; | ||
repo = pname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid superfluous use of pname
(for details see #277994)
name = "${pname}-source"; | |
owner = "encoredev"; | |
repo = pname; | |
name = "encore-source"; | |
owner = "encoredev"; | |
repo = encore; |
pkgs/by-name/en/encore/package.nix
Outdated
mkdir -p $out/share/runtimes | ||
cp -r $src/runtimes/* $out/share/runtimes | ||
|
||
ln -s ${goEncore}/bin/* $out/bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check whether it is possible to use lib.getBin
here, please?
ln -s ${goEncore}/bin/* $out/bin | |
ln -s ${lib.getBin goEncore}/* $out/bin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for trying this out 👍 Not sure I understand why it doesn't work, but I'll leave that for another day 🙂
pkgs/by-name/en/encore/package.nix
Outdated
proxyVendor = true; | ||
|
||
meta = with lib; { | ||
description = "Encore is the Backend Development Platform purpose-built to help you create event-driven and distributed systems."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following suggestions follows recommendations for meta.description as outlined in pkgs/README.md
description = "Encore is the Backend Development Platform purpose-built to help you create event-driven and distributed systems."; | |
description = "Backend Development Platform to create event-driven and distributed systems"; |
pkgs/by-name/en/encore/go.nix
Outdated
owner = "encoredev"; | ||
repo = "go"; | ||
rev = "encore-go${version}"; | ||
sha256 = "sha256-SSa3CoUS6JMfs6T1PMb3NK8UeJnpLlTIn46/3oCTnL8="; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use of hash
is preferred over sha256
as it allows future flexibility should the hash algorithm be changed, e.g. to use sha512
instead of sha256
:
sha256 = "sha256-SSa3CoUS6JMfs6T1PMb3NK8UeJnpLlTIn46/3oCTnL8="; | |
hash = "sha256-SSa3CoUS6JMfs6T1PMb3NK8UeJnpLlTIn46/3oCTnL8="; |
pkgs/by-name/en/encore/go.nix
Outdated
, go | ||
, ... | ||
}: | ||
stdenv.mkDerivation rec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use of finalAttrs
is preferred over rec
where possible. Remember to close the newly opened parenthesis at the end of the file:
stdenv.mkDerivation rec { | |
stdenv.mkDerivation (finalAttrs: { |
pkgs/by-name/en/encore/go.nix
Outdated
description = "Encore's rolling fork of Go with added automatic tracing & instrumentation"; | ||
homepage = "https://encore.dev"; | ||
maintainers = with maintainers; [ luisnquin ]; | ||
platforms = platforms.linux; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Is this really linux only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@afh I have only tested this package on Linux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://encore.dev is should be possible to run on darwin, @luisnquin. Happy to help test on darwin if helpful…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, I'm currently delivering this package in this flake first.
Just clone it, run nix build
and execute the following commands:
cd "$(mktemp -d --suffix="-temp-env")"
/path/to/.../result/bin/encore app create --example=url-shortener # specify project name
cd <project-name>
/path/to/.../result/bin/encore run
You will need to have docker
available in your system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/usr/bin/env NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix build --impure github:luisnquin/nixpkgs-extra
currently fails with:
trying https://github.com/encoredev/go/archive/encore-go1.22.tar.gz
…
curl: (22) The requested URL returned error: 404
What am I doing wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I have an idea what is going wrong, please allow for a few moments to verify.
pkgs/by-name/en/encore/go.nix
Outdated
''; | ||
|
||
meta = with lib; { | ||
description = "Encore's rolling fork of Go with added automatic tracing & instrumentation"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally meta.description
does not mention the package name, yet here it seems useful as this sub-package is tied to encore
. Feel free to disregard this suggestions if it provides too little value.
description = "Encore's rolling fork of Go with added automatic tracing & instrumentation"; | |
description = "Rolling fork of Go with added automatic tracing and instrumentation for use with the encore package"; |
pkgs/by-name/en/encore/go.nix
Outdated
mkdir -p /tmp/.gobuild-cache | ||
GOCACHE=/tmp/.gobuild-cache go run . \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Would this benefit from using $TMPPATH
$TMPDIR
rather than /tmp
directly?
mkdir -p /tmp/.gobuild-cache | |
GOCACHE=/tmp/.gobuild-cache go run . \ | |
mkdir -p $TMPDIR/.gobuild-cache | |
GOCACHE=$TMPDIR/.gobuild-cache go run . \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, I meant $TMPDIR
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That worked
pkgs/by-name/en/encore/go.nix
Outdated
cp -r ${goSrc} go | ||
chmod -R u+rw go | ||
|
||
cd go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would using pushd/popd convey the intent more clearly?
cd go | |
pushd go |
pkgs/by-name/en/encore/go.nix
Outdated
|
||
cp -p -P -v -R ../overlay/* ./ | ||
|
||
cd .. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v.s.
cd .. | |
popd |
f2db02d
to
9e837ae
Compare
@afh I just applied most of the suggested changes with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the review comments and accepting the changes much appreciated 🙏
Please find below more changes that were needed in order to build this on aarch64-darwin
.
With these changes does this PR still build for you on *-linux
?
pkgs/by-name/en/encore/go.nix
Outdated
{ fetchFromGitHub, stdenv, lib, go, ... }: | ||
stdenv.mkDerivation (finalAttrs: { | ||
pname = "go-encore"; | ||
version = "1.22"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version is missing the patch number as published on https://github.com/encoredev/go/releases/tag/encore-go1.22.0
version = "1.22"; | |
version = "1.22.0"; |
pkgs/by-name/en/encore/go.nix
Outdated
goSrc = fetchFromGitHub { | ||
owner = "golang"; | ||
repo = "go"; | ||
rev = "release-branch.go${finalAttrs.version}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The golang repo branches do not use the patch-number, so let's strip it (see https://github.com/golang/go/tree/release-branch.go1.22):
rev = "release-branch.go${finalAttrs.version}"; | |
rev = "release-branch.go${lib.versions.majorMinor finalAttrs.version}"; |
9e837ae
to
0aea8e4
Compare
ℹ️ Maybe I'm missing something (or nixfmt's format) has changed, but the files in this PR do not appear to be properly formatted using nixfmt… |
@afh here are details about my nixfmt |
0aea8e4
to
31a8e19
Compare
When I run |
Result of 1 package built:
😄🎉 |
pkgs/by-name/en/encore/go.nix
Outdated
ln -s $out/share/go/bin/go $out/bin | ||
mv $out/bin/go $out/bin/go-encore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Maybe I'm missing something but couldn't this be shorted to the following?
ln -s $out/share/go/bin/go $out/bin | |
mv $out/bin/go $out/bin/go-encore | |
ln -s $out/share/go/bin/go $out/bin/go-encore |
@afh I'm applying those changes to the correct repository, you can see a recording in the following link https://drive.google.com/file/d/1LFn5snxJoS4tWv4acXeY4aPMc1FBmgTC/view
|
Could it be that the latest changes containing the nixfmt changes in your workspace have not yet been pushed to this PRs branch? |
31a8e19
to
1ba583e
Compare
Re nixfmt, I was still using (and am still used to) the format from nixfmt 0.5.0 and wasn't aware 0.6.0 with changes was released. Thanks for your patience on this, @luisnquin 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is shaping up nicely, @luisnquin, I think one last thing… 😬
pkgs/by-name/en/encore/go.nix
Outdated
hash = "sha256-amASGhvBcW90dylwFRC2Uj4kOAOKCgWmFKhLnA9dOgg="; | ||
}; | ||
in '' | ||
# delete submodule and replace with the go source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's good practice to ensure the pre- and post- hooks are run for each phase:
# delete submodule and replace with the go source | |
runHook prePatch | |
# delete submodule and replace with the go source |
pkgs/by-name/en/encore/go.nix
Outdated
|
||
cp -p -P -v -R ../overlay/* ./ | ||
|
||
popd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
popd | |
popd | |
runHook postPatch |
pkgs/by-name/en/encore/go.nix
Outdated
}.${platform.parsed.cpu.name} or (throw | ||
"Unsupported system: ${platform.parsed.cpu.name}"); | ||
in '' | ||
mkdir -p $TMPDIR/.gobuild-cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mkdir -p $TMPDIR/.gobuild-cache | |
runHook preInstall | |
mkdir -p $TMPDIR/.gobuild-cache |
pkgs/by-name/en/encore/go.nix
Outdated
cp -r dist/${stdenv.targetPlatform.parsed.kernel.name}_${ | ||
goarch stdenv.targetPlatform | ||
}/encore-go/* $out/share/go | ||
ln -s $out/share/go/bin/go $out/bin/go-encore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ln -s $out/share/go/bin/go $out/bin/go-encore | |
ln -s $out/share/go/bin/go $out/bin/go-encore | |
runHook postInstall |
1ba583e
to
c91a870
Compare
yo guys sorry. I just built it. But there's one tool missing (tsparser-encore). |
Result of 1 package built:
|
pkgs/by-name/en/encore/package.nix
Outdated
doCheck = true; | ||
|
||
subPackages = | ||
[ "cli/cmd/encore" "cli/cmd/git-remote-encore" "cli/cmd/tsbundler-encore" ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following suggestion just 💅 feel free to disregard 🙂
[ "cli/cmd/encore" "cli/cmd/git-remote-encore" "cli/cmd/tsbundler-encore" ]; | |
map (x: "cli/cmd/" + x) [ "encore" "git-remote-encore" "tsbundler-encore" ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nixification :v
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@afh I prefer to leave it like this for now
Anyway, thanks for your suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for considering it, @luisnquin.
Do I understand fmway's comment correctly that more work on this PR is necessary in order to install tsparser-encore
or is this ready for final review?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@afh I'm currently trying to build tsparser-encore
too but it seems that it may take me some time
Here's my current progress
I have a problem trying to get the correct hashes
nix keeps complaining about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I think that it is no longer necessary when a lock file is passed, still, this seems somewhat tricky to maintain to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, @luisnquin.
At first glance I have the following comments:
- Rename the
encoreSrc
parameter justsrc
- Use
inherit version src;
instead of assigningversion
andencoreSrc
- A comment on the Cargo.lock operations (
rm
andcp
) as well as on eachsubstituteInPlace
would be very helpful - Use
"${lib.getExe protobuf}"
instead of"${protobuf}/bin/protoc"
What will be tricky to maintain from your point of view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment, the way how the Cargo.lock file is being configured and the "subtitute in place" statements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide more context as to why they are necessary? Maybe these should be raised with upstream, unless they are specific to nixpkgs…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@afh by my side, the tsparser requires to update their tracing crates. I've spent many hours on this, and if you agree, we can deliver the package in the current state until encoredev/encore#1295 is resolved. At least for now, there’s no problem using it with Go. |
That sounds very reasonable to me, @luisnquin, thanks for putting in the effort, much appreciated 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for polishing this up, well done! 👏
Find below an optional minor suggestion and feel free to disregard. Looking forward to seeing this get merged 🙂
pkgs/by-name/en/encore/go.nix
Outdated
mkdir -p $TMPDIR/.gobuild-cache | ||
GOCACHE=$TMPDIR/.gobuild-cache go run . \ | ||
--goos "${stdenv.targetPlatform.parsed.kernel.name}" \ | ||
--goarch "${goarch stdenv.targetPlatform}" | ||
|
||
mkdir -p $out/{bin,share/go} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that mkdir
allows to create multiple directories simultaneously this could be shortened to, feel free to disregard if it hinders legibility.
mkdir -p $TMPDIR/.gobuild-cache | |
GOCACHE=$TMPDIR/.gobuild-cache go run . \ | |
--goos "${stdenv.targetPlatform.parsed.kernel.name}" \ | |
--goarch "${goarch stdenv.targetPlatform}" | |
mkdir -p $out/{bin,share/go} | |
mkdir -p $TMPDIR/.gobuild-cache $out/{bin,share/go} | |
GOCACHE=$TMPDIR/.gobuild-cache go run . \ | |
--goos "${stdenv.targetPlatform.parsed.kernel.name}" \ | |
--goarch "${goarch stdenv.targetPlatform}" | |
Result of 1 package built:
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-already-reviewed/2617/1843 |
fd1187a
to
57e794d
Compare
pkgs/by-name/en/encore/package.nix
Outdated
tsParser = callPackage ./tsparser.nix { | ||
inherit src version; | ||
|
||
runtimesPath = "${placeholder "out"}/share/runtimes"; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!! 👍
pkgs/by-name/en/encore/tsparser.nix
Outdated
version = version; | ||
|
||
inherit src; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be shortened to:
version = version; | |
inherit src; | |
inherit version src; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ups
@afh I just pushed new changes with the tsparser included However @fmway you can find those changes in this flake too |
80430e3
to
d2022f8
Compare
The latest changes on your flake worked well for me, @luisnquin, well done! Is there anything you'd like to address or are the changes in this PR ready for review from your point of view? |
@afh yes, changes can be reviewed |
Result of 1 package built:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting in all the hard work, @luisnquin, much appreciated! From my (likely limited 😅) nixpkgs perspective things look good to me. Well done!
pkgs/by-name/en/encore/tsparser.nix
Outdated
substituteInPlace Cargo.toml \ | ||
--replace 'members = ["runtimes/core", "runtimes/js", "tsparser"]' 'members = ["tsparser"]' \ | ||
|
||
substituteInPlace tsparser/src/bin/tsparser-encore.rs \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is strange that you need to do these substitutions 🤔 what rust version is this built with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(we always build with latest stable, so currently 1.79.0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the unstable channel we are at 1.78.0
Can you test that version by switching it in your local toolchain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried downgrading, and I got the same issue on 1.78.0. Would it be an option to use something like fenix? they have a more up to date rust version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use a flake in nixpkgs? I will research more about it.
Another option I was thinking about was to use the binaries provided by the releases that https://encore.dev/install.sh uses, at least until we can properly package with the source code.
In the current state of the package, we are not even setting the version in the binary and I'm having some problems when trying to compile a project (tsparser doesn't have a dist directory in node_modules), but if I use the binaries from the release URL I don't have a problem trying to compile a TypeScript project.
pkgs/by-name/en/encore/tsparser.nix
Outdated
|
||
# to avoid to compile "broken" members | ||
rm -rf runtimes | ||
substituteInPlace Cargo.toml \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need this substitute? is that because of the stray lock file? from what I understood it should be enough to just set buildAndTestSubdir
as you do on line 30 to build a sub-package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you also remove the "rm -rf runtimes"? I'm wondering if it just tries to load all the Cargo.toml files from the workspace maybe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was trying to compile every workspace member... maybe I'm doing something wrong but that was a progress while trying to package this project.
d2022f8
to
08ccb8f
Compare
08ccb8f
to
214032e
Compare
At least fetching from the releases we're able have binaries properly signed. This way will continously work until a perfect build is done. If you're interested in my advance, please contact me at my email adress shared on my profile. |
Description of changes
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.