push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
{
lib,
config,
stdenv,
buildPackages,
pkgs,
newScope,
overrideCC,
stdenvNoLibc,
emptyDirectory,
}:
lib.makeScope newScope (
self:
with self;
{
dlfcn = callPackage ./dlfcn { };
mingw_w64 = callPackage ./mingw-w64 {
stdenv = stdenvNoLibc;
};
# FIXME untested with llvmPackages_16 was using llvmPackages_8
crossThreadsStdenv = overrideCC stdenvNoLibc (
if stdenv.hostPlatform.useLLVM or false then
buildPackages.llvmPackages.clangNoLibcxx
else
buildPackages.gccWithoutTargetLibc.override (old: {
bintools = old.bintools.override {
libc = pkgs.libc;
};
libc = pkgs.libc;
})
);
mingw_w64_headers = callPackage ./mingw-w64/headers.nix { };
mcfgthreads = callPackage ./mcfgthreads { stdenv = crossThreadsStdenv; };
npiperelay = callPackage ./npiperelay { };
pthreads = callPackage ./mingw-w64/pthreads.nix { stdenv = crossThreadsStdenv; };
libgnurx = callPackage ./libgnurx { };
sdk = callPackage ./msvcSdk { };
}
// lib.optionalAttrs config.allowAliases {
mingw_w64_pthreads = lib.warn "windows.mingw_w64_pthreads is deprecated, windows.pthreads should be preferred" self.pthreads;
}
)

View File

@@ -0,0 +1,28 @@
{
stdenv,
lib,
fetchFromGitHub,
cmake,
}:
stdenv.mkDerivation rec {
pname = "dlfcn";
version = "1.3.1";
src = fetchFromGitHub {
owner = "dlfcn-win32";
repo = "dlfcn-win32";
rev = "v${version}";
sha256 = "sha256-ljVTMBiGp8TPufrQcK4zQtcVH1To4zcfBAbUOb+v910=";
};
nativeBuildInputs = [ cmake ];
meta = with lib; {
homepage = "https://github.com/dlfcn-win32/dlfcn-win32";
description = "Set of functions that allows runtime dynamic library loading";
license = licenses.mit;
platforms = platforms.windows;
maintainers = with maintainers; [ marius851000 ];
};
}

View File

@@ -0,0 +1,27 @@
{
lib,
stdenv,
fetchurl,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "libgnurx";
version = "2.5.1";
src = fetchurl {
url = "mirror://sourceforge/mingw/Other/UserContributed/regex/mingw-regex-${finalAttrs.version}/mingw-libgnurx-${finalAttrs.version}-src.tar.gz";
hash = "sha256-cUe3+AbsPQB4Q7OOGfQqW3xliUpX/8KXp2sNzV9nXXY=";
};
# file looks for libgnurx.a when compiling statically
postInstall = lib.optionalString stdenv.hostPlatform.isStatic ''
ln -s $out/lib/libgnurx{.dll.a,.a}
'';
meta = {
downloadPage = "https://sourceforge.net/projects/mingw/files/Other/UserContributed/regex/";
description = "Regex functionality from glibc extracted into a separate library for win32";
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.windows;
teams = [ lib.teams.windows ];
};
})

View File

@@ -0,0 +1,48 @@
{
lib,
stdenv,
writeScriptBin,
fetchFromGitHub,
meson,
ninja,
}:
let
dllTool = writeScriptBin "dlltool" ''
${stdenv.cc.targetPrefix}dlltool "$@"
'';
in
stdenv.mkDerivation (finalAttrs: {
pname = "mcfgthread";
version = "2.1.1";
src = fetchFromGitHub {
owner = "lhmouse";
repo = "mcfgthread";
tag = "v${lib.versions.majorMinor finalAttrs.version}-ga.${lib.versions.patch finalAttrs.version}";
hash = "sha256-kEqS1+2CB/Ryor2WbI67KALnlTcD9oSFEdC6Av73roE=";
};
postPatch = ''
sed -z "s/Rules for tests.*//;s/'cpp'/'c'/g" -i meson.build
'';
outputs = [
"out"
"dev"
];
nativeBuildInputs = [
dllTool
meson
ninja
];
meta = {
description = "Threading support library for Windows 7 and above";
homepage = "https://github.com/lhmouse/mcfgthread/wiki";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ wegank ];
teams = [ lib.teams.windows ];
platforms = lib.platforms.windows;
};
})

View File

@@ -0,0 +1,38 @@
{
lib,
stdenv,
windows,
autoreconfHook,
mingw_w64_headers,
crt ? stdenv.hostPlatform.libc,
}:
stdenv.mkDerivation {
pname = "mingw-w64";
inherit (mingw_w64_headers) version src meta;
outputs = [
"out"
"dev"
];
configureFlags = [
(lib.enableFeature true "idl")
(lib.enableFeature true "secure-api")
(lib.withFeatureAs true "default-msvcrt" crt)
# Including other architectures causes errors with invalid asm
(lib.enableFeature stdenv.hostPlatform.isi686 "lib32")
(lib.enableFeature stdenv.hostPlatform.isx86_64 "lib64")
(lib.enableFeature stdenv.hostPlatform.isAarch64 "libarm64")
];
enableParallelBuilding = true;
nativeBuildInputs = [ autoreconfHook ];
buildInputs = [ mingw_w64_headers ];
hardeningDisable = [
"stackprotector"
"fortify"
];
}

View File

@@ -0,0 +1,47 @@
{
lib,
nixosTests,
stdenvNoCC,
fetchurl,
crt ? stdenvNoCC.hostPlatform.libc,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "mingw_w64-headers";
version = "13.0.0";
src = fetchurl {
url = "mirror://sourceforge/mingw-w64/mingw-w64-v${finalAttrs.version}.tar.bz2";
hash = "sha256-Wv6CKvXE7b9n2q9F7sYdU49J7vaxlSTeZIl8a5WCjK8=";
};
configureFlags = [
(lib.withFeatureAs true "default-msvcrt" crt)
];
preConfigure = ''
cd mingw-w64-headers
'';
passthru = {
tests = {
inherit (nixosTests) wine;
};
updateScript = ./update.nu;
};
meta = {
homepage = "https://www.mingw-w64.org/";
downloadPage = "https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/";
description = "Collection of headers and libraries for building native Windows applications";
license = with lib.licenses; [
# Primarily under
zpl21
# A couple files
mit
# Certain headers imported from Wine
lgpl21Plus
];
platforms = lib.platforms.windows;
teams = [ lib.teams.windows ];
};
})

View File

@@ -0,0 +1,19 @@
{
lib,
stdenv,
mingw_w64_headers,
# Rustc require 'libpthread.a' when targeting 'x86_64-pc-windows-gnu'.
# Enabling this makes it work out of the box instead of failing.
withStatic ? true,
}:
stdenv.mkDerivation {
pname = "mingw_w64-pthreads";
inherit (mingw_w64_headers) version src meta;
configureFlags = [ (lib.enableFeature withStatic "static") ];
preConfigure = ''
cd mingw-w64-libraries/winpthreads
'';
}

View File

@@ -0,0 +1,77 @@
#!/usr/bin/env nix-shell
#! nix-shell -i nu -p nushell nix
use std/log
def replace [ p: path old: string new: string ] {
open $p
| str replace $old $new
| save -f $p
}
def eval [ attr: string ] {
with-env {
NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM: 1
} {
nix eval -f ./. $attr --json
}
| from json
}
def main [] {
# List of all the link in the RSS feed for
# https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/
let links = http get https://sourceforge.net/projects/mingw-w64/rss?path=/mingw-w64/mingw-w64-release/
| from xml
| get content.content.0
| where tag == item
| get content
| flatten
| where tag == title
| get content
| flatten
| get content
# Select only files ending in "tar.bz2", then select the largest value
# We only consider values with at least two digits cause they are at
# 13.0 and sorting strings doesn't work well if they aren't the same length
let newest = $links
| where { ($in | str ends-with "tar.bz2") and ($in =~ v[0-9][0-9]\.) }
| sort -r
| get 0
# Extract the newest version out of the URL
let new_version = $newest
| split column /
| get column4.0
| split column -
| get column3.0
| str replace .tar.bz2 ""
| str trim -c v
# Get the current version in the drv
let current_version = eval "windows.mingw_w64_headers.version"
if $new_version == $current_version {
log info "Current mingw-w64 version matches the latest, exiting..."
return
} else {
log info $"Current version is ($current_version)\nLatest version is ($new_version)"
}
# Get the current hash
let current_hash = eval "windows.mingw_w64_headers.src.outputHash"
# Set to the new version
replace ./pkgs/os-specific/windows/mingw-w64/headers.nix $current_version $new_version
# The nix derivation creates the URL from the version, so just grab that.
let new_url = eval "windows.mingw_w64_headers.src.url"
# Prefetch to get the new hash
let new_hash = nix-prefetch-url --type sha256 $new_url
| nix hash to-sri --type sha256 $in
# Set the hash
replace ./pkgs/os-specific/windows/mingw-w64/headers.nix $current_hash $new_hash
}

View File

@@ -0,0 +1,127 @@
{
lib,
config,
stdenvNoCC,
xwin,
testers,
llvmPackages,
}:
let
version = (builtins.fromJSON (builtins.readFile ./manifest.json)).info.buildVersion;
hashes = (builtins.fromJSON (builtins.readFile ./hashes.json));
host = stdenvNoCC.hostPlatform;
arch =
if host.isx86_64 then
"x86_64"
else if host.isAarch64 then
"aarch64"
else if host.isx86_32 then
"x86"
else if host.isAarch32 then
"aarch"
else
throw "Unsupported system";
in
stdenvNoCC.mkDerivation (finalAttrs: {
inherit version;
pname = "msvc-sdk";
dontUnpack = true;
strictDeps = true;
nativeBuildInputs = [ xwin ];
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash =
if !config.microsoftVisualStudioLicenseAccepted then
throw ''
Microsoft Software License Terms are not accepted with config.microsoftVisualStudioLicenseAccepted.
Please read https://visualstudio.microsoft.com/license-terms/mt644918/ and if you agree, change your
config to indicate so.
''
else
hashes.${arch};
__structuredAttrs = true;
xwinArgs = [
"--accept-license"
"--cache-dir=xwin-out"
"--manifest=${./manifest.json}"
"--arch=${arch}"
"splat"
"--preserve-ms-arch-notation"
];
buildPhase = ''
runHook preBuild
xwin "''${xwinArgs[@]}"
mkdir "$out"
mv xwin-out/splat/* "$out"
runHook postBuild
'';
dontFixup = true;
dontInstall = true;
passthru = {
updateScript = ./update.nu;
tests = {
hello-world = testers.runCommand {
name = "hello-msvc";
nativeBuildInputs = [
llvmPackages.clang-unwrapped
llvmPackages.bintools-unwrapped
];
script = ''
set -euo pipefail
cat > hello.c <<- EOF
#include <stdio.h>
int main(int argc, char* argv[]) {
printf("Hello world!\n");
return 0;
}
EOF
clang-cl --target=x86_64-pc-windows-msvc -fuse-ld=lld \
/vctoolsdir ${finalAttrs.finalPackage}/crt \
/winsdkdir ${finalAttrs.finalPackage}/sdk \
./hello.c -v
if test ! -f hello.exe; then
echo "hello.exe not found!"
exit 1
else
touch $out
fi
'';
};
};
};
meta = {
description = "MSVC SDK and Windows CRT for cross compiling";
homepage = "https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/";
maintainers = [ lib.maintainers.RossSmyth ];
license = {
deprecated = false;
fullName = "Microsoft Software License Terms";
shortName = "msvc";
spdxId = "unknown";
free = false;
url = "https://www.visualstudio.com/license-terms/mt644918/";
};
platforms = lib.platforms.all;
# The arm32 manifest is missing critical pieces.
broken = stdenvNoCC.hostPlatform.isAarch32;
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
teams = [ lib.teams.windows ];
};
})

View File

@@ -0,0 +1,5 @@
{
"x86_64": "sha256-kp+xePTRZgqdAV3/BYhqKke3dXIkLWLM+IWFXtN2rHM=",
"x86": "sha256-xEXV+XBNoXpAO8R/oDj8gfGb5tICr9ps4DN8Q4lqK2k=",
"aarch64": "sha256-r0tTQUq3CePJ/7Vuzf4Zsy3Ebu0KiXNBwRHmrO3d15E="
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,49 @@
#!/usr/bin/env nix-shell
#!nix-shell -i nu -p nushell xwin
#!nix-shell -I nixpkgs=./.
use std/log
use std/dirs
const MANIFEST_URL = "https://aka.ms/vs/17/release/channel"
const PATH = "pkgs/os-specific/windows/msvcSdk"
def replace_hash [ p: path old: string new: string ] {
open $p
| str replace $old $new
| save -f $p
}
def main [] {
# Ensure the version is actually new
let current_version = nix eval -f "" windows.sdk.version --json | from json
let new_manifest = http get $MANIFEST_URL | decode | from json
let new_version = $new_manifest.info.buildVersion
if $current_version == $new_version {
log info "Current Windows SDK manifest matches the newest version, exiting..."
exit 0
} else {
log info $"Previous version ($current_version)\nNew version ($new_version)"
}
$new_manifest | to json | append "\n" | str join | save -f ($PATH | path join manifest.json)
# TODO: Add arm once it isn't broken
let hashes = ["x86_64", "x86", "aarch64"] | par-each {
|arch|
let dir = mktemp -d
xwin --accept-license --cache-dir $dir --manifest $"($PATH | path join manifest.json)" --arch $arch splat --preserve-ms-arch-notation
let hash = nix hash path ($dir | path join splat)
{arch: $arch, hash: $hash}
} | transpose -r -d
log info $"New hashes:\n ($hashes)"
$hashes | to json | append "\n" | str join | save -f ($PATH | path join hashes.json)
}

View File

@@ -0,0 +1,27 @@
{
lib,
buildGoModule,
fetchFromGitHub,
}:
buildGoModule rec {
pname = "npiperelay";
version = "0.1.0";
src = fetchFromGitHub {
owner = "jstarks";
repo = "npiperelay";
rev = "v${version}";
sha256 = "sha256-cg4aZmpTysc8m1euxIO2XPv8OMnBk1DwhFcuIFHF/1o=";
};
vendorHash = null;
meta = {
description = "Access Windows named pipes from WSL";
homepage = "https://github.com/jstarks/npiperelay";
license = lib.licenses.mit;
maintainers = [ lib.maintainers.shlevy ];
platforms = lib.platforms.windows;
};
}