pkgs/nix-directory: stop using qemu-user to init nix db

This commit is contained in:
Alexander Sosedkin 2021-12-08 21:48:38 +01:00
parent 6b9e3fbbec
commit 1629d13fd7
4 changed files with 7 additions and 27 deletions

View file

@ -205,7 +205,7 @@ Developer's device:
1. `proot` for the target platform is cross-compiled against `bionic`, 1. `proot` for the target platform is cross-compiled against `bionic`,
(to fake file paths like `/nix/store`; think 'userspace `chroot`') (to fake file paths like `/nix/store`; think 'userspace `chroot`')
2. Target `nix` is taken from the original release tarball 2. Target `nix` is taken from the original release tarball
3. Target `nix` database is initialized (with host `proot` and `qemu-user`) 3. Target `nix` database is initialized (using host `proot`)
4. Support scripts and config files are built with `nix` and the Nix-on-Droid 4. Support scripts and config files are built with `nix` and the Nix-on-Droid
module system module system
5. From these, a bootstrap zipball is built and published on an HTTP server 5. From these, a bootstrap zipball is built and published on an HTTP server

View file

@ -1,4 +1,4 @@
# Copyright (c) 2019-2020, see AUTHORS. Licensed under MIT License, see LICENSE. # Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE.
{ arch, nixOnDroidChannelURL ? null, nixpkgsChannelURL ? null }: { arch, nixOnDroidChannelURL ? null, nixpkgsChannelURL ? null }:
@ -44,7 +44,6 @@ let
bootstrap = callPackage ./bootstrap.nix { }; bootstrap = callPackage ./bootstrap.nix { };
bootstrapZip = callPackage ./bootstrap-zip.nix { }; bootstrapZip = callPackage ./bootstrap-zip.nix { };
prootTermux = callPackage ./cross-compiling/proot-termux.nix { }; prootTermux = callPackage ./cross-compiling/proot-termux.nix { };
qemuAarch64Static = callPackage ./qemu-aarch64-static.nix { };
tallocStatic = callPackage ./cross-compiling/talloc-static.nix { }; tallocStatic = callPackage ./cross-compiling/talloc-static.nix { };
}; };
in in

View file

@ -1,17 +1,13 @@
# Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE. # Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE.
{ config, lib, stdenv, closureInfo, prootTermux, proot, qemuAarch64Static }: { config, lib, stdenv, closureInfo, prootTermux, proot, pkgsStatic }:
let let
buildRootDirectory = "root-directory"; buildRootDirectory = "root-directory";
prootCommand = lib.concatStringsSep " " [ prootCommand = lib.concatStringsSep " " [
"${proot}/bin/proot" "${proot}/bin/proot"
( "-b ${pkgsStatic.nix}:/static-nix"
if config.build.arch == "aarch64"
then "-q ${qemuAarch64Static}/bin/qemu-aarch64-static"
else "-b /dev"
)
"-r ${buildRootDirectory}" "-r ${buildRootDirectory}"
"-w /" "-w /"
]; ];
@ -56,9 +52,9 @@ stdenv.mkDerivation {
cp --archive "$i" "${buildRootDirectory}$i" cp --archive "$i" "${buildRootDirectory}$i"
done done
USER=${config.user.userName} ${prootCommand} "$PKG_NIX/bin/nix-store" --init USER=${config.user.userName} ${prootCommand} "/static-nix/bin/nix-store" --init
USER=${config.user.userName} ${prootCommand} "$PKG_NIX/bin/nix-store" --load-db < .reginfo USER=${config.user.userName} ${prootCommand} "/static-nix/bin/nix-store" --load-db < .reginfo
USER=${config.user.userName} ${prootCommand} "$PKG_NIX/bin/nix-store" --load-db < ${prootTermuxClosure}/registration USER=${config.user.userName} ${prootCommand} "/static-nix/bin/nix-store" --load-db < ${prootTermuxClosure}/registration
cat > package-info.nix <<EOF cat > package-info.nix <<EOF
{ {

View file

@ -1,15 +0,0 @@
# Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE.
{ stdenv }:
stdenv.mkDerivation {
name = "qemu-aarch64-static";
src = builtins.fetchurl {
url = "https://github.com/multiarch/qemu-user-static/releases/download/v5.2.0-2/qemu-aarch64-static";
sha256 = "0v1c8nchf5s7db11spixp2gsp94018ig7nz2ha1f4bngr0bgbk92";
};
dontUnpack = true;
installPhase = "install -D -m 0755 $src $out/bin/qemu-aarch64-static";
}