Skip to content

Commit

Permalink
Update nixpkgs
Browse files Browse the repository at this point in the history
This requires two main changes:
- An update to the nixpkgs patch. It is now based on this draft PR:
  NixOS/nixpkgs#352629
- An update to the Lean runtime, as Lean is updated to v4.10.0. The
  changes come from Lean commit
  0a1a855ba80e51515570439f3d73d3d9414ac053.
  • Loading branch information
kuruczgy committed Dec 9, 2024
1 parent 7c8b9ae commit c8ee684
Show file tree
Hide file tree
Showing 9 changed files with 178 additions and 214 deletions.
7 changes: 4 additions & 3 deletions flake.lock

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

18 changes: 15 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.nixpkgs.url = "github:NixOS/nixpkgs?rev=fafe46fca0a8431dcdd3926a01fb06f51c33cab5";
outputs = { self, nixpkgs }:
let
eachDefaultSystem = f: builtins.zipAttrsWith
Expand All @@ -18,7 +18,19 @@
nixpkgs-patched = pkgsNative.applyPatches {
name = "nixpkgs-patched";
src = nixpkgs;
patches = [ ./patches/nixpkgs.patch ];
patches = [
(pkgsNative.fetchpatch {
# llvmPackages.libcxx: use hasSharedLibraries instead of isStatic
url = "https://github.com/NixOS/nixpkgs/commit/5a52d927a64347319bc08584f96e6ad0f2ec6f4f.patch";
hash = "sha256-pviFTa5C3Lk6YyyjQ9hEMUQpk4kfAQ4wPVEhwhK0lIc=";
})
(pkgsNative.fetchpatch {
# lib.systems: add various has* flags useful for embedded systems
url = "https://github.com/NixOS/nixpkgs/commit/e76ac5d0835e9e939c518ecb161491e595094907.patch";
hash = "sha256-3eJXYyMwkl6749ydcQ/pSNxKqjTOzpiRUUSvcOQMFWU=";
})
./patches/nixpkgs-ffunction-sections.patch
];
};

# Nixpkgs only has newlib, not picolibc, so we have to package it.
Expand Down Expand Up @@ -185,7 +197,7 @@
'';
hash = "sha256-yJ54S+HB3CH5/wb+GFwNkz3/990J8Z6GbuttDhWqN5Q=";
};
patches = finalAttrs.patches ++ [ ./patches/qemu.patch ];
patches = [ ./patches/qemu.patch ];
buildInputs = finalAttrs.buildInputs ++ [ pkgsNative.libgcrypt ];
configureFlags = finalAttrs.configureFlags ++ [ "--enable-gcrypt" ];
});
Expand Down
25 changes: 25 additions & 0 deletions patches/nixpkgs-ffunction-sections.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 39d3adfb1a91cff9a49172c3e17e6632a00f4b35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gy=C3=B6rgy=20Kurucz?= <[email protected]>
Date: Thu, 31 Oct 2024 15:24:34 +0100
Subject: [PATCH] [HACK DO NOT MERGE] -ffunction-sections

---
pkgs/development/compilers/llvm/common/libcxx/default.nix | 2 ++
1 file changed, 2 insertions(+)

diff --git a/pkgs/development/compilers/llvm/common/libcxx/default.nix b/pkgs/development/compilers/llvm/common/libcxx/default.nix
index 57fd748d0f39..8be9c118d7f5 100644
--- a/pkgs/development/compilers/llvm/common/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/common/libcxx/default.nix
@@ -129,6 +129,8 @@ in
stdenv.mkDerivation (rec {
inherit pname version cmakeFlags patches;

+ NIX_CFLAGS_COMPILE = [ "-ffunction-sections" ];
+
src = src';

outputs = [ "out" "dev" ];
--
2.47.0

127 changes: 0 additions & 127 deletions patches/nixpkgs.patch

This file was deleted.

5 changes: 5 additions & 0 deletions platform/lean/lean.h
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,12 @@ static inline size_t lean_string_byte_size(lean_object *o) {
}
/* instance : inhabited char := ⟨'A'⟩ */
static inline uint32_t lean_char_default_value() { return 'A'; }
LEAN_EXPORT lean_obj_res lean_mk_string_unchecked(char const *s, size_t sz,
size_t len);
LEAN_EXPORT lean_obj_res lean_mk_string_from_bytes(char const *s, size_t sz);
LEAN_EXPORT lean_obj_res lean_mk_string_from_bytes_unchecked(char const *s,
size_t sz);
LEAN_EXPORT lean_obj_res lean_mk_ascii_string_unchecked(char const *s);
LEAN_EXPORT lean_obj_res lean_mk_string(char const *s);
static inline char const *lean_string_cstr(b_lean_obj_arg o) {
assert(lean_is_string(o));
Expand Down
Loading

0 comments on commit c8ee684

Please sign in to comment.