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

Make CLI similar to nix build #47

Open
haslersn opened this issue Jun 24, 2019 · 1 comment
Open

Make CLI similar to nix build #47

haslersn opened this issue Jun 24, 2019 · 1 comment

Comments

@haslersn
Copy link
Contributor

haslersn commented Jun 24, 2019

I think that the command line interface for nix-bundle should be similar to nix build. That would improve learnability and usability. For reference, this is the output of nix build --help:

$ nix build --help
Usage: nix build <FLAGS>... <INSTALLABLES>...

Summary: build a derivation or fetch a store path.

Flags:
      --arg <NAME> <EXPR>       argument to be passed to Nix functions
      --argstr <NAME> <STRING>  string-valued argument to be passed to Nix functions
      --dry-run                 show what this command would do without doing it
  -f, --file <FILE>             evaluate FILE rather than the default
  -I, --include <PATH>          add a path to the list of locations used to look up <...> file names
      --no-link                 do not create a symlink to the build result
  -o, --out-link <PATH>         path of the symlink to the build result

Examples:

  To build and run GNU Hello from NixOS 17.03:
  $ nix build -f channel:nixos-17.03 hello; ./result/bin/hello

  To build the build.x86_64-linux attribute from release.nix:
  $ nix build -f release.nix build.x86_64-linux

Note: this program is EXPERIMENTAL and subject to change.

Of course there would need to be an additional option, for example --exec, to specify the executable. $ nix-bundle hello /bin/hello would then become:

$ nix-bundle -f '<nixpkgs>' hello --exec /bin/hello`

-f defaults to ./default.nix, so if one has a project with a default.nix, one can simply bundle it via:

$ nix-bundle --exec /bin/executablename

Reasonable options to support are:

  • --arg <NAME> <EXPR>
  • --argstr <NAME> <STRING>
  • -f, --file <FILE>
  • -I, --include <PATH>
  • A new option --exec as explained above. One could allow to omit this if there's only one executable in the built derivation.

I assume that most of these options can be supported simply by passing them on to the Nix tools used inside the nix-bundle script.

@matthewbauer
Copy link
Member

This is definitely something that would be worth exploring! I definitely agree we should have more consistency on this. I started nix-bundle before Nix 2.0 was out and so nix-bundle has kind of random CLI arguments.

I have also thought about trying to get bundle into Nix itself so that you could just run nix bundle.

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

No branches or pull requests

2 participants