about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nixos/modules/misc/version.nix9
-rw-r--r--nixos/modules/profiles/installation-device.nix1
-rw-r--r--pkgs/development/compilers/zig/default.nix24
-rw-r--r--pkgs/development/compilers/zig/ventura.patch50
-rw-r--r--pkgs/development/interpreters/php/generic.nix17
-rw-r--r--pkgs/development/libraries/minilibx/default.nix62
-rw-r--r--pkgs/top-level/all-packages.nix2
7 files changed, 163 insertions, 2 deletions
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix
index 1067b21a22b07..c9e06382b7ac2 100644
--- a/nixos/modules/misc/version.nix
+++ b/nixos/modules/misc/version.nix
@@ -28,6 +28,8 @@ let
     DOCUMENTATION_URL = "https://nixos.org/learn.html";
     SUPPORT_URL = "https://nixos.org/community.html";
     BUG_REPORT_URL = "https://github.com/NixOS/nixpkgs/issues";
+  } // lib.optionalAttrs (cfg.variant_id != null) {
+    VARIANT_ID = cfg.variant_id;
   };
 
   initrdReleaseContents = osReleaseContents // {
@@ -87,6 +89,13 @@ in
       description = lib.mdDoc "The NixOS release code name (e.g. `Emu`).";
     };
 
+    nixos.variant_id = mkOption {
+      type = types.nullOr (types.strMatching "^[a-z0-9._-]+$");
+      default = null;
+      description = lib.mdDoc "A lower-case string identifying a specific variant or edition of the operating system";
+      example = "installer";
+    };
+
     stateVersion = mkOption {
       type = types.str;
       # TODO Remove this and drop the default of the option so people are forced to set it.
diff --git a/nixos/modules/profiles/installation-device.nix b/nixos/modules/profiles/installation-device.nix
index ae9be08c8d859..4d9bd69666c09 100644
--- a/nixos/modules/profiles/installation-device.nix
+++ b/nixos/modules/profiles/installation-device.nix
@@ -20,6 +20,7 @@ with lib;
     ];
 
   config = {
+    system.nixos.variant_id = lib.mkDefault "installer";
 
     # Enable in installer, even if the minimal profile disables it.
     documentation.enable = mkImageMediaOverride true;
diff --git a/pkgs/development/compilers/zig/default.nix b/pkgs/development/compilers/zig/default.nix
index caba470b9a120..e7c62a4cf938c 100644
--- a/pkgs/development/compilers/zig/default.nix
+++ b/pkgs/development/compilers/zig/default.nix
@@ -7,6 +7,14 @@
 , zlib
 }:
 
+let
+  zig_0_10_0 = fetchFromGitHub {
+    owner = "ziglang";
+    repo = "zig";
+    rev = "0.10.0";
+    hash = "sha256-DNs937N7PLQimuM2anya4npYXcj6cyH+dRS7AiOX7tw=";
+  };
+in
 stdenv.mkDerivation rec {
   pname = "zig";
   version = "0.9.1";
@@ -18,8 +26,20 @@ stdenv.mkDerivation rec {
     hash = "sha256-x2c4c9RSrNWGqEngio4ArW7dJjW0gg+8nqBwPcR721k=";
   };
 
-  # Fix index out of bounds reading RPATH (cherry-picked from 0.10-dev)
-  patches = [ ./rpath.patch ];
+  patches = [
+    # Fix index out of bounds reading RPATH (cherry-picked from 0.10-dev)
+    ./rpath.patch
+    # Fix build on macOS 13 (cherry-picked from 0.10-dev)
+    ./ventura.patch
+  ];
+
+  # TODO: remove on next upgrade
+  prePatch = ''
+    cp -R ${zig_0_10_0}/lib/libc/include/any-macos.13-any lib/libc/include/any-macos.13-any
+    cp -R ${zig_0_10_0}/lib/libc/include/aarch64-macos.13-none lib/libc/include/aarch64-macos.13-gnu
+    cp -R ${zig_0_10_0}/lib/libc/include/x86_64-macos.13-none lib/libc/include/x86_64-macos.13-gnu
+    cp ${zig_0_10_0}/lib/libc/darwin/libSystem.13.tbd lib/libc/darwin/
+  '';
 
   nativeBuildInputs = [
     cmake
diff --git a/pkgs/development/compilers/zig/ventura.patch b/pkgs/development/compilers/zig/ventura.patch
new file mode 100644
index 0000000000000..07b90e223553b
--- /dev/null
+++ b/pkgs/development/compilers/zig/ventura.patch
@@ -0,0 +1,50 @@
+From 98285b17b3887de37b630da66f09a44f42ddbe01 Mon Sep 17 00:00:00 2001
+From: Jakub Konka <kubkon@jakubkonka.com>
+Date: Tue, 25 Oct 2022 11:46:42 +0200
+Subject: [PATCH] darwin: bump max macOS version to 13.0
+
+---
+ lib/std/target.zig | 4 ++--
+ src/target.zig     | 2 ++
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/lib/std/target.zig b/lib/std/target.zig
+index d791e3b0350..7fbad5baa3c 100644
+--- a/lib/std/target.zig
++++ b/lib/std/target.zig
+@@ -277,13 +277,13 @@ pub const Target = struct {
+                         .aarch64 => VersionRange{
+                             .semver = .{
+                                 .min = .{ .major = 11, .minor = 6 },
+-                                .max = .{ .major = 12, .minor = 0 },
++                                .max = .{ .major = 13, .minor = 0 },
+                             },
+                         },
+                         .x86_64 => VersionRange{
+                             .semver = .{
+                                 .min = .{ .major = 10, .minor = 13 },
+-                                .max = .{ .major = 12, .minor = 0 },
++                                .max = .{ .major = 13, .minor = 0 },
+                             },
+                         },
+                         else => unreachable,
+diff --git a/src/target.zig b/src/target.zig
+index 9e2d26dac65..fc585912c45 100644
+--- a/src/target.zig
++++ b/src/target.zig
+@@ -18,6 +18,7 @@ pub const available_libcs = [_]ArchOsAbi{
+     .{ .arch = .aarch64, .os = .windows, .abi = .gnu },
+     .{ .arch = .aarch64, .os = .macos, .abi = .gnu, .os_ver = .{ .major = 11, .minor = 0 } },
+     .{ .arch = .aarch64, .os = .macos, .abi = .gnu, .os_ver = .{ .major = 12, .minor = 0 } },
++    .{ .arch = .aarch64, .os = .macos, .abi = .gnu, .os_ver = .{ .major = 13, .minor = 0 } },
+     .{ .arch = .armeb, .os = .linux, .abi = .gnueabi },
+     .{ .arch = .armeb, .os = .linux, .abi = .gnueabihf },
+     .{ .arch = .armeb, .os = .linux, .abi = .musleabi },
+@@ -73,6 +74,7 @@ pub const available_libcs = [_]ArchOsAbi{
+     .{ .arch = .x86_64, .os = .macos, .abi = .gnu, .os_ver = .{ .major = 10, .minor = 0 } },
+     .{ .arch = .x86_64, .os = .macos, .abi = .gnu, .os_ver = .{ .major = 11, .minor = 0 } },
+     .{ .arch = .x86_64, .os = .macos, .abi = .gnu, .os_ver = .{ .major = 12, .minor = 0 } },
++    .{ .arch = .x86_64, .os = .macos, .abi = .gnu, .os_ver = .{ .major = 13, .minor = 0 } },
+ };
+ 
+ pub fn libCGenericName(target: std.Target) [:0]const u8 {
diff --git a/pkgs/development/interpreters/php/generic.nix b/pkgs/development/interpreters/php/generic.nix
index 96ba56e00b92b..5a363822bcaec 100644
--- a/pkgs/development/interpreters/php/generic.nix
+++ b/pkgs/development/interpreters/php/generic.nix
@@ -27,6 +27,10 @@ let
     , system-sendmail
     , valgrind
     , xcbuild
+    , writeShellScript
+    , common-updater-scripts
+    , curl
+    , jq
 
     , version
     , hash
@@ -300,6 +304,19 @@ let
           outputs = [ "out" "dev" ];
 
           passthru = {
+            updateScript =
+              let
+                script = writeShellScript "php${lib.versions.major version}${lib.versions.minor version}-update-script" ''
+                  set -o errexit
+                  PATH=${lib.makeBinPath [ common-updater-scripts curl jq ]}
+                  new_version=$(curl --silent "https://www.php.net/releases/active" | jq --raw-output '."${lib.versions.major version}"."${lib.versions.majorMinor version}".version')
+                  update-source-version "$UPDATE_NIX_ATTR_PATH.unwrapped" "$new_version" "--file=$1"
+                '';
+              in [
+                script
+                # Passed as an argument so that update.nix can ensure it does not become a store path.
+                (./. + "/${lib.versions.majorMinor version}.nix")
+              ];
             buildEnv = mkBuildEnv { } [ ];
             withExtensions = mkWithExtensions { } [ ];
             overrideAttrs =
diff --git a/pkgs/development/libraries/minilibx/default.nix b/pkgs/development/libraries/minilibx/default.nix
new file mode 100644
index 0000000000000..0551993e438a2
--- /dev/null
+++ b/pkgs/development/libraries/minilibx/default.nix
@@ -0,0 +1,62 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, installShellFiles
+, libX11
+, libXext
+, unstableGitUpdater
+}:
+
+stdenv.mkDerivation {
+  pname = "minilibx";
+  version = "unstable-2021-10-30";
+
+  src = fetchFromGitHub {
+    owner = "42Paris";
+    repo = "minilibx-linux";
+    rev = "7dc53a411a7d4ae286c60c6229bd1e395b0efb82";
+    hash = "sha256-aRYMpaPC7dC6EHmmXugvwcQnaizRCQZKFcQX0K2MLM4=";
+  };
+
+  outputs = [ "out" "dev" "man" ];
+
+  nativeBuildInputs = [
+    installShellFiles
+  ];
+
+  buildInputs = [
+    libX11
+    libXext
+  ];
+
+  dontConfigure = true;
+
+  makefile = "Makefile.mk";
+
+  makeFlags = [
+    "CC=${stdenv.cc.targetPrefix}cc"
+  ];
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/{include,lib}
+    cp mlx*.h $out/include
+    cp libmlx*.a $out/lib
+    installManPage man/man*/*
+
+    runHook postInstall
+  '';
+
+  passthru = {
+    updateScript = unstableGitUpdater { };
+  };
+
+  meta = with lib; {
+    description = "A simple X-Window (X11R6) programming API in C";
+    homepage = "https://github.com/42Paris/minilibx-linux";
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ wegank ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index fd9091d8fd717..3699a1624fcc4 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9571,6 +9571,8 @@ with pkgs;
 
   minijail-tools = python3.pkgs.callPackage ../tools/system/minijail/tools.nix { };
 
+  minilibx = callPackage ../development/libraries/minilibx { };
+
   minixml = callPackage ../development/libraries/minixml { };
 
   mir-qualia = callPackage ../tools/text/mir-qualia {