mirror of
https://github.com/LCE-Hub/LCE-Emerald-Launcher.git
synced 2026-07-26 02:57:10 +00:00
Fix: Added stable branch to flake and needed packages (#165)
Some checks failed
Nix / build (push) Has been cancelled
Some checks failed
Nix / build (push) Has been cancelled
This commit is contained in:
parent
19380b0585
commit
cb684177fe
11
.github/workflows/nix.yml
vendored
11
.github/workflows/nix.yml
vendored
|
|
@ -24,8 +24,11 @@ jobs:
|
|||
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
|
||||
- name: Build package
|
||||
run: nix build .#default --print-build-logs
|
||||
- name: Build stable package
|
||||
run: nix build .#emerald-legacy-launcher --print-build-logs
|
||||
|
||||
- name: Build git package
|
||||
run: nix build .#emerald-legacy-launcher-git --out-link result-git --print-build-logs
|
||||
|
||||
- name: Flake check
|
||||
run: nix flake check --print-build-logs
|
||||
|
|
@ -33,6 +36,8 @@ jobs:
|
|||
- name: Verify outputs
|
||||
run: |
|
||||
test -x ./result/bin/emerald-legacy-launcher
|
||||
nix path-info -Sh ./result
|
||||
test -x ./result-git/bin/emerald-legacy-launcher
|
||||
nix path-info -Sh ./result ./result-git
|
||||
ls -la ./result/bin/
|
||||
ls -la ./result-git/bin/
|
||||
ls -la ./result/share/applications/ || true
|
||||
|
|
|
|||
41
.github/workflows/update-nix-stable.yml
vendored
Normal file
41
.github/workflows/update-nix-stable.yml
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
name: Update Nix Flake (Stable)
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
update-flake:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main
|
||||
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
|
||||
- name: Prefetch release source and update flake.nix
|
||||
run: |
|
||||
TAG="${{ github.event.release.tag_name }}"
|
||||
VERSION="${TAG#v}"
|
||||
echo "Processing tag $TAG (version: $VERSION)"
|
||||
|
||||
BASE32_HASH=$(nix-prefetch-url --unpack \
|
||||
"https://github.com/LCE-Hub/LCE-Emerald-Launcher/archive/refs/tags/${TAG}.tar.gz")
|
||||
SRC_HASH=$(nix hash to-sri --type sha256 "$BASE32_HASH")
|
||||
|
||||
echo "stableSrcHash: $SRC_HASH"
|
||||
python3 scripts/update-nix-stable.py --version "$VERSION" --src-hash "$SRC_HASH"
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git config --global user.name "github-actions[bot]"
|
||||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add flake.nix
|
||||
git diff --quiet && git diff --staged --quiet || (
|
||||
git commit -m "chore: update Nix stable pin to ${{ github.event.release.tag_name }} [skip ci]" &&
|
||||
git push origin main
|
||||
)
|
||||
12
README.md
12
README.md
|
|
@ -137,14 +137,20 @@ paru -S emerald-legacy-launcher-bin # or yay
|
|||
**Nix:**
|
||||
Requires [Nix](https://nixos.org/download/) with flakes enabled (`experimental-features = nix-command flakes` in `nix.conf`).
|
||||
```bash
|
||||
# Run without installing
|
||||
# stable release (default) — tracks https://github.com/LCE-Hub/LCE-Emerald-Launcher/releases
|
||||
nix run github:LCE-Hub/LCE-Emerald-Launcher
|
||||
# or explicitly:
|
||||
nix run github:LCE-Hub/LCE-Emerald-Launcher#emerald-legacy-launcher
|
||||
|
||||
# git / latest main
|
||||
nix run github:LCE-Hub/LCE-Emerald-Launcher#emerald-legacy-launcher-git
|
||||
|
||||
# Install to your user profile
|
||||
nix profile install github:LCE-Hub/LCE-Emerald-Launcher
|
||||
nix profile install github:LCE-Hub/LCE-Emerald-Launcher # stable
|
||||
nix profile install github:LCE-Hub/LCE-Emerald-Launcher#emerald-legacy-launcher-git # git
|
||||
```
|
||||
|
||||
On NixOS, add the flake as an input and install `packages.<system>.default` (or `emerald-legacy-launcher`) from it.
|
||||
On NixOS, add the flake as an input and install `packages.<system>.default` / `emerald-legacy-launcher` (stable) or `emerald-legacy-launcher-git` (main).
|
||||
|
||||
**Gentoo:**
|
||||
This repository includes a local Portage overlay under [`gentoo/`](gentoo/). Point `repos.conf` at that directory, then emerge the package (build fetches Cargo/npm deps over the network; Wine/Proton is needed at runtime to launch games):
|
||||
|
|
|
|||
26
flake.nix
26
flake.nix
|
|
@ -22,10 +22,25 @@
|
|||
inherit system;
|
||||
overlays = [ self.overlays.default ];
|
||||
};
|
||||
|
||||
# Bump these together when packaging a new upstream stable release.
|
||||
stableVersion = "1.5.1";
|
||||
stableSrcHash = "sha256-XDR6YCWfVeQgIokMfksakw7tqQ+2uWGFqUkLumJU0EA=";
|
||||
in
|
||||
{
|
||||
overlays.default = final: _prev: {
|
||||
emerald-legacy-launcher = final.callPackage ./nix/package.nix {
|
||||
version = stableVersion;
|
||||
src = final.fetchFromGitHub {
|
||||
owner = "LCE-Hub";
|
||||
repo = "LCE-Emerald-Launcher";
|
||||
rev = "v${stableVersion}";
|
||||
hash = stableSrcHash;
|
||||
};
|
||||
};
|
||||
|
||||
emerald-legacy-launcher-git = final.callPackage ./nix/package.nix {
|
||||
version = "unstable-${self.shortRev or self.dirtyShortRev or "dirty"}";
|
||||
src = self;
|
||||
};
|
||||
};
|
||||
|
|
@ -38,6 +53,7 @@
|
|||
{
|
||||
default = pkgs.emerald-legacy-launcher;
|
||||
emerald-legacy-launcher = pkgs.emerald-legacy-launcher;
|
||||
emerald-legacy-launcher-git = pkgs.emerald-legacy-launcher-git;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -46,10 +62,15 @@
|
|||
type = "app";
|
||||
program = lib.getExe self.packages.${system}.default;
|
||||
};
|
||||
emerald-legacy-launcher-git = {
|
||||
type = "app";
|
||||
program = lib.getExe self.packages.${system}.emerald-legacy-launcher-git;
|
||||
};
|
||||
});
|
||||
|
||||
checks = forAllSystems (system: {
|
||||
package = self.packages.${system}.default;
|
||||
package-git = self.packages.${system}.emerald-legacy-launcher-git;
|
||||
});
|
||||
|
||||
devShells = forAllSystems (
|
||||
|
|
@ -59,7 +80,7 @@
|
|||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
inputsFrom = [ pkgs.emerald-legacy-launcher ];
|
||||
inputsFrom = [ pkgs.emerald-legacy-launcher-git ];
|
||||
packages = with pkgs; [
|
||||
cargo
|
||||
rustc
|
||||
|
|
@ -68,6 +89,9 @@
|
|||
cargo-tauri
|
||||
nodejs
|
||||
pnpm_10
|
||||
unzip
|
||||
libarchive
|
||||
python3
|
||||
pkg-config
|
||||
];
|
||||
shellHook = ''
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
libayatana-appindicator,
|
||||
librsvg,
|
||||
udev,
|
||||
version ? "1.5.1",
|
||||
src ? null,
|
||||
}:
|
||||
|
||||
|
|
@ -49,7 +50,7 @@ let
|
|||
in
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "emerald-legacy-launcher";
|
||||
version = "1.5.1";
|
||||
inherit version;
|
||||
|
||||
src = if src != null then src else defaultSrc;
|
||||
|
||||
|
|
@ -123,6 +124,9 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
|||
meta = {
|
||||
description = "FOSS cross-platform launcher for Minecraft Legacy Console Edition";
|
||||
homepage = "https://github.com/LCE-Hub/LCE-Emerald-Launcher";
|
||||
changelog = lib.mkIf (!(lib.hasPrefix "unstable-" version)) (
|
||||
"https://github.com/LCE-Hub/LCE-Emerald-Launcher/releases/tag/v${version}"
|
||||
);
|
||||
license = lib.licenses.gpl3Only;
|
||||
mainProgram = "emerald-legacy-launcher";
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
|
|
|
|||
50
scripts/update-nix-stable.py
Normal file
50
scripts/update-nix-stable.py
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
def update_flake(version: str, src_hash: str) -> None:
|
||||
path = "flake.nix"
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
|
||||
new_content, n_version = re.subn(
|
||||
r'stableVersion = "[^"]*";',
|
||||
f'stableVersion = "{version}";',
|
||||
content,
|
||||
count=1,
|
||||
)
|
||||
new_content, n_hash = re.subn(
|
||||
r'stableSrcHash = "[^"]*";',
|
||||
f'stableSrcHash = "{src_hash}";',
|
||||
new_content,
|
||||
count=1,
|
||||
)
|
||||
|
||||
if n_version != 1 or n_hash != 1:
|
||||
print(
|
||||
f"Error: expected to update stableVersion and stableSrcHash once each "
|
||||
f"(got version={n_version}, hash={n_hash})",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
f.write(new_content)
|
||||
|
||||
print(f"Updated {path}: stableVersion={version} stableSrcHash={src_hash}")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Update flake.nix stableVersion and stableSrcHash"
|
||||
)
|
||||
parser.add_argument("--version", required=True, help="Stable version without v prefix")
|
||||
parser.add_argument("--src-hash", required=True, help="SRI sha256 of the release source")
|
||||
args = parser.parse_args()
|
||||
update_flake(args.version, args.src_hash)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Reference in a new issue