Files
Dark Steveneq 646b892680
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
push sheeet
2025-10-09 14:15:47 +02:00

50 lines
1.4 KiB
Nu
Executable File

#!/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)
}