mirror of
https://codeberg.org/spire/nix.git
synced 2026-06-03 09:54:19 +02:00
package srcds wip
This commit is contained in:
parent
f3b763c6b9
commit
8e26d5f7ba
6 changed files with 189 additions and 13 deletions
41
flake.lock
generated
41
flake.lock
generated
|
|
@ -2,7 +2,9 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"flakelight": {
|
"flakelight": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1750078272,
|
"lastModified": 1750078272,
|
||||||
|
|
@ -20,23 +22,44 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1750134718,
|
"lastModified": 1750400657,
|
||||||
"narHash": "sha256-v263g4GbxXv87hMXMCpjkIxd/viIF7p3JpJrwgKdNiI=",
|
"narHash": "sha256-3vkjFnxCOP6vm5Pm13wC/Zy6/VYgei/I/2DWgW4RFeA=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "9e83b64f727c88a7711a2c463a7b16eedb69a84c",
|
"rev": "b2485d56967598da068b5a6946dadda8bfcbcd37",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"id": "nixpkgs",
|
||||||
"ref": "nixos-unstable",
|
"ref": "nixos-25.05",
|
||||||
"repo": "nixpkgs",
|
"type": "indirect"
|
||||||
"type": "github"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flakelight": "flakelight"
|
"flakelight": "flakelight",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"steam-fetcher": "steam-fetcher"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"steam-fetcher": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1714795926,
|
||||||
|
"narHash": "sha256-PkgC9jqoN6cJ8XYzTA2PlrWs7aPJkM3BGiTxNqax0cA=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "steam-fetcher",
|
||||||
|
"rev": "12f66eafb7862d91b3e30c14035f96a21941bd9c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "steam-fetcher",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
25
flake.nix
25
flake.nix
|
|
@ -1,9 +1,21 @@
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
flakelight.url = "github:nix-community/flakelight";
|
nixpkgs.url = "nixpkgs/nixos-25.05";
|
||||||
|
flakelight = {
|
||||||
|
url = "github:nix-community/flakelight";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
steam-fetcher = {
|
||||||
|
url = "github:nix-community/steam-fetcher";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {flakelight, ...}: let
|
outputs = {
|
||||||
|
flakelight,
|
||||||
|
steam-fetcher,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
inherit (builtins) listToAttrs map;
|
inherit (builtins) listToAttrs map;
|
||||||
inheritPkgs = names:
|
inheritPkgs = names:
|
||||||
listToAttrs (map (name: {
|
listToAttrs (map (name: {
|
||||||
|
|
@ -13,8 +25,13 @@
|
||||||
names);
|
names);
|
||||||
in
|
in
|
||||||
flakelight ./. {
|
flakelight ./. {
|
||||||
|
nixpkgs.config = {allowUnfree = true;};
|
||||||
|
|
||||||
systems = ["x86_64-linux" "i686-linux"];
|
systems = ["x86_64-linux" "i686-linux"];
|
||||||
withOverlays = [(import ./nix/overlay.nix)];
|
withOverlays = [
|
||||||
|
steam-fetcher.overlays.default
|
||||||
|
(import ./nix/overlay.nix)
|
||||||
|
];
|
||||||
|
|
||||||
formatters = pkgs:
|
formatters = pkgs:
|
||||||
with pkgs; {
|
with pkgs; {
|
||||||
|
|
@ -26,7 +43,7 @@
|
||||||
metamods = pkgs.lib.mapAttrs (name: sdk: pkgs.metamod-source.override {sdks = {${name} = sdk;};}) pkgs.hl2sdk;
|
metamods = pkgs.lib.mapAttrs (name: sdk: pkgs.metamod-source.override {sdks = {${name} = sdk;};}) pkgs.hl2sdk;
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = inheritPkgs ["ambuild" "sourcepawn" "sourcemod-includes" "sourcemod-include-library"];
|
packages = inheritPkgs ["ambuild" "sourcepawn" "sourcemod-includes" "sourcemod-include-library" "srcds-tf2"];
|
||||||
|
|
||||||
checks = {
|
checks = {
|
||||||
buildTestScript = {pkgs, ...}:
|
buildTestScript = {pkgs, ...}:
|
||||||
|
|
|
||||||
|
|
@ -12,4 +12,5 @@ final: prev: {
|
||||||
sourcemod-include-library = final.callPackage ./includes/sourcemod-include-library.nix {};
|
sourcemod-include-library = final.callPackage ./includes/sourcemod-include-library.nix {};
|
||||||
sourcemod-include-curl = final.callPackage ./includes/curl.nix {};
|
sourcemod-include-curl = final.callPackage ./includes/curl.nix {};
|
||||||
sourcemod-include-steamworks = final.callPackage ./includes/steamworks.nix {};
|
sourcemod-include-steamworks = final.callPackage ./includes/steamworks.nix {};
|
||||||
|
srcds-tf2 = final.callPackage ./srcds {};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
25
nix/srcds/curl-symbol-downgrade.patch
Normal file
25
nix/srcds/curl-symbol-downgrade.patch
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
diff --git a/configure b/configure
|
||||||
|
index dcad39e..4d0282a 100755
|
||||||
|
--- a/configure
|
||||||
|
+++ b/configure
|
||||||
|
@@ -30493,7 +30493,7 @@ fi
|
||||||
|
|
||||||
|
CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX="$versioned_symbols_flavour"
|
||||||
|
|
||||||
|
-CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME="4"
|
||||||
|
+CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME="3"
|
||||||
|
if test "x$versioned_symbols" = 'xyes'; then
|
||||||
|
CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS_TRUE=
|
||||||
|
CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS_FALSE='#'
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index e3ecf00..b03fb47 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -2700,7 +2700,7 @@ AS_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shar
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_SUBST([CURL_LIBCURL_VERSIONED_SYMBOLS_PREFIX], ["$versioned_symbols_flavour"])
|
||||||
|
-AC_SUBST([CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME], ["4"]) dnl Keep in sync with VERSIONCHANGE - VERSIONDEL in lib/Makefile.soname
|
||||||
|
+AC_SUBST([CURL_LIBCURL_VERSIONED_SYMBOLS_SONAME], ["3"]) dnl Keep in sync with VERSIONCHANGE - VERSIONDEL in lib/Makefile.soname
|
||||||
|
AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
|
||||||
|
[test "x$versioned_symbols" = 'xyes'])
|
||||||
92
nix/srcds/default.nix
Normal file
92
nix/srcds/default.nix
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenvNoCC,
|
||||||
|
fetchSteam,
|
||||||
|
depotdownloader,
|
||||||
|
writeScript,
|
||||||
|
symlinkJoin,
|
||||||
|
autoPatchelfHook,
|
||||||
|
libgcc,
|
||||||
|
curlWithGnuTls,
|
||||||
|
system,
|
||||||
|
}: let
|
||||||
|
inherit (builtins) fromJSON readFile map toString elem head replaceStrings;
|
||||||
|
depotInputs = fromJSON (readFile ./depots.json);
|
||||||
|
fetchSupported = elem system depotdownloader.meta.platforms;
|
||||||
|
fetcher = input:
|
||||||
|
if fetchSupported
|
||||||
|
then
|
||||||
|
fetchSteam {
|
||||||
|
name = "steam-depot-${toString input.app_id}-${toString input.depot_id}";
|
||||||
|
appId = input.app_id;
|
||||||
|
depotId = input.depot_id;
|
||||||
|
manifestId = input.manifest;
|
||||||
|
fileList = input.file_list or [];
|
||||||
|
hash = input.hash;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
stdenvNoCC.mkDerivation {
|
||||||
|
name = "steam-depot-${toString input.app_id}-${toString input.depot_id}";
|
||||||
|
outputHashAlgo = "sha256";
|
||||||
|
outputHashMode = "recursive";
|
||||||
|
outputHash = input.hash;
|
||||||
|
preferLocalBuild = true;
|
||||||
|
allowSubstitutes = false;
|
||||||
|
builder = writeScript "restrict-message" ''
|
||||||
|
source ${stdenvNoCC}/setup
|
||||||
|
cat <<_EOF_
|
||||||
|
|
||||||
|
$out
|
||||||
|
fetchSteam is not supported on your platform
|
||||||
|
|
||||||
|
_EOF_
|
||||||
|
exit 1
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
allDepots = map fetcher depotInputs;
|
||||||
|
src = symlinkJoin {
|
||||||
|
name = "srcds-tf2-src";
|
||||||
|
paths = allDepots;
|
||||||
|
};
|
||||||
|
timeToVersion = replaceStrings ["T" ":" "Z"] ["-" "-" ""];
|
||||||
|
time = (head depotInputs).date;
|
||||||
|
|
||||||
|
curlCompat = curlWithGnuTls.overrideAttrs (
|
||||||
|
final: prev: {
|
||||||
|
patches = (prev.patches or []) ++ [./curl-symbol-downgrade.patch];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
stdenvNoCC.mkDerivation {
|
||||||
|
pname = "srcds-tf2";
|
||||||
|
version = timeToVersion time;
|
||||||
|
inherit src;
|
||||||
|
|
||||||
|
# Skip phases that don't apply to prebuilt binaries.
|
||||||
|
dontBuild = true;
|
||||||
|
dontConfigure = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = [autoPatchelfHook];
|
||||||
|
buildInputs = [libgcc curlCompat];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
cp -rL . $out
|
||||||
|
|
||||||
|
chmod -R +w $out
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "TF2 dedicated server";
|
||||||
|
homepage = "https://steamdb.info/app/440/";
|
||||||
|
changelog = "https://store.steampowered.com/news/app/440?updates=true";
|
||||||
|
sourceProvenance = with sourceTypes; [
|
||||||
|
binaryNativeCode
|
||||||
|
];
|
||||||
|
license = licenses.unfree;
|
||||||
|
platforms = ["x86_64-linux" "i686-linux"];
|
||||||
|
};
|
||||||
|
}
|
||||||
18
nix/srcds/depots.json
Normal file
18
nix/srcds/depots.json
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"app_id": 232250,
|
||||||
|
"depot_id": 232256,
|
||||||
|
"manifest": 4606186468524235451,
|
||||||
|
"date": "2025-05-13T22:30:59Z",
|
||||||
|
"hash": "sha256-0M39TiQzGwPgFiwyFd9t9Ss86UEBy6jugkr7K+ifYLY=",
|
||||||
|
"file_list": ["regex:^[^.]*(\\.(?!bsp$)[^.]+)?$", "tf/maps/cp_badlands.bsp"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"app_id": 232250,
|
||||||
|
"depot_id": 232250,
|
||||||
|
"manifest": 3423298312000784891,
|
||||||
|
"date": "2025-05-13T22:30:59Z",
|
||||||
|
"hash": "sha256-KQTTmLkULMy8jPzwE40DZ1ITsqG/kgWijnzU52OMiII=",
|
||||||
|
"file_list": ["regex:^[^.]*(\\.(?!bsp$)[^.]+)?$", "tf/maps/cp_badlands.bsp"]
|
||||||
|
}
|
||||||
|
]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue