From 27867c79a7f7ba3ee9b1c4ee324a05c4d3d1d960 Mon Sep 17 00:00:00 2001 From: Kovacsics Robert Date: Sun, 12 Mar 2023 06:44:18 +0000 Subject: [PATCH 1/5] Generate tarball for com.termux It supports symlinks (yay) --- modules/build/config.nix | 2 +- modules/user.nix | 2 +- pkgs/bootstrap-zip.nix | 4 ++-- pkgs/bootstrap.nix | 9 --------- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/modules/build/config.nix b/modules/build/config.nix index ea971ee..99ac52b 100644 --- a/modules/build/config.nix +++ b/modules/build/config.nix @@ -43,7 +43,7 @@ with lib; config = { - build.installationDir = "/data/data/com.termux.nix/files/usr"; + build.installationDir = "/data/data/com.termux/files/usr"; }; diff --git a/modules/user.nix b/modules/user.nix index 6ed9f91..fba72dd 100644 --- a/modules/user.nix +++ b/modules/user.nix @@ -91,7 +91,7 @@ in user = { group = "nix-on-droid"; - home = "/data/data/com.termux.nix/files/home"; + home = "/data/data/com.termux/files/home"; userName = "nix-on-droid"; }; diff --git a/pkgs/bootstrap-zip.nix b/pkgs/bootstrap-zip.nix index a16ec3e..75bd1b9 100644 --- a/pkgs/bootstrap-zip.nix +++ b/pkgs/bootstrap-zip.nix @@ -1,6 +1,6 @@ # Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE. -{ lib, runCommand, zip, bootstrap, targetSystem }: +{ lib, runCommand, gnutar, bootstrap, targetSystem }: let arch = lib.strings.removeSuffix "-linux" targetSystem; @@ -8,5 +8,5 @@ in runCommand "bootstrap-zip" { } '' mkdir $out cd ${bootstrap} - ${zip}/bin/zip -q -9 -r $out/bootstrap-${arch} ./* ./.l2s + ${gnutar}/bin/tar czf $out/bootstrap-${arch}.tar.gz ./* ./.l2s '' diff --git a/pkgs/bootstrap.nix b/pkgs/bootstrap.nix index 74c47fa..6f79b93 100644 --- a/pkgs/bootstrap.nix +++ b/pkgs/bootstrap.nix @@ -22,13 +22,4 @@ runCommand "bootstrap" { } '' cp --dereference --recursive $out/etc/static $out/etc/.static.tmp rm $out/etc/static mv $out/etc/.static.tmp $out/etc/static - - find $out -executable -type f | sed s@^$out/@@ > $out/EXECUTABLES.txt - - find $out -type l | while read -r LINK; do - LNK=''${LINK#$out/} - TGT=$(readlink "$LINK") - echo "$TGT←$LNK" >> $out/SYMLINKS.txt - rm "$LINK" - done '' From f6ecf3b9329fd4d1d2d390c4a914f55e79acdc13 Mon Sep 17 00:00:00 2001 From: Kovacsics Robert Date: Sun, 12 Mar 2023 19:40:41 +0000 Subject: [PATCH 2/5] Use custom nix installation path to avoid overlap with termux --- modules/build/config.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/build/config.nix b/modules/build/config.nix index 99ac52b..e23f8e7 100644 --- a/modules/build/config.nix +++ b/modules/build/config.nix @@ -43,7 +43,7 @@ with lib; config = { - build.installationDir = "/data/data/com.termux/files/usr"; + build.installationDir = "/data/data/com.termux/files/nix"; }; From 55cc8f0210f326f5f12f1840e001616acbad9c18 Mon Sep 17 00:00:00 2001 From: Kovacsics Robert Date: Sun, 12 Mar 2023 22:54:31 +0000 Subject: [PATCH 3/5] Unset LD_LIBRARY_PATH and LD_PRELOAD to avoid `invalid ELF header` The error /data/data/com.termux/files/nix/bin/sh: error while loading shared libraries: /nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/libc.so: invalid ELF header it seems to happen because of LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so which doesn't support the .so file being a linker script .../files/nix $ cat ./nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/libc.so /* GNU ld script Use the shared library, but some functions are only in the static library, so try that secondarily. */ OUTPUT_FORMAT(elf64-littleaarch64) GROUP ( /nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/libc.so.6 /nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/libc_nonshared.a AS_NEEDED ( /nix/store/6afvzgx3himw7584k9zmfxmqd86b1z7j-glibc-2.34-210/lib/ld-linux-aarch64.so.1 ) ) --- modules/environment/login/login.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/environment/login/login.nix b/modules/environment/login/login.nix index 4052d73..540c607 100644 --- a/modules/environment/login/login.nix +++ b/modules/environment/login/login.nix @@ -46,6 +46,11 @@ writeScript "login" '' BIND_PROC_UPTIME="" fi + # See https://github.com/CypherpunkArmory/UserLAnd/issues/1333 + unset LD_LIBRARY_PATH + unset LD_PRELOAD + + exec ${installationDir}/bin/proot-static \ -b ${installationDir}/nix:/nix \ -b ${installationDir}/bin:/bin! \ From 4af477a1b4af8b7dddbb333109f781376d6d9dec Mon Sep 17 00:00:00 2001 From: Kovacsics Robert Date: Wed, 27 Nov 2024 00:30:25 +0000 Subject: [PATCH 4/5] Bump nixpkgs-docs to follow nixpkgs --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index ad92e98..47f7b7a 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,7 @@ inputs.nmd.follows = "nmd"; }; - nixpkgs-docs.url = "github:NixOS/nixpkgs/release-23.05"; + nixpkgs-docs.follows = "nixpkgs"; nmd = { url = "sourcehut:~rycee/nmd"; From 101d81c960d3b0a31982673365f5282d2638b16a Mon Sep 17 00:00:00 2001 From: Kovacsics Robert Date: Wed, 27 Nov 2024 00:31:18 +0000 Subject: [PATCH 5/5] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'home-manager': 'github:nix-community/home-manager/4de84265d7ec7634a69ba75028696d74de9a44a7?narHash=sha256-DVv6nd9FQBbMWbOmhq0KVqmlc3y3FMSYl49UXmMcO%2B0%3D' (2024-03-03) → 'github:nix-community/home-manager/a9953635d7f34e7358d5189751110f87e3ac17da?narHash=sha256-GUffLwzawz5WRVfWaWCg78n/HrBJrOG7QadFY6rtV8A%3D' (2024-11-24) • Updated input 'nix-formatter-pack': 'github:Gerschtli/nix-formatter-pack/2de39dedd79aab14c01b9e2934842051a160ffa5?narHash=sha256-HgSTREh7VoXjGgNDwKQUYcYo13rPkltW7IitHrTPA5c%3D' (2024-01-14) → 'github:Gerschtli/nix-formatter-pack/9f4bcf647cad2edafda7e1143071e0daf37cbc41?narHash=sha256-TxJ7RZLlBkKWZos1ai3eWIH0fBq1G6SVE%2Bq3dW%2B0qRU%3D' (2024-10-20) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/5d874ac46894c896119bce68e758e9e80bdb28f1?narHash=sha256-3M94oln0b61m3dUmLyECCA9hYAHXZEszM4saE3CmQO4%3D' (2024-02-17) → 'github:NixOS/nixpkgs/69661586d1c9d85e859887d95285f6fc92521657?narHash=sha256-BWzlDJpfcE7DgxtAkeXHnU69Iz6cU64yCgE6b%2Bhqds8%3D' (2024-11-26) • Updated input 'nixpkgs-docs': 'github:NixOS/nixpkgs/9a333eaa80901efe01df07eade2c16d183761fa3?narHash=sha256-Q8LJaVZGJ9wo33wBafvZSzapYsjOaNjP/pOnSiKVGHY%3D' (2024-01-22) → follows 'nixpkgs' --- flake.lock | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/flake.lock b/flake.lock index 888acae..74a88fc 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1709445365, - "narHash": "sha256-DVv6nd9FQBbMWbOmhq0KVqmlc3y3FMSYl49UXmMcO+0=", + "lastModified": 1732482255, + "narHash": "sha256-GUffLwzawz5WRVfWaWCg78n/HrBJrOG7QadFY6rtV8A=", "owner": "nix-community", "repo": "home-manager", - "rev": "4de84265d7ec7634a69ba75028696d74de9a44a7", + "rev": "a9953635d7f34e7358d5189751110f87e3ac17da", "type": "github" }, "original": { @@ -31,11 +31,11 @@ "nmt": "nmt" }, "locked": { - "lastModified": 1705252799, - "narHash": "sha256-HgSTREh7VoXjGgNDwKQUYcYo13rPkltW7IitHrTPA5c=", + "lastModified": 1729445390, + "narHash": "sha256-TxJ7RZLlBkKWZos1ai3eWIH0fBq1G6SVE+q3dW+0qRU=", "owner": "Gerschtli", "repo": "nix-formatter-pack", - "rev": "2de39dedd79aab14c01b9e2934842051a160ffa5", + "rev": "9f4bcf647cad2edafda7e1143071e0daf37cbc41", "type": "github" }, "original": { @@ -46,11 +46,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1708172716, - "narHash": "sha256-3M94oln0b61m3dUmLyECCA9hYAHXZEszM4saE3CmQO4=", + "lastModified": 1732665169, + "narHash": "sha256-BWzlDJpfcE7DgxtAkeXHnU69Iz6cU64yCgE6b+hqds8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5d874ac46894c896119bce68e758e9e80bdb28f1", + "rev": "69661586d1c9d85e859887d95285f6fc92521657", "type": "github" }, "original": { @@ -59,22 +59,6 @@ "type": "github" } }, - "nixpkgs-docs": { - "locked": { - "lastModified": 1705957679, - "narHash": "sha256-Q8LJaVZGJ9wo33wBafvZSzapYsjOaNjP/pOnSiKVGHY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9a333eaa80901efe01df07eade2c16d183761fa3", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "release-23.05", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs-for-bootstrap": { "locked": { "lastModified": 1720244366, @@ -133,7 +117,9 @@ "home-manager": "home-manager", "nix-formatter-pack": "nix-formatter-pack", "nixpkgs": "nixpkgs", - "nixpkgs-docs": "nixpkgs-docs", + "nixpkgs-docs": [ + "nixpkgs" + ], "nixpkgs-for-bootstrap": "nixpkgs-for-bootstrap", "nmd": "nmd" }