mirror of
https://github.com/ilyakooo0/nix-bundle.git
synced 2024-10-26 08:42:01 +03:00
1b9cffd972
Wasn't working since v0.1.1
34 lines
590 B
Bash
Executable File
34 lines
590 B
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
if [ "$#" -lt 1 ]; then
|
|
cat <<EOF
|
|
|
|
Usage: $0 TARGET
|
|
|
|
Create a single-file bundle from the nixpkgs attribute "TARGET".
|
|
|
|
For example:
|
|
|
|
$ $0 emacs
|
|
$ ./emacs
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
fi
|
|
|
|
target="$1"
|
|
|
|
expr="with import <nixpkgs> {}; with import ./appimage-top.nix {}; appimage (appdir { name = \"$target\"; target = $target; })"
|
|
|
|
out=$(nix-store --no-gc-warning -r $(nix-instantiate --no-gc-warning -E "$expr"))
|
|
|
|
if [ -z "$out" ]; then
|
|
echo "$0 failed. Exiting."
|
|
exit 1
|
|
else
|
|
appimage=$out/*.AppImage
|
|
cp -f $appimage .
|
|
echo "AppImage created at $(basename $appimage)"
|
|
fi
|