mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
Refactor directory structure
Benefits of this refactoring: - argument list is now comprehensibly as there is now only one nixpkgs version flying around - common config and lib functions got abstracted away - clearer intent when to use pinned or unpinned packages - allows better configurability for the future through config attr set
This commit is contained in:
parent
9e23547108
commit
4110def2ac
20 changed files with 163 additions and 209 deletions
|
|
@ -13,7 +13,7 @@ let
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
inherit (pkgs) proot;
|
inherit (pkgs) proot-termux;
|
||||||
|
|
||||||
basic-environment = nixpkgs.buildEnv {
|
basic-environment = nixpkgs.buildEnv {
|
||||||
name = "basic-environment";
|
name = "basic-environment";
|
||||||
|
|
@ -23,7 +23,7 @@ in
|
||||||
nixpkgs.cacert
|
nixpkgs.cacert
|
||||||
nixpkgs.coreutils
|
nixpkgs.coreutils
|
||||||
nixpkgs.nix
|
nixpkgs.nix
|
||||||
# pkgs.proot
|
# pkgs.proot-termux
|
||||||
pkgs.files.etc-group
|
pkgs.files.etc-group
|
||||||
pkgs.files.etc-passwd
|
pkgs.files.etc-passwd
|
||||||
pkgs.files.hm-install
|
pkgs.files.hm-install
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,24 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
{ arch
|
{ arch, initialBuild ? true, nixOnDroidChannelURL ? "https://github.com/t184256/nix-on-droid-bootstrap/archive/master.tar.gz" }:
|
||||||
, nixOnDroidChannelURL ? https://github.com/t184256/nix-on-droid-bootstrap/archive/testing.tar.gz
|
|
||||||
, nixpkgsChannelURL ? https://nixos.org/channels/nixos-19.09
|
|
||||||
, initialBuild ? true
|
|
||||||
}:
|
|
||||||
|
|
||||||
assert builtins.elem arch [ "aarch64" "i686" ];
|
assert builtins.elem arch [ "aarch64" "i686" ];
|
||||||
|
|
||||||
let
|
let
|
||||||
pkgs = import <nixpkgs> { };
|
currentNixpkgs = import <nixpkgs> { };
|
||||||
|
currentNixpkgsLib = currentNixpkgs.callPackage ./lib { };
|
||||||
|
|
||||||
pkgsList = import ./pkgs-list.nix {
|
pinnedNixpkgs = currentNixpkgsLib.loadNixpkgs { };
|
||||||
inherit arch;
|
pinnedNixpkgsLib = pinnedNixpkgs.callPackage ./lib { };
|
||||||
inherit (pkgs) fetchFromGitHub;
|
|
||||||
};
|
# use pinned nixpkgs only for initial build
|
||||||
|
nixpkgs = if initialBuild then pinnedNixpkgs else currentNixpkgs;
|
||||||
|
lib = if initialBuild then pinnedNixpkgsLib else currentNixpkgsLib;
|
||||||
|
|
||||||
|
config = lib.buildConfig { inherit arch initialBuild nixOnDroidChannelURL; };
|
||||||
in
|
in
|
||||||
|
|
||||||
import ./pkgs {
|
import ./pkgs/top-level/all-packages.nix {
|
||||||
inherit arch initialBuild nixOnDroidChannelURL nixpkgsChannelURL;
|
inherit nixpkgs lib config;
|
||||||
inherit (pkgsList) pinnedPkgs crossPkgs crossStaticPkgs;
|
|
||||||
buildPkgs = if initialBuild then pkgsList.pinnedPkgs else pkgs;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,12 @@ let
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
buildConfig = { arch, initialBuild, channelConfig ? { } }: (
|
buildConfig = { arch, initialBuild, nixOnDroidChannelURL }: (
|
||||||
{
|
{
|
||||||
channel = {
|
channel = {
|
||||||
nix-on-droid = "https://github.com/t184256/nix-on-droid-bootstrap/archive/testing.tar.gz";
|
nix-on-droid = nixOnDroidChannelURL;
|
||||||
nixpkgs = "https://nixos.org/channels/nixos-19.09";
|
nixpkgs = "https://nixos.org/channels/nixos-19.09";
|
||||||
} // channelConfig;
|
};
|
||||||
|
|
||||||
core = {
|
core = {
|
||||||
inherit arch initialBuild;
|
inherit arch initialBuild;
|
||||||
|
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
|
||||||
|
|
||||||
{ fetchFromGitHub, arch }:
|
|
||||||
|
|
||||||
let
|
|
||||||
# head of nixos-19.09 as of 2019-10-14
|
|
||||||
pinnedPkgsSrc = fetchFromGitHub {
|
|
||||||
owner = "NixOS";
|
|
||||||
repo = "nixpkgs";
|
|
||||||
rev = "45a25ff41a2309099ff2e70b2f37debd5e567618";
|
|
||||||
sha256 = "0w37p98i47d7snhckz8a3a60v0f05b5047vsm4rczink9mk9x7r3";
|
|
||||||
};
|
|
||||||
|
|
||||||
defaultNixpkgsArgs = {
|
|
||||||
config = { };
|
|
||||||
overlays = [ ];
|
|
||||||
};
|
|
||||||
|
|
||||||
pinnedPkgs = import pinnedPkgsSrc defaultNixpkgsArgs;
|
|
||||||
|
|
||||||
overlayJpegNoStatic = self: super: {
|
|
||||||
inherit (pinnedPkgs) libjpeg;
|
|
||||||
};
|
|
||||||
|
|
||||||
crossSystem = {
|
|
||||||
config = "${arch}-unknown-linux-android";
|
|
||||||
sdkVer = "24";
|
|
||||||
ndkVer = "18b";
|
|
||||||
useAndroidPrebuilt = true;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
|
|
||||||
{
|
|
||||||
inherit pinnedPkgs;
|
|
||||||
|
|
||||||
crossPkgs = import pinnedPkgsSrc ({ inherit crossSystem; } // defaultNixpkgsArgs);
|
|
||||||
|
|
||||||
crossStaticPkgs = import pinnedPkgsSrc ({
|
|
||||||
inherit crossSystem;
|
|
||||||
|
|
||||||
crossOverlays = [
|
|
||||||
(import "${pinnedPkgsSrc}/pkgs/top-level/static.nix")
|
|
||||||
overlayJpegNoStatic
|
|
||||||
];
|
|
||||||
} // defaultNixpkgsArgs);
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
|
||||||
|
|
||||||
{ arch, buildPkgs, crossPkgs, crossStaticPkgs, initialBuild, pinnedPkgs
|
|
||||||
, nixOnDroidChannelURL, nixpkgsChannelURL
|
|
||||||
} @ args:
|
|
||||||
|
|
||||||
let
|
|
||||||
callPackage = buildPkgs.lib.callPackageWith (args // pkgs);
|
|
||||||
|
|
||||||
pkgs = rec {
|
|
||||||
bootstrap = callPackage ./bootstrap.nix { };
|
|
||||||
|
|
||||||
bootstrapZip = callPackage ./bootstrap-zip.nix { };
|
|
||||||
|
|
||||||
files = callPackage ./files { } // { recurseForDerivations = true; };
|
|
||||||
|
|
||||||
ids = callPackage ./ids.nix { };
|
|
||||||
|
|
||||||
nixDirectory = callPackage ./nix-directory.nix { };
|
|
||||||
|
|
||||||
proot = callPackage ./proot.nix { };
|
|
||||||
|
|
||||||
qemuAarch64Static = callPackage ./qemu-aarch64-static.nix { };
|
|
||||||
|
|
||||||
talloc = callPackage ./talloc.nix { };
|
|
||||||
};
|
|
||||||
in
|
|
||||||
|
|
||||||
pkgs
|
|
||||||
|
|
@ -1,32 +1,7 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
{ buildPkgs, initialBuild, nixDirectory
|
{ callPackage, writeTextDir }:
|
||||||
, nixOnDroidChannelURL, nixpkgsChannelURL
|
|
||||||
, ids }:
|
|
||||||
|
|
||||||
let
|
|
||||||
instDir = "/data/data/com.termux.nix/files/usr";
|
|
||||||
userName = "nix-on-droid";
|
|
||||||
groupName = "nix-on-droid";
|
|
||||||
shell = "/bin/sh";
|
|
||||||
|
|
||||||
packageInfo = import "${nixDirectory}/nix-support/package-info.nix";
|
|
||||||
|
|
||||||
# TODO: remove when https://github.com/NixOS/nixpkgs/pull/64421 got merged into stable
|
|
||||||
writeTextDir = path: text: buildPkgs.writeTextFile {
|
|
||||||
inherit text;
|
|
||||||
name = builtins.baseNameOf path;
|
|
||||||
destination = "/${path}";
|
|
||||||
};
|
|
||||||
|
|
||||||
callPackage = buildPkgs.lib.callPackageWith (buildPkgs // {
|
|
||||||
inherit initialBuild instDir packageInfo writeTextDir;
|
|
||||||
inherit groupName userName ids;
|
|
||||||
inherit shell;
|
|
||||||
inherit nixOnDroidChannelURL nixpkgsChannelURL;
|
|
||||||
});
|
|
||||||
in
|
|
||||||
|
|
||||||
{
|
{
|
||||||
etc-group = callPackage ./etc-group.nix { };
|
etc-group = callPackage ./etc-group.nix { };
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
{ writeTextDir, userName, groupName, ids }:
|
{ config, writeTextDir }:
|
||||||
|
|
||||||
writeTextDir "etc/group" ''
|
writeTextDir "etc/group" ''
|
||||||
root:x:0:
|
root:x:0:
|
||||||
${groupName}:x:${(import ids).gid}:${userName}
|
${config.user.group}:x:${config.user.gid}:${config.user.user}
|
||||||
''
|
''
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,9 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
{ writeTextDir, instDir, userName, shell, ids }:
|
{ config, writeTextDir }:
|
||||||
|
|
||||||
let
|
|
||||||
idSet = import ids;
|
|
||||||
in
|
|
||||||
|
|
||||||
writeTextDir "etc/passwd" ''
|
writeTextDir "etc/passwd" ''
|
||||||
root:x:0:0:System administrator:${instDir}/root:/bin/sh
|
root:x:0:0:System administrator:${config.core.installation}/root:/bin/sh
|
||||||
${userName}:x:${idSet.uid}:${idSet.gid}:${userName}:/data/data/com.termux.nix/files/home:${shell}
|
${config.user.user}:x:${config.user.uid}:${config.user.gid}:${config.user.user}:${config.user.home}:${config.user.shell}
|
||||||
''
|
''
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
{ coreutils, instDir, nix, writeScriptBin }:
|
{ coreutils, nix, writeScriptBin }:
|
||||||
|
|
||||||
writeScriptBin "hm-install" ''
|
writeScriptBin "hm-install" ''
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
|
||||||
|
|
@ -1,53 +1,45 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
{ initialBuild
|
{ config, lib, packageInfo, writeTextDir }:
|
||||||
, nixpkgsChannelURL, nixOnDroidChannelURL
|
|
||||||
, instDir
|
|
||||||
, packageInfo
|
|
||||||
, writeTextDir
|
|
||||||
}:
|
|
||||||
|
|
||||||
writeTextDir "usr/lib/login-inner" ''
|
writeTextDir "usr/lib/login-inner" ''
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
[ "$#" -gt 0 ] || echo "Welcome to Nix-on-Droid!"
|
[ "$#" -gt 0 ] || echo "Welcome to Nix-on-Droid!"
|
||||||
|
|
||||||
[ "$#" -gt 0 ] || echo "If nothing works, use the rescue shell and read ${instDir}/usr/lib/login-inner"
|
[ "$#" -gt 0 ] || echo "If nothing works, use the rescue shell and read ${config.core.installation}/usr/lib/login-inner"
|
||||||
[ "$#" -gt 0 ] || echo "If it does not help, report bugs at https://github.com/t184256/nix-on-droid-bootstrap/issues"
|
[ "$#" -gt 0 ] || echo "If it does not help, report bugs at https://github.com/t184256/nix-on-droid-bootstrap/issues"
|
||||||
|
|
||||||
export USER='nix-on-droid'
|
export USER="${config.user.user}"
|
||||||
export HOME='/data/data/com.termux.nix/files/home'
|
export HOME="${config.user.home}"
|
||||||
|
|
||||||
${
|
${lib.optionalString config.core.initialBuild ''
|
||||||
if initialBuild
|
[ "$#" -gt 0 ] || echo "Sourcing Nix environment..."
|
||||||
then ''
|
. ${packageInfo.nix}/etc/profile.d/nix.sh
|
||||||
[ "$#" -gt 0 ] || echo "Sourcing Nix environment..."
|
|
||||||
. ${packageInfo.nix}/etc/profile.d/nix.sh
|
|
||||||
|
|
||||||
export NIX_SSL_CERT_FILE=${packageInfo.cacert}
|
export NIX_SSL_CERT_FILE=${packageInfo.cacert}
|
||||||
|
|
||||||
echo "Installing and updating nix-channels..."
|
echo "Installing and updating nix-channels..."
|
||||||
${packageInfo.nix}/bin/nix-channel --add ${nixpkgsChannelURL} nixpkgs
|
${packageInfo.nix}/bin/nix-channel --add ${config.channel.nixpkgs} nixpkgs
|
||||||
${packageInfo.nix}/bin/nix-channel --add ${nixOnDroidChannelURL} nix-on-droid
|
${packageInfo.nix}/bin/nix-channel --add ${config.channel.nix-on-droid} nix-on-droid
|
||||||
${packageInfo.nix}/bin/nix-channel --update
|
${packageInfo.nix}/bin/nix-channel --update
|
||||||
|
|
||||||
echo "Installing nix-on-droid.basic-environment..."
|
echo "Installing nix-on-droid.basic-environment..."
|
||||||
${packageInfo.nix}/bin/nix-env -iA nix-on-droid.basic-environment
|
${packageInfo.nix}/bin/nix-env -iA nix-on-droid.basic-environment
|
||||||
|
|
||||||
echo "Setting up dynamic symlinks via nix-on-droid-linker"
|
echo "Setting up dynamic symlinks via nix-on-droid-linker"
|
||||||
nix-on-droid-linker
|
nix-on-droid-linker
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Congratulations! Now you have Nix installed with some basic packages like"
|
echo "Congratulations! Now you have Nix installed with some basic packages like"
|
||||||
echo "bashInteractive, coreutils, cacert and some scripts provided by nix-on-droid"
|
echo "bashInteractive, coreutils, cacert and some scripts provided by nix-on-droid"
|
||||||
echo "itself."
|
echo "itself."
|
||||||
echo
|
echo
|
||||||
echo "You can go for the bare Nix setup or you can configure your phone via"
|
echo "You can go for the bare Nix setup or you can configure your phone via"
|
||||||
echo "home-manager. For that simply run hm-install."
|
echo "home-manager. For that simply run hm-install."
|
||||||
echo
|
echo
|
||||||
'' else ""
|
''}
|
||||||
}
|
|
||||||
|
|
||||||
[ "$#" -gt 0 ] || echo "Sourcing Nix environment..."
|
[ "$#" -gt 0 ] || echo "Sourcing Nix environment..."
|
||||||
. $HOME/.nix-profile/etc/profile.d/nix.sh
|
. $HOME/.nix-profile/etc/profile.d/nix.sh
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
{ instDir, writeScriptBin }:
|
{ config, writeScriptBin }:
|
||||||
|
|
||||||
|
let
|
||||||
|
instDir = config.core.installation;
|
||||||
|
in
|
||||||
|
|
||||||
writeScriptBin "login" ''
|
writeScriptBin "login" ''
|
||||||
#!/system/bin/sh
|
#!/system/bin/sh
|
||||||
|
|
@ -57,9 +61,7 @@ writeScriptBin "login" ''
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
instDir=/data/data/com.termux.nix/files/usr
|
export USER="${config.user.user}"
|
||||||
|
|
||||||
export USER=nix-on-droid
|
|
||||||
export PROOT_TMP_DIR=${instDir}/tmp
|
export PROOT_TMP_DIR=${instDir}/tmp
|
||||||
export PROOT_L2S_DIR=${instDir}/.l2s
|
export PROOT_L2S_DIR=${instDir}/.l2s
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
|
||||||
|
|
||||||
{ buildPkgs }:
|
|
||||||
|
|
||||||
buildPkgs.runCommand "ids.nix" {} ''
|
|
||||||
cat > $out <<EOF
|
|
||||||
{
|
|
||||||
gid = "$(${buildPkgs.coreutils}/bin/id -g)";
|
|
||||||
uid = "$(${buildPkgs.coreutils}/bin/id -u)";
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
''
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
{ arch, buildPkgs, bootstrap }:
|
{ config, runCommand, zip, bootstrap }:
|
||||||
|
|
||||||
buildPkgs.runCommand "bootstrap-zip" { } ''
|
runCommand "bootstrap-zip" { } ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cd ${bootstrap}
|
cd ${bootstrap}
|
||||||
${buildPkgs.zip}/bin/zip -q -9 -r $out/bootstrap-${arch} ./* ./.l2s
|
${zip}/bin/zip -q -9 -r $out/bootstrap-${config.core.arch} ./* ./.l2s
|
||||||
''
|
''
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
{ buildPkgs, files, nixDirectory, proot }:
|
{ runCommand, files, nixDirectory, prootTermux }:
|
||||||
|
|
||||||
let
|
let
|
||||||
packageInfo = import "${nixDirectory}/nix-support/package-info.nix";
|
packageInfo = import "${nixDirectory}/nix-support/package-info.nix";
|
||||||
in
|
in
|
||||||
|
|
||||||
buildPkgs.runCommand "bootstrap" { } ''
|
runCommand "bootstrap" { } ''
|
||||||
mkdir --parents $out/{.l2s,bin,etc/nix,nix,root,tmp,usr/{bin,lib}}
|
mkdir --parents $out/{.l2s,bin,etc/nix,nix,root,tmp,usr/{bin,lib}}
|
||||||
|
|
||||||
cp --recursive ${nixDirectory}/store $out/nix/store
|
cp --recursive ${nixDirectory}/store $out/nix/store
|
||||||
|
|
@ -17,7 +17,7 @@ buildPkgs.runCommand "bootstrap" { } ''
|
||||||
ln --symbolic --no-dereference ${packageInfo.bash}/bin/sh $out/bin/sh
|
ln --symbolic --no-dereference ${packageInfo.bash}/bin/sh $out/bin/sh
|
||||||
ln --symbolic --no-dereference ${packageInfo.coreutils}/bin/env $out/usr/bin/env
|
ln --symbolic --no-dereference ${packageInfo.coreutils}/bin/env $out/usr/bin/env
|
||||||
|
|
||||||
install -D -m 0755 ${proot}/bin/proot-static $out/bin/proot-static
|
install -D -m 0755 ${prootTermux}/bin/proot-static $out/bin/proot-static
|
||||||
|
|
||||||
cp ${files.login}/bin/login $out/bin/login
|
cp ${files.login}/bin/login $out/bin/login
|
||||||
cp ${files.login-inner}/usr/lib/login-inner $out/usr/lib/login-inner
|
cp ${files.login-inner}/usr/lib/login-inner $out/usr/lib/login-inner
|
||||||
30
src/pkgs/initial-build/cross-compiling/pkgs.nix
Normal file
30
src/pkgs/initial-build/cross-compiling/pkgs.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
|
{ config, lib, libjpeg, path }:
|
||||||
|
|
||||||
|
let
|
||||||
|
overlayJpegNoStatic = self: super: {
|
||||||
|
inherit libjpeg;
|
||||||
|
};
|
||||||
|
|
||||||
|
crossSystem = {
|
||||||
|
config = "${config.core.arch}-unknown-linux-android";
|
||||||
|
sdkVer = "24";
|
||||||
|
ndkVer = "18b";
|
||||||
|
useAndroidPrebuilt = true;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
cross = lib.loadNixpkgs { inherit crossSystem; };
|
||||||
|
|
||||||
|
crossStatic = lib.loadNixpkgs {
|
||||||
|
inherit crossSystem;
|
||||||
|
|
||||||
|
crossOverlays = [
|
||||||
|
(import "${path}/pkgs/top-level/static.nix")
|
||||||
|
overlayJpegNoStatic
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,13 +1,17 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
{ pinnedPkgs, crossStaticPkgs, talloc }:
|
{ callPackage, fetchFromGitHub, talloc }:
|
||||||
|
|
||||||
crossStaticPkgs.stdenv.mkDerivation rec {
|
let
|
||||||
|
pkgs = callPackage ./pkgs.nix { };
|
||||||
|
in
|
||||||
|
|
||||||
|
pkgs.crossStatic.stdenv.mkDerivation {
|
||||||
pname = "proot-termux";
|
pname = "proot-termux";
|
||||||
version = "unstable-2019-09-05";
|
version = "unstable-2019-09-05";
|
||||||
|
|
||||||
src = pinnedPkgs.fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
repo = "proot";
|
repo = "proot";
|
||||||
owner = "termux";
|
owner = "termux";
|
||||||
rev = "3ea655b1ae40bfa2ee612d45bf1e7ad97c4559f8";
|
rev = "3ea655b1ae40bfa2ee612d45bf1e7ad97c4559f8";
|
||||||
|
|
@ -1,23 +1,27 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
{ pinnedPkgs, crossPkgs }:
|
{ callPackage, fetchurl, python2, zlib }:
|
||||||
|
|
||||||
crossPkgs.stdenv.mkDerivation rec {
|
let
|
||||||
|
pkgs = callPackage ./pkgs.nix { };
|
||||||
|
in
|
||||||
|
|
||||||
|
pkgs.cross.stdenv.mkDerivation rec {
|
||||||
name = "talloc-2.1.14";
|
name = "talloc-2.1.14";
|
||||||
|
|
||||||
src = pinnedPkgs.fetchurl {
|
src = fetchurl {
|
||||||
url = "mirror://samba/talloc/${name}.tar.gz";
|
url = "mirror://samba/talloc/${name}.tar.gz";
|
||||||
sha256 = "1kk76dyav41ip7ddbbf04yfydb4jvywzi2ps0z2vla56aqkn11di";
|
sha256 = "1kk76dyav41ip7ddbbf04yfydb4jvywzi2ps0z2vla56aqkn11di";
|
||||||
};
|
};
|
||||||
|
|
||||||
depsBuildBuild = [ pinnedPkgs.python2 pinnedPkgs.zlib ];
|
depsBuildBuild = [ python2 zlib ];
|
||||||
|
|
||||||
buildDeps = [ crossPkgs.zlib ];
|
buildDeps = [ pkgs.cross.zlib ];
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
substituteInPlace buildtools/bin/waf \
|
substituteInPlace buildtools/bin/waf \
|
||||||
--replace "/usr/bin/env python" "${pinnedPkgs.python2}/bin/python"
|
--replace "/usr/bin/env python" "${python2}/bin/python"
|
||||||
./configure --prefix=$out \
|
./configure --prefix=$out \
|
||||||
--disable-rpath \
|
--disable-rpath \
|
||||||
--disable-python \
|
--disable-python \
|
||||||
|
|
@ -32,7 +36,7 @@ crossPkgs.stdenv.mkDerivation rec {
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/lib
|
mkdir -p $out/lib
|
||||||
make install
|
make install
|
||||||
${crossPkgs.stdenv.cc.targetPrefix}ar q $out/lib/libtalloc.a bin/default/talloc_[0-9]*.o
|
${pkgs.cross.stdenv.cc.targetPrefix}ar q $out/lib/libtalloc.a bin/default/talloc_[0-9]*.o
|
||||||
'';
|
'';
|
||||||
|
|
||||||
fixupPhase = "";
|
fixupPhase = "";
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
{ arch, buildPkgs, qemuAarch64Static }:
|
{ config, lib, stdenv, proot, qemuAarch64Static }:
|
||||||
|
|
||||||
let
|
let
|
||||||
buildRootDirectory = "root-directory";
|
buildRootDirectory = "root-directory";
|
||||||
filename = "nix-2.3.1-${arch}-linux.tar.xz.sha256";
|
filename = "nix-2.3.1-${config.core.arch}-linux.tar.xz.sha256";
|
||||||
|
|
||||||
sha256 = buildPkgs.stdenv.mkDerivation {
|
sha256 = stdenv.mkDerivation {
|
||||||
name = "nix-installer-sha256";
|
name = "nix-installer-sha256";
|
||||||
|
|
||||||
src = builtins.fetchurl "https://nixos.org/releases/nix/nix-2.3.1/${filename}";
|
src = builtins.fetchurl "https://nixos.org/releases/nix/nix-2.3.1/${filename}";
|
||||||
|
|
@ -19,10 +19,10 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
prootCommand = buildPkgs.lib.concatStringsSep " " [
|
prootCommand = lib.concatStringsSep " " [
|
||||||
"${buildPkgs.proot}/bin/proot"
|
"${proot}/bin/proot"
|
||||||
(
|
(
|
||||||
if arch == "aarch64"
|
if config.core.arch == "aarch64"
|
||||||
then "-q ${qemuAarch64Static}/bin/qemu-aarch64-static"
|
then "-q ${qemuAarch64Static}/bin/qemu-aarch64-static"
|
||||||
else "-b /dev"
|
else "-b /dev"
|
||||||
)
|
)
|
||||||
|
|
@ -31,13 +31,13 @@ let
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
|
|
||||||
buildPkgs.stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "nix-directory";
|
name = "nix-directory";
|
||||||
|
|
||||||
src = builtins.fetchurl {
|
src = builtins.fetchurl {
|
||||||
url = "https://nixos.org/releases/nix/nix-2.3.1/nix-2.3.1-${arch}-linux.tar.xz";
|
url = "https://nixos.org/releases/nix/nix-2.3.1/nix-2.3.1-${config.core.arch}-linux.tar.xz";
|
||||||
sha256 =
|
sha256 =
|
||||||
if arch == "aarch64"
|
if config.core.arch == "aarch64"
|
||||||
then "94a6a525bd0b2df82e14b96b5b0eaae86669b5d4671aacfc4db2db85325a81c1"
|
then "94a6a525bd0b2df82e14b96b5b0eaae86669b5d4671aacfc4db2db85325a81c1"
|
||||||
else "a5d3f26d4a449616bf654286f2fe29c1c1df4f029b7e29fa3ccf8494d598bfee"; # i686
|
else "a5d3f26d4a449616bf654286f2fe29c1c1df4f029b7e29fa3ccf8494d598bfee"; # i686
|
||||||
};
|
};
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
{ buildPkgs }:
|
{ stdenv, config }:
|
||||||
|
|
||||||
buildPkgs.stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "qemu-aarch64-static";
|
name = "qemu-aarch64-static";
|
||||||
|
|
||||||
src = builtins.fetchurl {
|
src = builtins.fetchurl {
|
||||||
42
src/pkgs/top-level/all-packages.nix
Normal file
42
src/pkgs/top-level/all-packages.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||||
|
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||||
|
|
||||||
|
{ config, lib, nixpkgs }:
|
||||||
|
|
||||||
|
let
|
||||||
|
callPackage = nixpkgs.lib.callPackageWith (
|
||||||
|
nixpkgs // pkgs // {
|
||||||
|
inherit callPackage;
|
||||||
|
|
||||||
|
config = nixpkgs.config // config;
|
||||||
|
|
||||||
|
lib = nixpkgs.lib // lib;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
pkgs = rec {
|
||||||
|
|
||||||
|
# files
|
||||||
|
|
||||||
|
files = callPackage ../files { } // { recurseForDerivations = true; };
|
||||||
|
|
||||||
|
# initial build
|
||||||
|
|
||||||
|
bootstrap = callPackage ../initial-build/bootstrap.nix { };
|
||||||
|
|
||||||
|
bootstrapZip = callPackage ../initial-build/bootstrap-zip.nix { };
|
||||||
|
|
||||||
|
nixDirectory = callPackage ../initial-build/nix-directory.nix { };
|
||||||
|
|
||||||
|
packageInfo = import "${nixDirectory}/nix-support/package-info.nix";
|
||||||
|
|
||||||
|
prootTermux = callPackage ../initial-build/cross-compiling/proot-termux.nix { };
|
||||||
|
|
||||||
|
qemuAarch64Static = callPackage ../initial-build/qemu-aarch64-static.nix { };
|
||||||
|
|
||||||
|
talloc = callPackage ../initial-build/cross-compiling/talloc.nix { };
|
||||||
|
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
|
pkgs
|
||||||
Loading…
Add table
Add a link
Reference in a new issue