mirror of
https://github.com/ilyakooo0/nix-bundle.git
synced 2024-09-11 06:55:53 +03:00
27 lines
427 B
Bash
27 lines
427 B
Bash
|
#!/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 (appdir { name = \"$target\"; target = $target; })"
|
||
|
|
||
|
out=$(nix-store --no-gc-warning -r $(nix-instantiate --no-gc-warning -E "$expr"))
|
||
|
|
||
|
cp -f $out $target
|