Skip to content
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

crumbs: init at version 0.0.3 #58960

Merged
merged 2 commits into from Apr 19, 2019
Merged

crumbs: init at version 0.0.3 #58960

merged 2 commits into from Apr 19, 2019

Conversation

Thesola10
Copy link
Contributor

@Thesola10 Thesola10 commented Apr 4, 2019

Let me know if there are any errors with the way this derivation is written.

Motivation for this change

I wanted to add this little utility to Nix to make installing it easier.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip" (None depend anyway)
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Member

@symphorien symphorien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR!
You forgot to include the callPackage line in pkgs/top-level/all-package.nix declaring crumbs. I also left a few comments to improve the derivation, but they are not so important.

pkgs/applications/misc/crumbs/default.nix Outdated Show resolved Hide resolved
pkgs/applications/misc/crumbs/default.nix Outdated Show resolved Hide resolved
pkgs/applications/misc/crumbs/default.nix Outdated Show resolved Hide resolved
pkgs/applications/misc/crumbs/default.nix Outdated Show resolved Hide resolved
@Thesola10
Copy link
Contributor Author

I have submitted new changes applying your suggested changes. Tested the new derivation and it installs properly.

@Thesola10 Thesola10 marked this pull request as ready for review April 4, 2019 16:35
@tadeokondrak
Copy link
Member

This should ideally be rebased into one commit with the message crumbs: init at version 0.0.2.

@symphorien
Copy link
Member

I added a few more comments, but it looks good to me overall.

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rewrite into 2 commits: the first adding yourself to maintainer list, the second adding the package.

pkgs/applications/misc/crumbs/default.nix Outdated Show resolved Hide resolved
pkgs/applications/misc/crumbs/default.nix Outdated Show resolved Hide resolved
@Thesola10
Copy link
Contributor Author

Removed a trailing comma in the includes header of default.nix

@aanderse
Copy link
Member

@Thesola10 looks like you might have mixed something up on that last push:

hash mismatch in fixed-output derivation '/nix/store/7km1gylsg0xscbp538rfq4w8rqa3zbp8-source':
wanted: sha256:1m7fwjw74fy8pgsvjda1c7awl2y5jr0r3fb5a6v5rddym5w52s0b
got: sha256:0j7axygbaz3bcpjngybigk333lga67bg7g8gw47j4xx3gyc9qf2n

@Thesola10
Copy link
Contributor Author

Thesola10 commented Apr 13, 2019

@aanderse there's a reason behind it. I think I had used a specific commit for reference instead of version 0.0.2

@aanderse
Copy link
Member

@Thesola10 is this currently building on your system? I pulled again and got this:

autoreconf: running: automake --add-missing --copy --force-missing
Makefile.am: error: required file './README' not found
autoreconf: automake failed with exit status: 1

@Thesola10
Copy link
Contributor Author

this is very weird. noticed it also does that with 0.0.3...

@Thesola10
Copy link
Contributor Author

Upon second look, it seems that the --force-missing option that autoreconfHook adds is causing this. I just wrote a test configurationPhase locally to test that and it works again. Can I push that, or is there a cleaner way?

@Thesola10
Copy link
Contributor Author

Also, I'm kind of weirded out by the fact that @GrahamcOfBorg doesn't seem to test whether the actual derivation can build properly...

@aanderse
Copy link
Member

Also, I'm kind of weirded out by the fact that @GrahamcOfBorg doesn't seem to test whether the actual derivation can build properly...

I'll be asking the bot to build your program once it builds on my machine.

Can I push that, or is there a cleaner way?

Please rewrite the git history.

@Thesola10
Copy link
Contributor Author

Please rewrite the git history.

Of course. I was asking if there was a better way than to redefine configurePhase.

@aanderse
Copy link
Member

Of course. I was asking if there was a better way than to redefine configurePhase.

Ah... sorry I read that wrong the first time 😆 I'll defer to @jtojnar for all autoreconfHook related questions though :)

@jtojnar
Copy link
Contributor

jtojnar commented Apr 13, 2019

You really should not override configurePhase it breaks things like configureFlags. You can call automake in preConfigure.

Or you can override the flags autoreconfHook sets with autoreconfFlags:

autoreconf ${autoreconfFlags:---install --force --verbose}

@Thesola10
Copy link
Contributor Author

@jtojnar thanks for the advice! After testing, though, what worked was setting automake and autoconf as nativeBuildInputs, and overriding automakeFlags to --add-missing.

@jtojnar
Copy link
Contributor

jtojnar commented Apr 14, 2019

I would not expect automakeFlags to do anything, it is not defined in nixpkgs.

It looks like they have pre-generated ./configure script in the repo so autotools should not be needed at all, unless the script is incorrectly generated and we need to re-generate it.

@Thesola10
Copy link
Contributor Author

I would not expect automakeFlags to do anything,

You're right, it does not seem necessary. In any case, using autoconf and automake instead of autoreconfHook seems to work.

@Thesola10
Copy link
Contributor Author

After another test, it would seem that configure is pre-generated. Which is weird, since I remember a previous version required to automake it.

@aanderse
Copy link
Member

@Thesola10 seems like only outstanding issue is addressing the 0.0.3 comment mentioned in #58960 (comment).

@Thesola10
Copy link
Contributor Author

Thesola10 commented Apr 14, 2019

the 0.0.3 comment

Do you mean that I need to bump the derivation to crumbs 0.0.3? I can do that, just making sure

@Thesola10
Copy link
Contributor Author

I think all of the discrepancies in the build process (like autoreconfHook) come from the difference between master and release tags in the crumbs repo.

@aanderse
Copy link
Member

the 0.0.3 comment

Do you mean that I need to bump the derivation to crumbs 0.0.3? I can do that, just making sure

I did mean that. I ran checked out your branch and it does build fine as is on 0.0.3.
While in there I happened to notice this: https://github.com/fasseg/crumbs/blob/master/crumbs-completion.bash
Any motivation to add this to your package? Seems valuable 😄

@Thesola10
Copy link
Contributor Author

Any motivation to add this to your package?

Would adding it into $out/share/bash-completion/completions work?

@Thesola10
Copy link
Contributor Author

Thesola10 commented Apr 15, 2019

Added the autocomplete scripts in a postInstall directive, since I saw these examples were overriding installPhase (which I kinda don't like, always prefer builtin to handwritten) edit: turns out only kubectx does that . The files end up where they need to be, and the derivation builds fine.
Oh and I bumped to 0.0.3 while we're at it.

@Thesola10 Thesola10 changed the title crumbs: init at version 0.0.2 crumbs: init at version 0.0.3 Apr 15, 2019
@aanderse
Copy link
Member

Looking good. The fish completions reference gfind instead of find so I made this change and then they worked:

  prePatch = ''
    sed -i 's|gfind|find|' crumbs-completion.fish
  '';

and in the postInstall

-    cp $src/crumbs-completion.bash $out/share/bash-completion/completions/crumbs
-    cp $src/crumbs-completion.fish $out/share/fish/vendor_completions.d/crumbs.fish
+    cp crumbs-completion.bash $out/share/bash-completion/completions/crumbs
+    cp crumbs-completion.fish $out/share/fish/vendor_completions.d/crumbs.fish

@Thesola10
Copy link
Contributor Author

and in the postInstall

-    cp $src/crumbs-completion.bash $out/share/bash-completion/completions/crumbs
-    cp $src/crumbs-completion.fish $out/share/fish/vendor_completions.d/crumbs.fish
+    cp crumbs-completion.bash $out/share/bash-completion/completions/crumbs
+    cp crumbs-completion.fish $out/share/fish/vendor_completions.d/crumbs.fish

Wouldn't the reference to $src make it more semantically clear what is happening?

@aanderse
Copy link
Member

$src wasn't patched.

@Thesola10
Copy link
Contributor Author

Thesola10 commented Apr 15, 2019

The original repo mentions a /etc/crumbs.conf file, and a quick strace confirms that our built crumbs accesses it from its derivation path (expected). Should I add configuration entries to generate the file? And if so, would the config entry go in nixos/modules/programs/?

@aanderse
Copy link
Member

As far as I can tell crumbs.conf is trivial and provides a very sane default. Given the crumbs executable has a way to override the location of crumbs.conf I think leaving everything as you currently have it is perfectly reasonable.

@Thesola10
Copy link
Contributor Author

Side note -- why is the "changes requested" blocker still present? Is my branch ready for merging?

@aanderse
Copy link
Member

@GrahamcOfBorg build crumbs

I guess I was waiting to hear if you were satisfied with my response 😄

@aanderse aanderse merged commit e700ef2 into NixOS:master Apr 19, 2019
@aanderse
Copy link
Member

@Thesola10 thank you for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants