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,6 +1,6 @@
# Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE.
{ config, lib, pkgs, initialPackageInfo, ... }:
{ config, lib, pkgs, initialPackageInfo, targetSystem, ... }:
with lib;
@ -9,7 +9,9 @@ let
login = pkgs.callPackage ./login.nix { inherit config; };
loginInner = pkgs.callPackage ./login-inner.nix { inherit config initialPackageInfo; };
loginInner = pkgs.callPackage ./login-inner.nix {
inherit config initialPackageInfo targetSystem;
};
in
{
@ -85,11 +87,11 @@ in
prootStatic =
let
crossCompiledPaths = {
aarch64 = "/nix/store/7w09z1kw62wg7nv3q3z2p6kxf1ihk178-proot-termux-static-aarch64-unknown-linux-android-unstable-2023-11-11";
x86_64 = "/nix/store/i6jppi627sakbgm5x2a8jjdfyv8571zc-proot-termux-static-x86_64-unknown-linux-android-unstable-2023-11-11";
aarch64-linux = "/nix/store/7w09z1kw62wg7nv3q3z2p6kxf1ihk178-proot-termux-static-aarch64-unknown-linux-android-unstable-2023-11-11";
x86_64-linux = "/nix/store/i6jppi627sakbgm5x2a8jjdfyv8571zc-proot-termux-static-x86_64-unknown-linux-android-unstable-2023-11-11";
};
in
"${crossCompiledPaths.${config.build.arch}}";
"${crossCompiledPaths.${targetSystem}}";
};
};

View file

@ -1,6 +1,6 @@
# Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE.
{ config, lib, initialPackageInfo, writeText }:
{ config, lib, initialPackageInfo, writeText, targetSystem }:
let
inherit (initialPackageInfo) cacert nix;
@ -80,15 +80,20 @@ writeText "login-inner" ''
${nixCmd} flake new ${config.user.home}/.config/nix-on-droid --template ${config.build.flake.nix-on-droid}
${lib.optionalString config.build.flake.inputOverrides ''
echo "Overriding input urls / arch in flake..."
echo "Overriding input urls in the flake..."
${nixCmd} run nixpkgs#gnused -- \
-i \
-e 's,\"aarch64-linux",\"${config.build.arch}-linux\",' \
-e 's,\"github:NixOS/nixpkgs.*\",\"${config.build.flake.nixpkgs}\",' \
-e 's,\"github:nix-community/nix-on-droid.*\",\"${config.build.flake.nix-on-droid}\",' \
"${config.user.home}/.config/nix-on-droid/flake.nix"
''}
echo "Overriding system value in the flake..."
${nixCmd} run nixpkgs#gnused -- \
-i \
-e 's,\"aarch64-linux",\"${targetSystem}\",' \
"${config.user.home}/.config/nix-on-droid/flake.nix"
echo "Installing first Nix-on-Droid generation..."
${nixCmd} run ${config.build.flake.nix-on-droid} -- switch --flake ${config.user.home}/.config/nix-on-droid