mirror of
https://codeberg.org/spire/nix.git
synced 2026-08-02 12:25:00 +02:00
update script for sourcemod
This commit is contained in:
parent
1db5e3a001
commit
c8615c5aab
2 changed files with 33 additions and 7 deletions
|
|
@ -7,6 +7,7 @@
|
|||
lib,
|
||||
writeShellScriptBin,
|
||||
zlib,
|
||||
writeScript,
|
||||
sdks ? {},
|
||||
}: let
|
||||
inherit (builtins) concatStringsSep attrNames attrValues;
|
||||
|
|
@ -28,11 +29,6 @@ in
|
|||
pname = "sourcemod";
|
||||
version = "1.12.0.7239";
|
||||
|
||||
NIX_CFLAGS_COMPILE =
|
||||
"-Wno-error -Wno-error=format-truncation -Wno-error=ignored-attributes -Wno-error=reorder -Wno-error=sign-compare "
|
||||
+ "-Wno-error=stringop-truncation -Wno-error=dangling-pointer -Wno-error=template-id-cdtor -Wno-error=format-security "
|
||||
+ "-Wno-error=deprecated-declarations -Wno-error=stringop-overread";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "alliedmodders";
|
||||
repo = finalAttrs.pname;
|
||||
|
|
@ -41,6 +37,11 @@ in
|
|||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
NIX_CFLAGS_COMPILE =
|
||||
"-Wno-error -Wno-error=format-truncation -Wno-error=ignored-attributes -Wno-error=reorder -Wno-error=sign-compare "
|
||||
+ "-Wno-error=stringop-truncation -Wno-error=dangling-pointer -Wno-error=template-id-cdtor -Wno-error=format-security "
|
||||
+ "-Wno-error=deprecated-declarations -Wno-error=stringop-overread";
|
||||
|
||||
nativeBuildInputs =
|
||||
[
|
||||
ambuild
|
||||
|
|
@ -66,4 +67,27 @@ in
|
|||
mkdir $out
|
||||
mv package $out/share
|
||||
'';
|
||||
|
||||
passthru.updateScript = writeScript "update-sourcemod" ''
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i nu -p nurl common-updater-scripts
|
||||
|
||||
let html = http get https://www.sourcemod.net/downloads.php?branch=stable
|
||||
let branch = $html | query web --query h3 | first | first | parse --regex "from (?P<branch>[0-9.]+) Branch" | get branch | first
|
||||
let build = $html | query web --as-table [Build] | get 1 | get Build | first
|
||||
let newRev = $html | query web --query 'td a[href^="https://github.com/alliedmodders/sourcemod/tree/"]' --attribute ['href'] | first | get href | split words | last
|
||||
|
||||
let oldHash = nix eval --raw .#sourcemod.src.hash
|
||||
let oldRev = nix eval --raw .#sourcemod.src.rev
|
||||
let oldVersion = nix eval --raw .#sourcemod.version
|
||||
|
||||
let newHash = nurl https://github.com/alliedmodders/sourcemod $newRev --submodules --hash
|
||||
let newVersion = $"($branch).0.($build)"
|
||||
|
||||
let nix = open nix/sourcemod/sourcemod.nix |
|
||||
str replace $oldHash $newHash |
|
||||
str replace $oldVersion $newVersion |
|
||||
str replace $oldRev $newRev
|
||||
$nix | save -f nix/sourcemod/sourcemod.nix
|
||||
'';
|
||||
})
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@
|
|||
def main [] {
|
||||
update_metamod
|
||||
|
||||
# let sdks = open nix/sourcemod/hl2sdks.json | columns
|
||||
# $sdks | each {|sdk| update_sdk $sdk}
|
||||
nix-update --flake --use-update-script sourcemod
|
||||
|
||||
let sdks = open nix/sourcemod/hl2sdks.json | columns
|
||||
$sdks | each {|sdk| update_sdk $sdk}
|
||||
}
|
||||
|
||||
def update_sdk [sdk: string] {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue