add papermc
This commit is contained in:
parent
a3e27aecad
commit
1c7b6c4744
5 changed files with 67 additions and 19 deletions
20
.github/workflows/update-flake.yaml
vendored
20
.github/workflows/update-flake.yaml
vendored
|
@ -2,7 +2,7 @@ name: update-flake-lock
|
||||||
on:
|
on:
|
||||||
workflow_dispatch: # allows manual triggering
|
workflow_dispatch: # allows manual triggering
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "31 3 * * 3"
|
- cron: "16 20 * * *"
|
||||||
jobs:
|
jobs:
|
||||||
lockfile:
|
lockfile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -14,11 +14,15 @@ jobs:
|
||||||
with:
|
with:
|
||||||
extra_nix_config: |
|
extra_nix_config: |
|
||||||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Update flake.lock
|
- name: Update flake.lockfile
|
||||||
uses: DeterminateSystems/update-flake-lock@v9
|
run: nix flake update
|
||||||
|
- name: Run update script for minecraft
|
||||||
|
run: ./minecraft/update.sh
|
||||||
|
- name: Commit and push
|
||||||
|
uses: technote-space/create-pr-action@v2
|
||||||
with:
|
with:
|
||||||
pr-title: "Update flake.lock" # Title of PR to be created
|
COMMIT_MESSAGE: "Update everything"
|
||||||
pr-labels: | # Labels to be set on the PR
|
COMMIT_NAME: "GitHub Actions[bot]"
|
||||||
dependencies
|
COMMIT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
automated
|
PR_BRANCH_NAME: 'chore-update-${PR_ID}'
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
PR_TITLE: 'chore: update everything'
|
||||||
|
|
25
flake.nix
25
flake.nix
|
@ -12,16 +12,18 @@
|
||||||
miifox-net.flake = false;
|
miifox-net.flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs =
|
||||||
self,
|
{ self
|
||||||
nixpkgs,
|
, nixpkgs
|
||||||
flake-utils,
|
, flake-utils
|
||||||
...
|
, ...
|
||||||
} @ inputs:
|
} @ inputs:
|
||||||
flake-utils.lib.eachSystem ["aarch64-linux" "x86_64-linux"] (
|
flake-utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ] (
|
||||||
system: let
|
system:
|
||||||
pkgs = import nixpkgs {inherit system;};
|
let
|
||||||
in rec {
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
in
|
||||||
|
rec {
|
||||||
formatter = pkgs.alejandra;
|
formatter = pkgs.alejandra;
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
|
@ -30,10 +32,11 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = pkgs.lib.lists.foldl (a: b: a // b) {} (map (f: import f {inherit pkgs inputs;}) [
|
packages = pkgs.lib.lists.foldl (a: b: a // b) { } (map (f: import f { inherit pkgs inputs; }) [
|
||||||
./scripts/clean-s3-cache.nix
|
./scripts/clean-s3-cache.nix
|
||||||
./web/old-homepage.nix
|
./web/old-homepage.nix
|
||||||
./web/miifox-net.nix
|
./web/miifox-net.nix
|
||||||
|
./minecraft/paper.nix
|
||||||
]);
|
]);
|
||||||
|
|
||||||
hydraJobs = {
|
hydraJobs = {
|
||||||
|
|
6
minecraft/paper.json
Normal file
6
minecraft/paper.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"version": "1.18.2",
|
||||||
|
"build": 379,
|
||||||
|
"name": "paper-1.18.2-379.jar",
|
||||||
|
"sha256": "672207836693f08ff147539a7c6ae317b5ac35d6dd6539cbd05bed21dcfcbe1f"
|
||||||
|
}
|
31
minecraft/paper.nix
Normal file
31
minecraft/paper.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
version-info = builtins.fromJSON (builtins.readFile ./paper.json);
|
||||||
|
pname = "paper";
|
||||||
|
mcVersion = version-info.version;
|
||||||
|
buildNum = toString version-info.build;
|
||||||
|
in
|
||||||
|
rec {
|
||||||
|
paper-jar = pkgs.fetchurl {
|
||||||
|
url = "https://papermc.io/api/v2/projects/paper/versions/${mcVersion}/builds/${buildNum}/downloads/${version-info.name}";
|
||||||
|
inherit (version-info) sha256;
|
||||||
|
};
|
||||||
|
papermc = pkgs.stdenvNoCC.mkDerivation {
|
||||||
|
pname = "papermc";
|
||||||
|
version = "${mcVersion}-${buildNum}";
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
dontConfigure = true;
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
cat > minecraft-server << EOF
|
||||||
|
#!${pkgs.bash}/bin/sh
|
||||||
|
exec ${pkgs.openjdk17_headless}/bin/java \$@ -jar $out/share/papermc/papermc.jar nogui
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
install -Dm444 ${paper-jar} $out/share/papermc/papermc.jar
|
||||||
|
install -Dm555 -t $out/bin minecraft-server
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
4
minecraft/update.sh
Executable file
4
minecraft/update.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#! /usr/bin/env nix-shell
|
||||||
|
#! nix-shell -i bash -p curl jq
|
||||||
|
|
||||||
|
curl -L https://papermc.io/api/v2/projects/paper/versions/1.18.2/builds | jq '{"version":.version, "build":.builds[-1].build, "name":.builds[-1].downloads.application.name, "sha256":.builds[-1].downloads.application.sha256}' > paper.json
|
Reference in a new issue