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

twa: init at 1.3.1 #47112

Merged
merged 1 commit into from Sep 24, 2018
Merged

twa: init at 1.3.1 #47112

merged 1 commit into from Sep 24, 2018

Conversation

Avaq
Copy link
Member

@Avaq Avaq commented Sep 21, 2018

Motivation for this change

More and more of my colleagues are making the switch to NixOS, and it would be convenient for them, and myself, if we could install twa (a tool we use) directly from nixpkgs.

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 nox --run "nox-review wip"
  • 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)
  • Fits CONTRIBUTING.md.

@Avaq
Copy link
Member Author

Avaq commented Sep 21, 2018

This is the first ever package I've defined with Nix. There are a few questions left unanswered for me:

  1. I wasn't sure where to put this sort of thing. I found the following candidates (ordered by my view on fitness):

    • tools/networking/twa
    • tools/security/twa
    • development/web/twa
    • development/tools/twa
  2. I've added myself as a maintainer. I'm not fully aware what that implies, and whether it was the right thing to do.

src = fetchFromGitHub {
owner = "trailofbits";
repo = "twa";
rev = "${version}";
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this could just be version, rather than with the interpolation. I copied this from another package definition, though, so I left it in case it's convention.

Copy link
Member

Choose a reason for hiding this comment

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

yes, rev = version; is preferred here.

buildInputs = [ bash gawk curl netcat ];

installPhase = ''
install -Dm 0755 twa "$out/bin/twa"
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be wrapped with makeWrapper to have curl, netcat and ncurses in its PATH:

https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/phantomjs2/default.nix#L91

@Avaq
Copy link
Member Author

Avaq commented Sep 21, 2018

needs to be wrapped with makeWrapper to have curl, netcat and ncurses in its PATH -- @Mic92

Done. This time I tested with nix-shell --pure and found it working.

However, I also realized that the tscore command being installed runs with awk as the interpreter. Is it normal that this (and bash for twa) are kind of implicit run-time dependencies?

@Mic92
Copy link
Member

Mic92 commented Sep 21, 2018

Tscore has awk in its shebang, no?

@Avaq
Copy link
Member Author

Avaq commented Sep 21, 2018

Tscore has awk in its shebang, no?

Yes. It does. Does that mean Nix is aware of the dependency to awk?

@Mic92
Copy link
Member

Mic92 commented Sep 21, 2018

Yes. It automatically scans runtime dependencies by looking for nix store paths in the package.

@Mic92
Copy link
Member

Mic92 commented Sep 21, 2018

  1. I've added myself as a maintainer. I'm not fully aware what that implies, and whether it was the right thing to do.

This is the right thing and we want that for all new packages. https://nixos.wiki/wiki/Nixpkgs#Becoming_a_Nixpkgs_maintainer

@Avaq
Copy link
Member Author

Avaq commented Sep 24, 2018

I'm resolving the conflict. I also might use a different email address.

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

3 participants