mirror of
https://github.com/ilyakooo0/nix-bundle.git
synced 2024-09-11 06:55:53 +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:
|
# use like this:
|
||||||
# nix-build appimage-bundle.nix --argstr package hello --argstr exec hello
|
# 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>{},
|
{nixpkgs ? import <nixpkgs>{},
|
||||||
package,
|
package,
|
||||||
@ -15,18 +17,19 @@ let
|
|||||||
};
|
};
|
||||||
src = env;
|
src = env;
|
||||||
inherit exec;
|
inherit exec;
|
||||||
buildInputs = [ drv nixpkgs.coreutils nixpkgs.gnutar nixpkgs.xz ];
|
buildInputs = [ drv ];
|
||||||
usr_fonts = buildEnv {
|
usr_fonts = buildEnv {
|
||||||
name = "fonts";
|
name = "fonts";
|
||||||
paths = [noto-fonts];
|
paths = [noto-fonts];
|
||||||
};
|
};
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
source $stdenv/setup
|
source $stdenv/setup
|
||||||
mkdir -p $out/bin
|
mkdir $out
|
||||||
cp -rL ${env}/* $out/
|
shopt -s extglob
|
||||||
chmod +w -R $out/
|
ln -s ${env}/!(share) $out/
|
||||||
|
|
||||||
mkdir -p $out/share/fonts
|
mkdir -p $out/share/fonts
|
||||||
|
ln -s ${env}/share/* $out/share/
|
||||||
|
|
||||||
cp ${usr_fonts}/share/fonts/* $out/share/fonts -R
|
cp ${usr_fonts}/share/fonts/* $out/share/fonts -R
|
||||||
|
|
||||||
mkdir -p $out/share/icons
|
mkdir -p $out/share/icons
|
||||||
@ -50,8 +53,18 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
in
|
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;});
|
with (import (./appimage-top.nix){nixpkgs' = nixpkgs.path;});
|
||||||
(appimage (appdir {
|
(appimage (appdir results )).overrideAttrs (old: {name = results.name;})
|
||||||
name = package;
|
|
||||||
target = appimage_src nixpkgs."${package}" "${exec}";
|
|
||||||
})).overrideAttrs (old: {name = package;})
|
|
||||||
|
Loading…
Reference in New Issue
Block a user