nix-bundle icon indicating copy to clipboard operation
nix-bundle copied to clipboard

Question: Is it possible to have nix-user-chroot target aarch64-linux ?

Open 573 opened this issue 4 years ago • 5 comments

Had the probably stupid idea to change the expr to:

expr="with import <nixpkgs> { system=\"aarch64-linux\"; }; with import $nix_file {}; $bootstrap { target = $target; extraTargets = [ $extraTargets ]; run = \"$exec\"; }"

temporarily such that I can bundle apps for this architecture as well.

How oversimplified would that be ?

In other words is that something to achieve with nix-bundle anyway ?

573 avatar May 18 '21 19:05 573

It seems as if it is possible to just build a bundle for aarch64-linux like this:

#!/usr/bin/env bash
set -euo pipefail
export NIX_PATH=channel:nixos-20.09

out=$(nix-build --no-out-link --expr 'let pkgsArm = import <nixpkgs> { config = {}; overlays = []; system = "aarch64-linux"; }; pkgsCross = import <nixpkgs> { overlays = [(self: super: { inherit (pkgsArm.haskellPackages) hledger; })]; crossSystem = { config = "aarch64-unknown-linux-musl"; }; }; in pkgsCross.hledger')
./nix-bundle.sh "$out" /bin/hledger

Thanks for awesome piece of software engineering !

573 avatar May 19 '21 09:05 573

Using nix-shell -p hexdump it seems to work:

~/bin/neuron /tmp/tmpx-19ad44dfd2480e2e/dat/../run: line 1: ./nix/store/pxpaszz9l0j538i50cx4hm5f5dk0vyvw-startup: No such file or directory

573 avatar May 19 '21 10:05 573

Analog with hledger:

$ ~/bin/hledger ./nix/store/5q9fnnfsg32j23wkg9wzriv5jk9ywrp4-startup: line 2:  1253 Illegal instruction     ./nix/store/djb6njqj31dy84jcfhli07sina2gxx37-nix-user-chroot-2c52b5f/bin/nix-user-chroot -n ./nix -- /nix/store/j97652klcc6x96i78kw78r9ddqcbfqgk-vzqd3zpnpnzdi3yrh59yqa7l6ppd2bfi-hledger-1.19.1/bin/hledger "$@"

But

file -p /nix/store/j97652klcc6x96i78kw78r9ddqcbfqgk-vzqd3zpnpnzdi3yrh59yqa7l6ppd2bfi-hledger-1.19.1/bin/hledger

/nix/store/j97652klcc6x96i78kw78r9ddqcbfqgk-vzqd3zpnpnzdi3yrh59yqa7l6ppd2bfi-hledger-1.19.1/bin/hledger: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /nix/store/qga01pfppqf0j83awrz3v7g3h69cirhk-glibc-2.31-74/lib/ld-linux-aarch64.so.1, for GNU/Linux 2.6.32, stripped

let's me think bundling for aarch64 just works !

I'll open up a separate ticket for the illegal instruction message.

573 avatar May 19 '21 10:05 573

Sorry for the fuzz I have to reopen: Just saw

./nix/store/5q9fnnfsg32j23wkg9wzriv5jk9ywrp4-startup: line 2: 1253 Illegal instruction ./nix/store/djb6njqj31dy84jcfhli07sina2gxx37-nix-user-chroot-2c52b5f/bin/nix-user-chroot -n ./nix -- /nix/store

file -p /nix/store/djb6njqj31dy84jcfhli07sina2gxx37-nix-user-chroot-2c52b5f/bin/nix-user-chroot

/nix/store/djb6njqj31dy84jcfhli07sina2gxx37-nix-user-chroot-2c52b5f/bin/nix-user-chroot: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter ./nix/store/0c7c96gikmzv87i7lv3vq5s1cmfjd6zf-glibc-2.31-74/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped

So I tend to rename the issue "Question: Is it possible to have nix-user-chroot target aarch64-linux ?"

573 avatar May 19 '21 10:05 573

Pulling https://github.com/nix-community/nix-user-chroot/releases/tag/1.2.2 could be an option.

See #69 as well.

573 avatar May 19 '21 12:05 573