mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
modules, ...: get rid of config.build.arch
This commit is contained in:
parent
54a535b91b
commit
45fcd2da39
15 changed files with 67 additions and 54 deletions
|
|
@ -11,13 +11,6 @@ with lib;
|
|||
options = {
|
||||
|
||||
build = {
|
||||
arch = mkOption {
|
||||
type = types.enum [ "aarch64" "x86_64" ];
|
||||
default = strings.removeSuffix "-linux" builtins.currentSystem;
|
||||
internal = true;
|
||||
description = "Destination arch.";
|
||||
};
|
||||
|
||||
initialBuild = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
|
||||
# Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE.
|
||||
|
||||
{ config ? null
|
||||
{ targetSystem ? builtins.currentSystem # system to compile for
|
||||
, config ? null
|
||||
, extraSpecialArgs ? { }
|
||||
, pkgs ? import <nixpkgs> { }
|
||||
, home-manager-path ? <home-manager>
|
||||
|
|
@ -17,7 +18,9 @@ let
|
|||
else if builtins.pathExists defaultConfigFile then defaultConfigFile
|
||||
else pkgs.config.nix-on-droid or (throw "No config file found! Create one in ~/.config/nixpkgs/nix-on-droid.nix");
|
||||
|
||||
nodModules = import ./module-list.nix { inherit pkgs home-manager-path isFlake; };
|
||||
nodModules = import ./module-list.nix {
|
||||
inherit pkgs home-manager-path isFlake targetSystem;
|
||||
};
|
||||
|
||||
rawModule = evalModules {
|
||||
modules = [ configModule ] ++ nodModules;
|
||||
|
|
|
|||
|
|
@ -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}}";
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
|
||||
# Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE.
|
||||
|
||||
{ pkgs, home-manager-path, isFlake }:
|
||||
{ pkgs
|
||||
, home-manager-path
|
||||
, isFlake
|
||||
, targetSystem # system to cross-compile to
|
||||
}:
|
||||
|
||||
[
|
||||
./build/activation.nix
|
||||
|
|
@ -26,7 +30,7 @@
|
|||
{
|
||||
_file = ./module-list.nix;
|
||||
_module.args = {
|
||||
inherit home-manager-path isFlake;
|
||||
inherit home-manager-path isFlake targetSystem;
|
||||
pkgs = pkgs.lib.mkDefault pkgs;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue