Conversation
Convenience for NixOS / Nixpkgs users, `nix-build` ran in main project directory should build this and create a `result/` symlink pointing at a built package.
|
Thanks, but keep in mind that I don't have a CI/Environment to test NixOS. |
aszlig
left a comment
There was a problem hiding this comment.
Thanks for your contribution. Apart from my other comments: What's the reason for using a default.nix instead of making it a Flake?
Note that I'm not involved with this project, just stumbled on the project when trying to reverse-engineer some firmware and saw your pull request.
| src = ./.; | ||
|
|
||
| buildInputs = [ | ||
| pkgs.cmake |
There was a problem hiding this comment.
This needs to be in nativeBuildInputs because otherwise you'll get cmake for the target platform when cross-compiling.
|
|
||
| buildInputs = [ | ||
| pkgs.cmake | ||
| pkgs.openssl.dev |
There was a problem hiding this comment.
No need to specify .dev since this output is already used by default for buildInputs.
|
|
||
| configurePhase = '' | ||
| cmake . | ||
| ''; | ||
|
|
||
| buildPhase = '' | ||
| make | ||
| ''; |
There was a problem hiding this comment.
| configurePhase = '' | |
| cmake . | |
| ''; | |
| buildPhase = '' | |
| make | |
| ''; |
If you place cmake in nativeBuildInputs, you get the right setup hooks and won't need this.
| cd src | ||
| cp epk2extract tools/lzhsenc tools/lzhs_scanner tools/idb_extract tools/jffs2extract $out/bin | ||
|
|
||
| chmod -x ../keys/* |
There was a problem hiding this comment.
It's the upstream project, so no need to fix up something like this.
| cp epk2extract tools/lzhsenc tools/lzhs_scanner tools/idb_extract tools/jffs2extract $out/bin | ||
|
|
||
| chmod -x ../keys/* | ||
| cp ../keys/*.key ../keys/*.pem $out/bin |
There was a problem hiding this comment.
This is pretty ugly IMO and those files ideally should be in $out/share/epk2extract or something like that but certainly not in $out/bin. Probably it's a good idea to make this configurable (see src/main.c:223) via cmake.
| mkdir -p $out/bin | ||
| cd src | ||
| cp epk2extract tools/lzhsenc tools/lzhs_scanner tools/idb_extract tools/jffs2extract $out/bin |
There was a problem hiding this comment.
I know it's probably personal taste, but what about the following (which does not change the current working directory):
| mkdir -p $out/bin | |
| cd src | |
| cp epk2extract tools/lzhsenc tools/lzhs_scanner tools/idb_extract tools/jffs2extract $out/bin | |
| for i in src/epk2extract src/tools/{lzhsenc,lzhs_scanner,idb_extract,jffs2extract}; do | |
| install -vD "$i" "$out/bin/$(basename "$i")" | |
| done |
| pname = "epk2extract"; | ||
| version = "devel"; |
There was a problem hiding this comment.
Since we don't have an explicit version here, it's probably better to just use name instead of pname and version:
| pname = "epk2extract"; | |
| version = "devel"; | |
| name = "epk2extract"; |
| src/tools/lzhs_scanner | ||
| src/tools/lzhsenc | ||
|
|
||
| result |
There was a problem hiding this comment.
Just a small nitpick:
| result | |
| /result |
Just a very simple reason - I just haven't started using Flakes yet :D Thank you very much for a review. As you may have guessed, I am not very well versed in practical nix packaging. I'll integrate the changes this weekend. |
eef7a24 to
e42ad47
Compare
|
Kudos, SonarCloud Quality Gate passed! |








Convenience for NixOS / Nixpkgs users,
nix-buildran in main projectdirectory should build this and create a
result/symlink pointing at abuilt package.