mirror of
https://github.com/ilyakooo0/nix-bundle.git
synced 2024-10-26 08:42:01 +03:00
Allow bundle to handle an evaluated nix expression
Example (note the --arg vs --argstr for the package argument): nix-build appimage-bundle.nix --arg package 'with import <nixpkgs>{}; writers.writePython3Bin "helloThere.py" {} "print(1)\n"' --argstr exec helloThere.py
This commit is contained in:
parent
943985abb0
commit
d18d34c2db
@ -1,5 +1,7 @@
|
||||
# use like this:
|
||||
# nix-build appimage-bundle.nix --argstr package hello --argstr exec hello
|
||||
# nix-build appimage-bundle.nix --arg package 'with import <nixpkgs>{}; writers.writePython3Bin "helloThere.py" {} "print(1)\n"' --argstr exec helloThere.py
|
||||
|
||||
|
||||
{nixpkgs ? import <nixpkgs>{},
|
||||
package,
|
||||
@ -15,18 +17,19 @@ let
|
||||
};
|
||||
src = env;
|
||||
inherit exec;
|
||||
buildInputs = [ drv nixpkgs.coreutils nixpkgs.gnutar nixpkgs.xz ];
|
||||
buildInputs = [ drv ];
|
||||
usr_fonts = buildEnv {
|
||||
name = "fonts";
|
||||
paths = [noto-fonts];
|
||||
};
|
||||
buildCommand = ''
|
||||
source $stdenv/setup
|
||||
mkdir -p $out/bin
|
||||
cp -rL ${env}/* $out/
|
||||
chmod +w -R $out/
|
||||
|
||||
mkdir $out
|
||||
shopt -s extglob
|
||||
ln -s ${env}/!(share) $out/
|
||||
mkdir -p $out/share/fonts
|
||||
ln -s ${env}/share/* $out/share/
|
||||
|
||||
cp ${usr_fonts}/share/fonts/* $out/share/fonts -R
|
||||
|
||||
mkdir -p $out/share/icons
|
||||
@ -50,8 +53,18 @@ let
|
||||
};
|
||||
|
||||
in
|
||||
let results =
|
||||
if (nixpkgs.lib.isDerivation package && !(nixpkgs.lib.isString package))
|
||||
then {
|
||||
name = package.name;
|
||||
target = appimage_src package "${exec}";
|
||||
extraTargets = [];
|
||||
}
|
||||
else {
|
||||
name = nixpkgs."${package}".name;
|
||||
target = appimage_src (nixpkgs."${package}") "${exec}";
|
||||
extraTargets = [];
|
||||
};
|
||||
in
|
||||
with (import (./appimage-top.nix){nixpkgs' = nixpkgs.path;});
|
||||
(appimage (appdir {
|
||||
name = package;
|
||||
target = appimage_src nixpkgs."${package}" "${exec}";
|
||||
})).overrideAttrs (old: {name = package;})
|
||||
(appimage (appdir results )).overrideAttrs (old: {name = results.name;})
|
||||
|
Loading…
Reference in New Issue
Block a user