From b10dd78e183f76dbb15711475fa7643b55046757 Mon Sep 17 00:00:00 2001 From: Tobias Happ Date: Sat, 24 Sep 2022 13:43:49 +0200 Subject: [PATCH] bootstrap: refactor special args to reduce inputs --- modules/environment/login/default.nix | 4 ++-- modules/environment/login/login-inner.nix | 6 +++--- pkgs/bootstrap.nix | 10 +++------- pkgs/default.nix | 11 +++++------ 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/modules/environment/login/default.nix b/modules/environment/login/default.nix index cabaa12..ceefc30 100644 --- a/modules/environment/login/default.nix +++ b/modules/environment/login/default.nix @@ -1,6 +1,6 @@ # Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE. -{ config, lib, pkgs, customPkgs, ... }: +{ config, lib, pkgs, initialPackageInfo, ... }: with lib; @@ -9,7 +9,7 @@ let login = pkgs.callPackage ./login.nix { inherit config; }; - loginInner = pkgs.callPackage ./login-inner.nix { inherit config customPkgs; }; + loginInner = pkgs.callPackage ./login-inner.nix { inherit config initialPackageInfo; }; in { diff --git a/modules/environment/login/login-inner.nix b/modules/environment/login/login-inner.nix index ff5ee59..3f3059a 100644 --- a/modules/environment/login/login-inner.nix +++ b/modules/environment/login/login-inner.nix @@ -1,9 +1,9 @@ -# Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE. +# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE. -{ config, lib, customPkgs, writeText }: +{ config, lib, initialPackageInfo, writeText }: let - inherit (customPkgs.packageInfo) cacert nix; + inherit (initialPackageInfo) cacert nix; in writeText "login-inner" '' diff --git a/pkgs/bootstrap.nix b/pkgs/bootstrap.nix index 8dad8ff..7e76299 100644 --- a/pkgs/bootstrap.nix +++ b/pkgs/bootstrap.nix @@ -1,10 +1,6 @@ -# Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE. +# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE. -{ runCommand, nixDirectory, prootTermux, bash, pkgs, config }: - -let - packageInfo = import "${nixDirectory}/nix-support/package-info.nix"; -in +{ runCommand, nixDirectory, prootTermux, bash, pkgs, config, initialPackageInfo }: runCommand "bootstrap" { } '' mkdir --parents $out/{.l2s,bin,dev/shm,etc,nix,root,tmp,usr/{bin,lib}} @@ -13,7 +9,7 @@ runCommand "bootstrap" { } '' cp --recursive ${nixDirectory}/var $out/nix/var chmod --recursive u+w $out/nix - ln --symbolic ${packageInfo.bash}/bin/sh $out/bin/sh + ln --symbolic ${initialPackageInfo.bash}/bin/sh $out/bin/sh install -D -m 0755 ${prootTermux}/bin/proot-static $out/bin/proot-static diff --git a/pkgs/default.nix b/pkgs/default.nix index 9bfac85..c613c36 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,10 +1,10 @@ -# Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE. +# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE. { arch ? "aarch64", nixOnDroidChannelURL ? null, nixpkgsChannelURL ? null }: let nixDirectory = callPackage ./nix-directory.nix { }; - packageInfo = import "${nixDirectory}/nix-support/package-info.nix"; + initialPackageInfo = import "${nixDirectory}/nix-support/package-info.nix"; nixpkgs = import lib/load-nixpkgs.nix { }; @@ -13,13 +13,13 @@ let extraModules = [ ../modules/build/initial-build.nix ]; extraSpecialArgs = { - inherit customPkgs; + inherit initialPackageInfo; pkgs = nixpkgs.lib.mkForce nixpkgs; # to override ./modules/nixpkgs/config.nix }; config = { # Fix invoking bash after initial build. - user.shell = "${packageInfo.bash}/bin/bash"; + user.shell = "${initialPackageInfo.bash}/bin/bash"; build = { inherit arch; @@ -35,12 +35,11 @@ let callPackage = nixpkgs.lib.callPackageWith ( nixpkgs // customPkgs // { inherit (modules) config; - inherit callPackage; + inherit callPackage nixpkgs nixDirectory initialPackageInfo; } ); customPkgs = { - inherit nixDirectory packageInfo; bootstrap = callPackage ./bootstrap.nix { }; bootstrapZip = callPackage ./bootstrap-zip.nix { }; prootTermux = callPackage ./cross-compiling/proot-termux.nix { };