Open tomberek opened 3 years ago
Slightly less hacky:
{
description = " description";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nix-bundle.url = "github:matthewbauer/nix-bundle";
};
outputs = { self, nixpkgs, nix-bundle }:
{
bundlers = {
nix-bundle = { program, system }: let
legacy = nixpkgs.legacyPackages.${system};
nix-bundle-prog = import nix-bundle { nixpkgs = legacy; };
script = legacy.writeScript "startup" ''
#!/bin/sh
PROG="$1"
shift
.${nix-bundle-prog.nix-user-chroot}/bin/nix-user-chroot -n ./nix -- "${builtins.dirOf program}/$PROG" "$@"
'';
in nix-bundle-prog.makebootstrap {
targets = [ script ];
startup = ".${builtins.unsafeDiscardStringContext script} '\"$@\"'";
};
};
defaultBundler = self.bundlers.nix-bundle;
};
}
The proposed interface in the RFC exposed a
-c, --command
to allow for program names other than the default. I got something like this working, but not sure if there's a better way.