-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ config, lib, pkgs, ... }: | ||
let | ||
cfg = config.services.peacock; | ||
inherit (lib) | ||
mkEnableOption | ||
mkOption | ||
mkPackageOption | ||
types | ||
mkIf; | ||
in | ||
{ | ||
options.services.peacock = { | ||
enable = mkEnableOption "peacock HITMAN game server"; | ||
package = mkPackageOption pkgs "peacock" { }; | ||
port = mkOption { | ||
default = 6969; | ||
type = types.port; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
environment.systemPackages = [ | ||
(cfg.package.override { inherit (cfg) port; }) | ||
]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
{ | ||
lib, | ||
fetchFromGitHub, | ||
stdenvNoCC, | ||
nodejs, | ||
yarn-berry, | ||
cacert, | ||
makeWrapper, | ||
protontricks, | ||
copyDesktopItems, | ||
makeDesktopItem, | ||
fetchurl, | ||
port ? 6969, | ||
}: | ||
|
||
stdenvNoCC.mkDerivation (finalAttrs: { | ||
pname = "peacock"; | ||
version = "7.4.1"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "thepeacockproject"; | ||
repo = "Peacock"; | ||
rev = "refs/tags/v${finalAttrs.version}"; | ||
hash = "sha256-uHVEPuzKdt/NhI7vNI679FE5XqCbORbxXZvnYOYpLkE="; | ||
}; | ||
|
||
yarnOfflineCache = stdenvNoCC.mkDerivation { | ||
name = "tilt-assets-deps"; | ||
inherit (finalAttrs) src; | ||
|
||
nativeBuildInputs = [ yarn-berry ]; | ||
|
||
supportedArchitectures = builtins.toJSON { | ||
os = [ "darwin" "linux" ]; | ||
cpu = [ "arm" "arm64" "ia32" "x64" ]; | ||
libc = [ "glibc" "musl" ]; | ||
}; | ||
|
||
NODE_EXTRA_CA_CERTS = "${cacert}/etc/ssl/certs/ca-bundle.crt"; | ||
|
||
configurePhase = '' | ||
runHook preConfigure | ||
export HOME="$NIX_BUILD_TOP" | ||
export YARN_ENABLE_TELEMETRY=0 | ||
yarn config set enableGlobalCache false | ||
yarn config set cacheFolder $out | ||
yarn config set supportedArchitectures --json "$supportedArchitectures" | ||
runHook postConfigure | ||
''; | ||
|
||
buildPhase = '' | ||
runHook preBuild | ||
mkdir -p $out | ||
yarn install --immutable --mode skip-build | ||
runHook postBuild | ||
''; | ||
|
||
dontInstall = true; | ||
|
||
outputHashAlgo = "sha256"; | ||
outputHash = "sha256-BR6dydEA+UWJk9d65sgvHw4E+zMA6iLcY+d8WYtXn6Q="; | ||
outputHashMode = "recursive"; | ||
}; | ||
|
||
nativeBuildInputs = [ | ||
yarn-berry | ||
nodejs | ||
makeWrapper | ||
copyDesktopItems | ||
]; | ||
|
||
desktopItems = [ | ||
(makeDesktopItem { | ||
name = "Peacock"; | ||
exec = "peacock"; | ||
path = "~/.local/share/peacock"; | ||
desktopName = "Peacock"; | ||
categories = [ "Game" ]; | ||
terminal = true; | ||
comment = "Replacement server for the HITMAN™ World of Assassination trilogy"; | ||
icon = fetchurl { | ||
url = "https://github.com/thepeacockproject/peacockprojectorg/blob/e6cc1733b79e7b6a4b362b5928b5d982ae93989e/static/img/feather.png?raw=1"; | ||
hash = "sha256-cUSyaNPD9ruw1jgGoVwtMcMwB0eDCWDjr6w1enmMC1c="; | ||
}; | ||
}) | ||
]; | ||
|
||
configurePhase = '' | ||
runHook preConfigure | ||
export HOME="$NIX_BUILD_TOP" | ||
export YARN_ENABLE_TELEMETRY=0 | ||
yarn config set enableGlobalCache false | ||
yarn config set cacheFolder $yarnOfflineCache | ||
runHook postConfigure | ||
''; | ||
|
||
buildPhase = '' | ||
runHook preBuild | ||
yarn install --immutable --immutable-cache | ||
yarn build | ||
runHook postBuild | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/{bin,share/peacock} | ||
cp -r \ | ||
chunk*.js \ | ||
LICENSE \ | ||
THIRDPARTYNOTICES.txt \ | ||
PeacockPatcher.exe \ | ||
$out/share/peacock/ | ||
mkdir $out/share/peacock/resources | ||
cp resources/dynamic_resources_h{3,2,1}.rpkg $out/share/peacock/resources | ||
cp -r resources/{challenges,mastery,contracts.prp} $out/share/peacock/resources | ||
mkdir $out/share/peacock/webui | ||
cp -r webui/dist $out/share/peacock/webui | ||
makeWrapper ${lib.getExe nodejs} $out/bin/peacock \ | ||
--add-flags "$out/share/peacock/chunk0.js" \ | ||
--set PORT ${toString port} | ||
makeWrapper ${lib.getExe' protontricks "protontricks-launch"} $out/bin/peacock-patcher \ | ||
--add-flags "--appid 1659040 $out/share/peacock/PeacockPatcher.exe" \ | ||
--set PROTON_VERSION "Proton Experimental" | ||
runHook postInstall | ||
''; | ||
|
||
meta = { | ||
description = "Replacement server for the HITMAN™ World of Assassination trilogy"; | ||
homepage = "https://thepeacockproject.org/"; | ||
license = lib.licenses.agpl3Only; | ||
maintainers = with lib.maintainers; [ marie ]; | ||
inherit (nodejs.meta) platforms; | ||
}; | ||
}) |