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

@ -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 }:
@ -44,7 +44,6 @@ let
bootstrap = callPackage ./bootstrap.nix { };
bootstrapZip = callPackage ./bootstrap-zip.nix { };
prootTermux = callPackage ./cross-compiling/proot-termux.nix { };
qemuAarch64Static = callPackage ./qemu-aarch64-static.nix { };
tallocStatic = callPackage ./cross-compiling/talloc-static.nix { };
};
in

View file

@ -1,17 +1,13 @@
# 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
buildRootDirectory = "root-directory";
prootCommand = lib.concatStringsSep " " [
"${proot}/bin/proot"
(
if config.build.arch == "aarch64"
then "-q ${qemuAarch64Static}/bin/qemu-aarch64-static"
else "-b /dev"
)
"-b ${pkgsStatic.nix}:/static-nix"
"-r ${buildRootDirectory}"
"-w /"
];
@ -56,9 +52,9 @@ stdenv.mkDerivation {
cp --archive "$i" "${buildRootDirectory}$i"
done
USER=${config.user.userName} ${prootCommand} "$PKG_NIX/bin/nix-store" --init
USER=${config.user.userName} ${prootCommand} "$PKG_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" --init
USER=${config.user.userName} ${prootCommand} "/static-nix/bin/nix-store" --load-db < .reginfo
USER=${config.user.userName} ${prootCommand} "/static-nix/bin/nix-store" --load-db < ${prootTermuxClosure}/registration
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";
}