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-bundle.sh: Modernize CLI #48

Merged
merged 5 commits into from
Nov 3, 2019

Conversation

haslersn
Copy link
Contributor

Possible solution to #47.

TODOs:

  • Update README.md
  • What about nix2appimage.sh?

TODOs:

* [ ] Update `README.md`
* [ ] What about `nix2appimage.sh`?
@haslersn haslersn force-pushed the enhancement/modern-cli branch from 809f99d to 14157e0 Compare June 24, 2019 17:52
@haslersn
Copy link
Contributor Author

Can somebody please explain to me what extraTargets are, or link me to an explaining resource? In this PR, I kept that functionality. But I can't really test it if I don't even know the desired effect.

@matthewbauer
Copy link
Member

Can somebody please explain to me what extraTargets are, or link me to an explaining resource? In this PR, I kept that functionality. But I can't really test it if I don't even know the desired effect.

The idea is you can put multiple paths into a tarball. For instance you might want to add glibcLocales to the Nix store.

nix-bundle.sh Outdated
nix build "${build_flags[@]}" "$target" || exit $?
if [ -z "$target_path" ]
then
target_path="$(readlink "$linkdir/result")"
Copy link
Member

Choose a reason for hiding this comment

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

How does this handle multiple targets?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

extra_target_paths contains the store paths (separated by whitespace) to the extra targets.


expr="(with import $nix_file {}; $bootstrap { target = $target_path; extraTargets = [$extra_target_paths ]; run = \"$bin\"; })"

echo $expr

out=$(nix-store --no-gc-warning -r $(nix-instantiate --no-gc-warning -E "$expr"))
Copy link
Member

Choose a reason for hiding this comment

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

This should normally do the actual build, The hope is that it avoids creating /result dirs in the user's directory.

Copy link
Member

Choose a reason for hiding this comment

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

Although it's not clear how to handle some of the new flags like -f, etc. nix-instantiate does allow --arg and --argstr however.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nix build has nicer output and it allows to use the modern nix cli. The result link is created in a temporary directory.

@matthewbauer
Copy link
Member

@edolstra added some handling for "app"s which have a "program" attr. NixOS/nix#2909. I am not sure if we can use that effectively here, since it is still unreleased.

@matthewbauer matthewbauer merged commit 4300437 into nix-community:master Nov 3, 2019
@haslersn haslersn deleted the enhancement/modern-cli branch March 1, 2020 00:35
@operator-name operator-name mentioned this pull request Apr 22, 2020
matthewbauer added a commit that referenced this pull request May 9, 2020
@matthewbauer
Copy link
Member

Had to revert this after seeing issues in #62 and #58. The issue is we don't have enough context to get the entire closure, resulting in paths getting dropped.

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.

2 participants