proot-termux: simplify module

This commit is contained in:
Tobias Happ 2022-07-09 16:21:55 +02:00
parent 116e30b8d5
commit d0b08d280c
7 changed files with 42 additions and 42 deletions

View file

@ -82,13 +82,7 @@ in
environment.files = { environment.files = {
inherit login loginInner; inherit login loginInner;
prootStatic = prootStatic = import ../../../pkgs/proot-termux { };
let
nixpkgs = import ../../../pkgs/cross-compiling/cross-pkgs.nix { };
tallocStatic = nixpkgs.callPackage ../../../pkgs/cross-compiling/talloc-static.nix { };
prootTermux = nixpkgs.callPackage ../../../pkgs/cross-compiling/proot-termux.nix { inherit tallocStatic; };
in
prootTermux;
}; };
}; };

View file

@ -14,8 +14,14 @@ with lib;
config = { config = {
_module.args.pkgs = import <nixpkgs> ( _module.args.pkgs =
let
result = builtins.tryEval <nixpkgs>;
in
mkIf result.success (
import result.value (
filterAttrs (n: v: v != null) config.nixpkgs filterAttrs (n: v: v != null) config.nixpkgs
)
); );
nixpkgs.overlays = import ../../overlays; nixpkgs.overlays = import ../../overlays;

View file

@ -1,13 +0,0 @@
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
{ callPackage, tallocStatic }:
let
pkgsCross = callPackage ../../lib/nixpkgs-cross.nix { };
stdenv = pkgsCross.stdenvAdapters.makeStaticBinaries pkgsCross.stdenv;
in
pkgsCross.callPackage ../proot-termux {
talloc = tallocStatic;
inherit stdenv;
}

View file

@ -43,8 +43,7 @@ let
inherit nixDirectory packageInfo; inherit nixDirectory packageInfo;
bootstrap = callPackage ./bootstrap.nix { }; bootstrap = callPackage ./bootstrap.nix { };
bootstrapZip = callPackage ./bootstrap-zip.nix { }; bootstrapZip = callPackage ./bootstrap-zip.nix { };
prootTermux = callPackage ./cross-compiling/proot-termux.nix { }; prootTermux = callPackage ./proot-termux { pkgs = nixpkgs; };
tallocStatic = callPackage ./cross-compiling/talloc-static.nix { };
}; };
in in

View file

@ -1,13 +1,31 @@
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE. # Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
{ stdenv, fetchFromGitHub, talloc, { pkgs ? null, cross ? true, static ? true }:
static ? true, outputBinaryName ? "proot-static" }:
let
pkgsCross = import ../../lib/nixpkgs-cross.nix { };
pkgs' =
if pkgs == null
then pkgsCross
else pkgs;
stdenv =
if cross
then pkgsCross.stdenvAdapters.makeStaticBinaries pkgsCross.stdenv
else pkgs'.stdenv;
talloc =
if static
then pkgs'.callPackage ./talloc-static.nix { inherit pkgsCross; }
else pkgs'.talloc;
in
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "proot-termux"; pname = "proot-termux";
version = "unstable-2022-05-03"; version = "unstable-2022-05-03";
src = fetchFromGitHub { src = pkgsCross.fetchFromGitHub {
repo = "proot"; repo = "proot";
owner = "termux"; owner = "termux";
rev = "5c462a6ecfddd629b1439f38fbb61216d6fcb359"; rev = "5c462a6ecfddd629b1439f38fbb61216d6fcb359";
@ -30,8 +48,8 @@ stdenv.mkDerivation {
patches = [ ./detranslate-empty.patch ]; patches = [ ./detranslate-empty.patch ];
makeFlags = [ "-Csrc" "V=1" ]; makeFlags = [ "-Csrc" "V=1" ];
CFLAGS = [ "-O3" "-I../fake-ashmem" ] ++ CFLAGS = [ "-O3" "-I../fake-ashmem" ] ++
(if static then [ "-static" ] else []); (if static then [ "-static" ] else [ ]);
LDFLAGS = if static then [ "-static" ] else []; LDFLAGS = if static then [ "-static" ] else [ ];
preInstall = "${stdenv.cc.targetPrefix}strip src/proot"; preInstall = "${stdenv.cc.targetPrefix}strip src/proot";
installPhase = "install -D -m 0755 src/proot $out/bin/${outputBinaryName}"; installPhase = "install -D -m 0755 src/proot $out/bin/proot${if static then "-static" else ""}";
} }

View file

@ -1,16 +1,12 @@
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE. # Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
{ callPackage { fetchurl
, fetchurl
, python3 , python3
, pkg-config , pkg-config
, wafHook , wafHook
, pkgsCross
}: }:
let
pkgsCross = callPackage ../../lib/nixpkgs-cross.nix { };
in
pkgsCross.stdenv.mkDerivation rec { pkgsCross.stdenv.mkDerivation rec {
pname = "talloc"; pname = "talloc";
version = "2.3.4"; version = "2.3.4";
@ -21,7 +17,7 @@ pkgsCross.stdenv.mkDerivation rec {
}; };
nativeBuildInputs = [ pkg-config python3 wafHook ]; nativeBuildInputs = [ pkg-config python3 wafHook ];
buildInputs = []; buildInputs = [ ];
wafPath = "./buildtools/bin/waf"; wafPath = "./buildtools/bin/waf";
wafConfigureFlags = [ wafConfigureFlags = [

View file

@ -1,9 +1,9 @@
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE. # Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
{ pkgs ? (import ../pkgs/lib/load-nixpkgs.nix {}) }: { pkgs ? (import ../lib/nixpkgs-pinned.nix { }) }:
pkgs.callPackage ../pkgs/proot-termux { import ../pkgs/proot-termux {
stdenv = pkgs.stdenv; inherit pkgs;
cross = false;
static = false; static = false;
outputBinaryName = "proot";
} }