mirror of
https://github.com/ilyakooo0/nix-bundle.git
synced 2024-10-26 08:42:01 +03:00
Merge pull request #28 from dtzWill/dtz-fixups
Misc fixups that may be of interest (don't merge as-is)
This commit is contained in:
commit
393f4153e9
2
AppRun.c
2
AppRun.c
@ -92,7 +92,7 @@ static void add_path(const char* name, const char* rootdir) {
|
||||
}
|
||||
|
||||
#define SAVE_ENV_VAR(x) char *x = getenv(#x)
|
||||
#define LOAD_ENV_VAR(x) setenv(#x, x, 1)
|
||||
#define LOAD_ENV_VAR(x) do { if (x != NULL) setenv(#x, x, 1); } while(0)
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
char *appdir = dirname(realpath("/proc/self/exe", NULL));
|
||||
|
@ -1,13 +1,13 @@
|
||||
{ stdenv, fetchurl, perl, pathsFromGraph, fetchFromGitHub, musl, coreutils, bash }:
|
||||
{ stdenv, fetchurl, muslPkgs, perl, pathsFromGraph, fetchFromGitHub, coreutils, bash }:
|
||||
|
||||
let
|
||||
AppRun = targets: stdenv.mkDerivation {
|
||||
AppRun = targets: muslPkgs.stdenv.mkDerivation {
|
||||
name = "AppRun";
|
||||
|
||||
phases = [ "buildPhase" "installPhase" "fixupPhase" ];
|
||||
|
||||
buildPhase = ''
|
||||
CC="${musl}/bin/musl-gcc -O2 -Wall -Wno-deprecated-declarations -Wno-unused-result -static"
|
||||
CC="$CC -O2 -Wall -Wno-deprecated-declarations -Wno-unused-result -static"
|
||||
$CC ${./AppRun.c} -o AppRun -DENV_PATH='"${stdenv.lib.makeBinPath targets}"'
|
||||
'';
|
||||
|
||||
|
@ -1,13 +1,17 @@
|
||||
{nixpkgs ? import <nixpkgs> {}}:
|
||||
{ nixpkgs' ? <nixpkgs> }:
|
||||
|
||||
with nixpkgs;
|
||||
let
|
||||
pkgs = import nixpkgs' { };
|
||||
muslPkgs = import nixpkgs' {
|
||||
localSystem.config = "x86_64-unknown-linux-musl";
|
||||
};
|
||||
|
||||
rec {
|
||||
appimagetool = callPackage ./appimagetool.nix {};
|
||||
in rec {
|
||||
appimagetool = pkgs.callPackage ./appimagetool.nix {};
|
||||
|
||||
appimage = callPackage ./appimage.nix {
|
||||
appimage = pkgs.callPackage ./appimage.nix {
|
||||
inherit appimagetool;
|
||||
};
|
||||
|
||||
appdir = callPackage ./appdir.nix {};
|
||||
appdir = pkgs.callPackage ./appdir.nix { inherit muslPkgs; };
|
||||
}
|
||||
|
@ -5,12 +5,14 @@
|
||||
# Ideally, this should be source based,
|
||||
# but I can't get it to build from GitHub
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
let
|
||||
inherit (stdenv.cc.bintools) dynamicLinker;
|
||||
in stdenv.mkDerivation rec {
|
||||
name = "appimagekit";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/probonopd/AppImageKit/releases/download/7/appimagetool-x86_64.AppImage";
|
||||
sha256 = "1irvbf0xnya16cyzpvr43jviq5ly3wl7b9753rji7d1hhxwb7b9r";
|
||||
url = "https://github.com/AppImage/AppImageKit/releases/download/10/appimagetool-x86_64.AppImage";
|
||||
sha256 = "03zbiblj8a1yk1xsb5snxi4ckwn3diyldg1jh5hdjjhsmpw652ig";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
@ -22,7 +24,7 @@ stdenv.mkDerivation rec {
|
||||
unpackPhase = ''
|
||||
cp $src appimagetool-x86_64.AppImage
|
||||
chmod u+wx appimagetool-x86_64.AppImage
|
||||
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
patchelf --set-interpreter ${dynamicLinker} \
|
||||
--set-rpath ${fuse}/lib:${zlib}/lib \
|
||||
appimagetool-x86_64.AppImage
|
||||
./appimagetool-x86_64.AppImage --appimage-extract
|
||||
@ -32,12 +34,12 @@ stdenv.mkDerivation rec {
|
||||
mkdir -p $out
|
||||
cp -r usr/* $out
|
||||
|
||||
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
--set-rpath ${stdenv.glibc.out}/lib:${fuse}/lib:${zlib}/lib:${glib}/lib \
|
||||
$out/bin/appimagetool
|
||||
patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
--set-rpath ${zlib}/lib \
|
||||
$out/bin/mksquashfs
|
||||
for x in $out/bin/*; do
|
||||
patchelf \
|
||||
--set-interpreter ${dynamicLinker} \
|
||||
--set-rpath ${stdenv.lib.makeLibraryPath [ zlib stdenv.glibc.out fuse glib ]} \
|
||||
$x
|
||||
done
|
||||
'';
|
||||
|
||||
dontStrip = true;
|
||||
|
14
test-appimage.nix
Normal file
14
test-appimage.nix
Normal file
@ -0,0 +1,14 @@
|
||||
{ appimagefile, nixpkgs' ? <nixpkgs> }:
|
||||
|
||||
# nix build -f test-appimage.nix --arg appimagefile ./VLC*AppImage
|
||||
|
||||
with import nixpkgs' {};
|
||||
|
||||
runCommand "patchelf" {} ''
|
||||
cp ${appimagefile} $out
|
||||
chmod +w $out
|
||||
patchelf \
|
||||
--set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
|
||||
--set-rpath ${stdenv.glibc.out}/lib:${fuse}/lib:${zlib}/lib:${glib}/lib \
|
||||
$out
|
||||
''
|
Loading…
Reference in New Issue
Block a user