modules, ...: get rid of config.build.arch

This commit is contained in:
Alexander Sosedkin 2024-06-22 20:53:32 +02:00
parent 54a535b91b
commit 45fcd2da39
15 changed files with 67 additions and 54 deletions

View file

@ -1,9 +1,12 @@
# Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE.
# Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE.
{ config, runCommand, zip, bootstrap }:
{ lib, runCommand, zip, bootstrap, targetSystem }:
let
arch = lib.strings.removeSuffix "-linux" targetSystem;
in
runCommand "bootstrap-zip" { } ''
mkdir $out
cd ${bootstrap}
${zip}/bin/zip -q -9 -r $out/bootstrap-${config.build.arch} ./* ./.l2s
${zip}/bin/zip -q -9 -r $out/bootstrap-${arch} ./* ./.l2s
''

View file

@ -1,12 +1,15 @@
# Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE.
{ config, system }:
{ lib, config, system, targetSystem }:
let
arch = lib.strings.removeSuffix "-linux" targetSystem;
in
{
inherit system;
crossSystem = {
config = "${config.build.arch}-unknown-linux-android";
config = "${arch}-unknown-linux-android";
sdkVer = "32";
libc = "bionic";
useAndroidPrebuilt = false;

View file

@ -1,6 +1,6 @@
# Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE.
{ callPackage, nixpkgs, system }:
{ callPackage, nixpkgs }:
let
args = callPackage ./cross-pkgs-args.nix { };

View file

@ -1,18 +1,19 @@
# Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE.
{ nixpkgs
, system
, arch ? "aarch64"
, system # system to compile for, user-facing name of targetSystem
, _nativeSystem ? null # system to cross-compile from, see flake.nix
, nixOnDroidChannelURL ? null
, nixpkgsChannelURL ? null
, nixOnDroidFlakeURL ? null
}:
let
nixDirectory = callPackage ./nix-directory.nix { };
nativeSystem = if _nativeSystem == null then system else _nativeSystem;
nixDirectory = callPackage ./nix-directory.nix { inherit system; };
initialPackageInfo = import "${nixDirectory}/nix-support/package-info.nix";
pkgs = import nixpkgs { inherit system; };
pkgs = import nixpkgs { system = nativeSystem; };
urlOptionValue = url: envVar:
let
@ -24,6 +25,7 @@ let
modules = import ../modules {
inherit pkgs;
targetSystem = system;
isFlake = true;
@ -41,11 +43,6 @@ let
user.shell = "${initialPackageInfo.bash}/bin/bash";
build = {
arch =
if arch != null
then arch
else nixpkgs.lib.strings.removeSuffix "-linux" builtins.currentSystem;
channel = {
nixpkgs = urlOptionValue nixpkgsChannelURL "NIXPKGS_CHANNEL_URL";
nix-on-droid = urlOptionValue nixOnDroidChannelURL "NIX_ON_DROID_CHANNEL_URL";
@ -60,6 +57,7 @@ let
pkgs // customPkgs // {
inherit (modules) config;
inherit callPackage nixpkgs nixDirectory initialPackageInfo;
targetSystem = system;
}
);

View file

@ -1,6 +1,6 @@
# Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE.
{ config, lib, stdenv, closureInfo, prootTermux, proot, pkgsStatic }:
{ config, lib, stdenv, closureInfo, prootTermux, proot, pkgsStatic, system }:
let
buildRootDirectory = "root-directory";
@ -24,15 +24,15 @@ stdenv.mkDerivation {
name = "nix-directory";
src = builtins.fetchurl {
url = "https://nixos.org/releases/nix/nix-2.20.5/nix-2.20.5-${config.build.arch}-linux.tar.xz";
url = "https://nixos.org/releases/nix/nix-2.20.5/nix-2.20.5-${system}.tar.xz";
sha256 =
let
archShas = {
aarch64 = "sha256:168wjfj3xsc8hq1y6cq59iipjp1g9hmj4n5wdn9c47ad9gbc9cvh";
x86_64 = "sha256:0dax9n562ldj53ap6lz0cwwsfx4d8j1267g9s6lg3zs237yyzw61";
nixShas = {
aarch64-linux = "sha256:168wjfj3xsc8hq1y6cq59iipjp1g9hmj4n5wdn9c47ad9gbc9cvh";
x86_64-linux = "sha256:0dax9n562ldj53ap6lz0cwwsfx4d8j1267g9s6lg3zs237yyzw61";
};
in
archShas.${config.build.arch};
nixShas.${system};
};
PROOT_NO_SECCOMP = 1; # see https://github.com/proot-me/PRoot/issues/106