-
Notifications
You must be signed in to change notification settings - Fork 11
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
Package Hermes #5
Package Hermes #5
Conversation
Github actions are failing because of a known bug with flakes and import from derivation NixOS/nix#4265 (comment) |
Okay, I think the best approach is to create a flake per project we want, and import them all into the top level flake! |
Okay, I switched to sub-flakes (which I think is nice, because then people can just point to that url if they want a subflake only). It still didn't resolve the |
SORTED OUT THE ISSUE WITH IFD. Its a bit of a hack, but should get things rolling for now, and as long as the flake is cached it shouldn't be a problem. Hopefully this gets fixed upstream. |
flake.lock
Outdated
"type": "github" | ||
} | ||
}, | ||
"nixpkgs_4": { |
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.
Do you know why Nix Flake is generating many versions of the same package in the lock file?
hermes/flake.nix
Outdated
hermes = | ||
let | ||
name = "ibc-rs"; | ||
# The use of `evalPkgs` here is a major hack. This is to get around the IFD limitation in nix flakes |
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 am getting a warning:
trace: warning: crate2nix: Passing `buildRustCrate` as argument to Cargo.nix is deprecated. If you don't customize `buildRustCrate`, replace `callPackage ./Cargo.nix {}` by `import ./Cargo.nix { inherit pkgs; }`, and if you need to customize `buildRustCrate`, use `buildRustCrateForPkgs` instead.
Is it related to this workaround?
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.
Ah yeah, that's because I need to use a fork of crate2nix
. Right now crate2nix does not use fetchGit
under the hood, so it only looks for the master
branch. ibc-rs
uses main
I believe.
crate2nix = {
url = "github:yusdacra/crate2nix/feat/builtinfetchgit";
flake = false;
};
Here is the relevant issue upstream nix-community/crate2nix#205
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 see. I thought the input for flakes is fixed, so inside a flake the Nix code shouldn't able to do fetchGit
directly? Is the argument ibc-rs-src
in the output closure just a URL, or is it a derivation containing the fetched source code already?
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.
So, crate2nix
isn't a flake. I know they keep track of git resource hashes using a json file.
Here is the relevant code: https://github.com/yusdacra/crate2nix/blob/master/tools.nix#L234-L241
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.
Works great on my machine!
hermes/flake.nix
Outdated
}; | ||
|
||
# nix build | ||
defaultPackage = packages.hermes; |
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 it be better to not provide a default package? I'd imagine as we add new projects, the user might not want to build or run hermes by default.
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.
So I agree for the top level flake, gonna make that change. I think for the hermes/flake.nix
the user probably just wants nix run
to invoke the ibc-relayer-cli
. I am interested to hear your thoughts here.
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.
Right, I'm referring to the top level project. Got mixed up which file I'm looking at.
hermes/flake.nix
Outdated
|
||
# nix run | ||
apps = { | ||
hermes = { |
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.
Should we add documentation on README.md on what commands can be run? It is pretty tricky for new users to figure out what Nix commands to run. From here I can see two commands available: nix build .#hermes
and nix run .#hermes
.
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.
Yeah, that's a good idea!
@soareschen no rush on this, but its ready for re-review. Also sorry this has all taken so long. I didn't realize that nix + rust was so complicated (perhaps just bias since I am sure newcomers to |
When I first tried running the updated branch from the project root I got the error:
I had to go into the Could this be caused by local changes in the local |
@soareschen I am having trouble reproducing locally, even after running |
Okay, I was able to reproduce by running these commands:
It appears we need to be careful to run |
Confirmation that this issue appears to be resolved in CI https://github.com/JonathanLorimer/cosmos.nix/runs/3265578628?check_suite_focus=true |
Okay, I also realized I don't need the sub directories to be flakes, they can just be regular derivations. |
@soareschen I think this is ready for re-review whenever you have a moment. Thanks for taking so much time to look through this! |
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.
LGTM. Thanks and sorry for the delay in reviewing!
Was able to get
hermes
to build and run due to acrate2nix
branch that fixes some of the underlying issues I was running into.Solves #4