nix-community/nix-bundle

nix-bundle doesn't work

Closed this issue · 1 comments

I'm trying to bundle nanomq:

$ nix run .#nix-bundle -- nanomq /bin/nanomq
error: undefined variable 'nanomq'

       at «string»:1:158:

            1| with import <nixpkgs> {}; with import /nix/store/kb711718gq3bqzp1x5kzsg95kj49q0r1-nix-bundle-0.4.1/share/nix-bundle/default.nix {}; nix-bootstrap { target = nanomq; extraTargets = [  ]; run = "/bin/nanomq"; }
             |                                                                                                                                                              ^
(use '--show-trace' to show detailed location information)
error: path '/home/sikmir/nixpkgs' is not in the Nix store
/nix/store/kb711718gq3bqzp1x5kzsg95kj49q0r1-nix-bundle-0.4.1/share/nix-bundle/nix-bundle.sh failed. Exiting.

But nanomq is actually defined:

$ nix run .#nanomq -- -v

Usage: nanomq { start | stop | restart | reload } [--help]

NanoMQ Messaging Engine for Edge Computing & Messaging bus v0.12.1-1
Copyright 2022 EMQ Edge Computing Team

It's trying to use your nixpkgs channel.

nix bundle --bundler "." "nixpkgs#hello" will work.

If you want to use nix-bundle.sh you can add

environment.etc."nix/inputs/nixpkgs".source = pkgs.path;
nix.nixPath = [ "nixpkgs=/etc/nix/inputs/nixpkgs" ];

To your NixOS config.