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

nix-prefetch-url: Add --executable flag #4036

Merged
merged 1 commit into from Sep 21, 2020

Conversation

chreekat
Copy link
Contributor

pkgs.fetchurl supports an executable argument, which is especially nice
when downloading a large executable. This patch adds the same option to
nix-prefetch-url.

I have tested this to work on the simple case of prefetching a little
executable:

  1. nix-prefetch-url --executable https://my/little/script
  2. Paste the hash into a pkgs.fetchurl-based package, script-pkg.nix
  3. Delete the output from the store to avoid any misidentified artifacts
  4. Realise the package script-pkg.nix

I repeated the above while using --name, as well.

I suspect --executable would have no meaningful effect if combined with
--unpack, but I have not tried it.

@chreekat
Copy link
Contributor Author

Although I forgot to mention it in the commit, I also tested that I could execute the file. :)

pkgs.fetchurl supports an executable argument, which is especially nice
when downloading a large executable. This patch adds the same option to
nix-prefetch-url.

I have tested this to work on the simple case of prefetching a little
executable:

1. nix-prefetch-url --executable https://my/little/script
2. Paste the hash into a pkgs.fetchurl-based package, script-pkg.nix
3. Delete the output from the store to avoid any misidentified artifacts
4. Realise the package script-pkg.nix
5. Run the executable

I repeated the above while using --name, as well.

I suspect --executable would have no meaningful effect if combined with
--unpack, but I have not tried it.
@chreekat
Copy link
Contributor Author

Rebased onto latest master because I don't think the CI failure was related to my changes. Let's see.

@chreekat
Copy link
Contributor Author

According to a comment by @edolstra, "We shouldn't add new flags to nix-prefetch-url. Any new functionality should be added to the nix command (e.g. as a nix prefetch subcommand)."

Unfortunately, adding an entire new subcommand to nix, which is still marked as experimental so I don't want to use it anyway, is probably not something I have time for right now.

@edolstra edolstra merged commit d93b373 into NixOS:master Sep 21, 2020
@edolstra
Copy link
Member

Thanks!

@chreekat chreekat deleted the b/prefetch-executable branch September 22, 2020 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants