Skip to content

Commit

Permalink
update nixpkgs; applyPatches to fix toolchain (nixpkgs!269077)
Browse files Browse the repository at this point in the history
  • Loading branch information
t184256 committed Mar 3, 2024
1 parent 45272c7 commit 2f3d8cc
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 20 deletions.
14 changes: 7 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion modules/environment/login/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};

};
Expand Down
6 changes: 3 additions & 3 deletions overlays/lib/nixpkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 16 additions & 0 deletions pkgs/cross-compiling/compiler-rt.patch
Original file line number Diff line number Diff line change
@@ -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 ''
4 changes: 2 additions & 2 deletions pkgs/cross-compiling/cross-pkgs-args.nix
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
18 changes: 18 additions & 0 deletions pkgs/cross-compiling/cross-pkgs.nix
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions pkgs/cross-compiling/libunwind.patch
Original file line number Diff line number Diff line change
@@ -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";
4 changes: 2 additions & 2 deletions pkgs/cross-compiling/proot-termux.nix
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 1 addition & 2 deletions pkgs/cross-compiling/talloc-static.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Copyright (c) 2019-2023, see AUTHORS. Licensed under MIT License, see LICENSE.

{ callPackage
, nixpkgs
, fetchurl
, python3
, pkg-config
, wafHook
}:

let
pkgsCross = import nixpkgs (callPackage ./cross-pkgs-args.nix { });
pkgsCross = callPackage ./cross-pkgs.nix { };
in

pkgsCross.stdenv.mkDerivation rec {
Expand Down
6 changes: 5 additions & 1 deletion pkgs/proot-termux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ stdenv.mkDerivation {
mkdir -p fake-ashmem/linux; cat > fake-ashmem/linux/ashmem.h << EOF
#include <linux/limits.h>
#include <linux/ioctl.h>
#include <string.h>
#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" ];
Expand Down

0 comments on commit 2f3d8cc

Please sign in to comment.