diff --git a/flake.lock b/flake.lock index 06a36b79..c6fe9a97 100644 --- a/flake.lock +++ b/flake.lock @@ -45,11 +45,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1664019863, - "narHash": "sha256-nXRRSPr2Jntx2hdZZMkds1fSDNUyw9N/wMtdcQ8VElU=", + "lastModified": 1708172716, + "narHash": "sha256-3M94oln0b61m3dUmLyECCA9hYAHXZEszM4saE3CmQO4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9c64b91d14268cf20ea07ea7930479a75325af9f", + "rev": "5d874ac46894c896119bce68e758e9e80bdb28f1", "type": "github" }, "original": { @@ -60,17 +60,17 @@ }, "nixpkgs-for-bootstrap": { "locked": { - "lastModified": 1686921029, - "narHash": "sha256-J1bX9plPCFhTSh6E3TWn9XSxggBh/zDD4xigyaIQBy8=", + "lastModified": 1708105575, + "narHash": "sha256-sS4AItZeUnAei6v8FqxNlm+/27MPlfoGym/TZP0rmH0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c7ff1b9b95620ce8728c0d7bd501c458e6da9e04", + "rev": "1d1817869c47682a6bee85b5b0a6537b6c0fba26", "type": "github" }, "original": { "owner": "NixOS", "repo": "nixpkgs", - "rev": "c7ff1b9b95620ce8728c0d7bd501c458e6da9e04", + "rev": "1d1817869c47682a6bee85b5b0a6537b6c0fba26", "type": "github" } }, diff --git a/flake.nix b/flake.nix index d2e0e661..9f341f1d 100644 --- a/flake.nix +++ b/flake.nix @@ -5,9 +5,9 @@ nixpkgs.url = "github:NixOS/nixpkgs"; # for bootstrap zip ball creation and proot-termux builds, we use a fixed version of nixpkgs to ease maintanence. - # head of nixos-23.05 as of 2023-06-18 + # head of nixos-23.11 as of 2024-02-17 # note: when updating nixpkgs-for-bootstrap, update store paths of proot-termux in modules/environment/login/default.nix - nixpkgs-for-bootstrap.url = "github:NixOS/nixpkgs/c7ff1b9b95620ce8728c0d7bd501c458e6da9e04"; + nixpkgs-for-bootstrap.url = "github:NixOS/nixpkgs/1d1817869c47682a6bee85b5b0a6537b6c0fba26"; home-manager = { url = "github:nix-community/home-manager"; diff --git a/modules/environment/login/default.nix b/modules/environment/login/default.nix index e51fa6ce..9409c4cd 100644 --- a/modules/environment/login/default.nix +++ b/modules/environment/login/default.nix @@ -82,7 +82,7 @@ in environment.files = { inherit login loginInner; - prootStatic = "/nix/store/yrrs22jsl1y8niwzs2vvk0vblicr3903-proot-termux-static-aarch64-unknown-linux-android-unstable-2023-05-13"; + prootStatic = "/nix/store/7w09z1kw62wg7nv3q3z2p6kxf1ihk178-proot-termux-static-aarch64-unknown-linux-android-unstable-2023-11-11"; }; }; diff --git a/overlays/lib/nixpkgs.nix b/overlays/lib/nixpkgs.nix index 324f4744..21674d43 100644 --- a/overlays/lib/nixpkgs.nix +++ b/overlays/lib/nixpkgs.nix @@ -3,12 +3,12 @@ { super }: let - # head of nixos-23.05 as of 2023-06-18 + # head of nixos-23.11 as of 2024-02-17 pinnedPkgsSrc = super.fetchFromGitHub { owner = "NixOS"; repo = "nixpkgs"; - rev = "c7ff1b9b95620ce8728c0d7bd501c458e6da9e04"; - sha256 = "sha256-J1bX9plPCFhTSh6E3TWn9XSxggBh/zDD4xigyaIQBy8="; + rev = "1d1817869c47682a6bee85b5b0a6537b6c0fba26"; + sha256 = "sha256-sS4AItZeUnAei6v8FqxNlm+/27MPlfoGym/TZP0rmH0="; }; in diff --git a/pkgs/cross-compiling/compiler-rt.patch b/pkgs/cross-compiling/compiler-rt.patch new file mode 100644 index 00000000..a7d9d19b --- /dev/null +++ b/pkgs/cross-compiling/compiler-rt.patch @@ -0,0 +1,16 @@ +diff --git a/pkgs/development/compilers/llvm/16/compiler-rt/default.nix b/pkgs/d +evelopment/compilers/llvm/16/compiler-rt/default.nix +index 0f15a9e12cde..a32533e5285c 100644 +--- a/pkgs/development/compilers/llvm/16/compiler-rt/default.nix ++++ b/pkgs/development/compilers/llvm/16/compiler-rt/default.nix +@@ -130,8 +130,8 @@ stdenv.mkDerivation { + # The presence of crtbegin_shared has been added and removed; it's possible + # people have added/removed it to get it working on their platforms. + # Try each in turn for now. +- ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbeginS.o +- ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtendS.o ++ #ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbeginS.o ++ #ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtendS.o + ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o + ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o + '' + lib.optionalString doFakeLibgcc '' diff --git a/pkgs/cross-compiling/cross-pkgs-args.nix b/pkgs/cross-compiling/cross-pkgs-args.nix index 7b134ab6..c0c1bbac 100644 --- a/pkgs/cross-compiling/cross-pkgs-args.nix +++ b/pkgs/cross-compiling/cross-pkgs-args.nix @@ -1,6 +1,6 @@ -# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE. +# Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE. -{ config, nixpkgs, system }: +{ config, system }: { inherit system; diff --git a/pkgs/cross-compiling/cross-pkgs.nix b/pkgs/cross-compiling/cross-pkgs.nix new file mode 100644 index 00000000..66c29af3 --- /dev/null +++ b/pkgs/cross-compiling/cross-pkgs.nix @@ -0,0 +1,18 @@ +# Copyright (c) 2019-2024, see AUTHORS. Licensed under MIT License, see LICENSE. + +{ callPackage, nixpkgs, system }: + +let + args = callPackage ./cross-pkgs-args.nix { }; + pkgsCross-imported = import nixpkgs args; + pkgsCross-patched = pkgsCross-imported.applyPatches { + name = "nixpkgs-crosscompilation-patched"; + src = nixpkgs; + patches = [ + ./compiler-rt.patch + ./libunwind.patch + ]; + }; + pkgsCross = import pkgsCross-patched args; +in +pkgsCross diff --git a/pkgs/cross-compiling/libunwind.patch b/pkgs/cross-compiling/libunwind.patch new file mode 100644 index 00000000..c1746149 --- /dev/null +++ b/pkgs/cross-compiling/libunwind.patch @@ -0,0 +1,13 @@ +diff --git a/pkgs/development/compilers/llvm/16/libunwind/default.nix b/pkgs/development/compilers/llvm/16/libunwind/default.nix +index 1b677a7a2c0d..6c16e869a085 100644 +--- a/pkgs/development/compilers/llvm/16/libunwind/default.nix ++++ b/pkgs/development/compilers/llvm/16/libunwind/default.nix +@@ -49,6 +49,8 @@ stdenv.mkDerivation rec { + + nativeBuildInputs = [ cmake ninja python3 ]; + ++ LDFLAGS = "-unwindlib=none"; ++ + cmakeFlags = [ + "-DLLVM_ENABLE_RUNTIMES=libunwind" + ] ++ lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF"; diff --git a/pkgs/cross-compiling/proot-termux.nix b/pkgs/cross-compiling/proot-termux.nix index 7a441a14..8bbce24f 100644 --- a/pkgs/cross-compiling/proot-termux.nix +++ b/pkgs/cross-compiling/proot-termux.nix @@ -1,9 +1,9 @@ # Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE. -{ callPackage, nixpkgs, tallocStatic }: +{ callPackage, tallocStatic }: let - pkgsCross = import nixpkgs (callPackage ./cross-pkgs-args.nix { }); + pkgsCross = callPackage ./cross-pkgs.nix { }; stdenv = pkgsCross.stdenvAdapters.makeStaticBinaries pkgsCross.stdenv; in diff --git a/pkgs/cross-compiling/talloc-static.nix b/pkgs/cross-compiling/talloc-static.nix index ffb8eb37..9c7f1599 100644 --- a/pkgs/cross-compiling/talloc-static.nix +++ b/pkgs/cross-compiling/talloc-static.nix @@ -1,7 +1,6 @@ # Copyright (c) 2019-2023, see AUTHORS. Licensed under MIT License, see LICENSE. { callPackage -, nixpkgs , fetchurl , python3 , pkg-config @@ -9,7 +8,7 @@ }: let - pkgsCross = import nixpkgs (callPackage ./cross-pkgs-args.nix { }); + pkgsCross = callPackage ./cross-pkgs.nix { }; in pkgsCross.stdenv.mkDerivation rec { diff --git a/pkgs/proot-termux/default.nix b/pkgs/proot-termux/default.nix index f14c4ef6..51b5aa13 100644 --- a/pkgs/proot-termux/default.nix +++ b/pkgs/proot-termux/default.nix @@ -23,14 +23,18 @@ stdenv.mkDerivation { mkdir -p fake-ashmem/linux; cat > fake-ashmem/linux/ashmem.h << EOF #include #include + #include #define __ASHMEMIOC 0x77 #define ASHMEM_NAME_LEN 256 #define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN]) #define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t) #define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4) EOF + substituteInPlace src/arch.h --replace \ + '#define HAS_LOADER_32BIT true' \ + "" + ! (grep -F '#define HAS_LOADER_32BIT' src/arch.h) ''; - buildInputs = [ talloc ]; patches = [ ./detranslate-empty.patch ]; makeFlags = [ "-Csrc" "V=1" ];