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 = {
inherit login loginInner;
prootStatic =
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;
prootStatic = import ../../../pkgs/proot-termux { };
};
};

View file

@ -14,9 +14,15 @@ with lib;
config = {
_module.args.pkgs = import <nixpkgs> (
filterAttrs (n: v: v != null) config.nixpkgs
);
_module.args.pkgs =
let
result = builtins.tryEval <nixpkgs>;
in
mkIf result.success (
import result.value (
filterAttrs (n: v: v != null) config.nixpkgs
)
);
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;
bootstrap = callPackage ./bootstrap.nix { };
bootstrapZip = callPackage ./bootstrap-zip.nix { };
prootTermux = callPackage ./cross-compiling/proot-termux.nix { };
tallocStatic = callPackage ./cross-compiling/talloc-static.nix { };
prootTermux = callPackage ./proot-termux { pkgs = nixpkgs; };
};
in

View file

@ -1,13 +1,31 @@
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
{ stdenv, fetchFromGitHub, talloc,
static ? true, outputBinaryName ? "proot-static" }:
{ pkgs ? null, cross ? true, static ? true }:
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 {
pname = "proot-termux";
version = "unstable-2022-05-03";
src = fetchFromGitHub {
src = pkgsCross.fetchFromGitHub {
repo = "proot";
owner = "termux";
rev = "5c462a6ecfddd629b1439f38fbb61216d6fcb359";
@ -30,8 +48,8 @@ stdenv.mkDerivation {
patches = [ ./detranslate-empty.patch ];
makeFlags = [ "-Csrc" "V=1" ];
CFLAGS = [ "-O3" "-I../fake-ashmem" ] ++
(if static then [ "-static" ] else []);
LDFLAGS = if static then [ "-static" ] else [];
(if static then [ "-static" ] else [ ]);
LDFLAGS = if static then [ "-static" ] else [ ];
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.
{ callPackage
, fetchurl
{ fetchurl
, python3
, pkg-config
, wafHook
, pkgsCross
}:
let
pkgsCross = callPackage ../../lib/nixpkgs-cross.nix { };
in
pkgsCross.stdenv.mkDerivation rec {
pname = "talloc";
version = "2.3.4";
@ -21,7 +17,7 @@ pkgsCross.stdenv.mkDerivation rec {
};
nativeBuildInputs = [ pkg-config python3 wafHook ];
buildInputs = [];
buildInputs = [ ];
wafPath = "./buildtools/bin/waf";
wafConfigureFlags = [

View file

@ -1,9 +1,9 @@
# 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 {
stdenv = pkgs.stdenv;
import ../pkgs/proot-termux {
inherit pkgs;
cross = false;
static = false;
outputBinaryName = "proot";
}