mirror of
https://github.com/LCE-Hub/LCE-Emerald-Launcher.git
synced 2026-09-23 08:32:51 +00:00
Fix: Added stable branch to flake and needed packages (#165)
This commit is contained in:
@@ -24,8 +24,11 @@ jobs:
|
|||||||
|
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
|
|
||||||
- name: Build package
|
- name: Build stable package
|
||||||
run: nix build .#default --print-build-logs
|
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
|
- name: Flake check
|
||||||
run: nix flake check --print-build-logs
|
run: nix flake check --print-build-logs
|
||||||
@@ -33,6 +36,8 @@ jobs:
|
|||||||
- name: Verify outputs
|
- name: Verify outputs
|
||||||
run: |
|
run: |
|
||||||
test -x ./result/bin/emerald-legacy-launcher
|
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/bin/
|
||||||
|
ls -la ./result-git/bin/
|
||||||
ls -la ./result/share/applications/ || true
|
ls -la ./result/share/applications/ || true
|
||||||
|
|||||||
@@ -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
|
||||||
|
)
|
||||||
@@ -137,14 +137,20 @@ paru -S emerald-legacy-launcher-bin # or yay
|
|||||||
**Nix:**
|
**Nix:**
|
||||||
Requires [Nix](https://nixos.org/download/) with flakes enabled (`experimental-features = nix-command flakes` in `nix.conf`).
|
Requires [Nix](https://nixos.org/download/) with flakes enabled (`experimental-features = nix-command flakes` in `nix.conf`).
|
||||||
```bash
|
```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
|
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
|
# 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:**
|
**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):
|
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):
|
||||||
|
|||||||
@@ -22,10 +22,25 @@
|
|||||||
inherit system;
|
inherit system;
|
||||||
overlays = [ self.overlays.default ];
|
overlays = [ self.overlays.default ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Bump these together when packaging a new upstream stable release.
|
||||||
|
stableVersion = "1.5.1";
|
||||||
|
stableSrcHash = "sha256-XDR6YCWfVeQgIokMfksakw7tqQ+2uWGFqUkLumJU0EA=";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
overlays.default = final: _prev: {
|
overlays.default = final: _prev: {
|
||||||
emerald-legacy-launcher = final.callPackage ./nix/package.nix {
|
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;
|
src = self;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -38,6 +53,7 @@
|
|||||||
{
|
{
|
||||||
default = pkgs.emerald-legacy-launcher;
|
default = pkgs.emerald-legacy-launcher;
|
||||||
emerald-legacy-launcher = 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";
|
type = "app";
|
||||||
program = lib.getExe self.packages.${system}.default;
|
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: {
|
checks = forAllSystems (system: {
|
||||||
package = self.packages.${system}.default;
|
package = self.packages.${system}.default;
|
||||||
|
package-git = self.packages.${system}.emerald-legacy-launcher-git;
|
||||||
});
|
});
|
||||||
|
|
||||||
devShells = forAllSystems (
|
devShells = forAllSystems (
|
||||||
@@ -59,7 +80,7 @@
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
inputsFrom = [ pkgs.emerald-legacy-launcher ];
|
inputsFrom = [ pkgs.emerald-legacy-launcher-git ];
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
cargo
|
cargo
|
||||||
rustc
|
rustc
|
||||||
@@ -68,6 +89,9 @@
|
|||||||
cargo-tauri
|
cargo-tauri
|
||||||
nodejs
|
nodejs
|
||||||
pnpm_10
|
pnpm_10
|
||||||
|
unzip
|
||||||
|
libarchive
|
||||||
|
python3
|
||||||
pkg-config
|
pkg-config
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
|||||||
+5
-1
@@ -15,6 +15,7 @@
|
|||||||
libayatana-appindicator,
|
libayatana-appindicator,
|
||||||
librsvg,
|
librsvg,
|
||||||
udev,
|
udev,
|
||||||
|
version ? "1.5.1",
|
||||||
src ? null,
|
src ? null,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@@ -49,7 +50,7 @@ let
|
|||||||
in
|
in
|
||||||
rustPlatform.buildRustPackage (finalAttrs: {
|
rustPlatform.buildRustPackage (finalAttrs: {
|
||||||
pname = "emerald-legacy-launcher";
|
pname = "emerald-legacy-launcher";
|
||||||
version = "1.5.1";
|
inherit version;
|
||||||
|
|
||||||
src = if src != null then src else defaultSrc;
|
src = if src != null then src else defaultSrc;
|
||||||
|
|
||||||
@@ -123,6 +124,9 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
|||||||
meta = {
|
meta = {
|
||||||
description = "FOSS cross-platform launcher for Minecraft Legacy Console Edition";
|
description = "FOSS cross-platform launcher for Minecraft Legacy Console Edition";
|
||||||
homepage = "https://github.com/LCE-Hub/LCE-Emerald-Launcher";
|
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;
|
license = lib.licenses.gpl3Only;
|
||||||
mainProgram = "emerald-legacy-launcher";
|
mainProgram = "emerald-legacy-launcher";
|
||||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||||
|
|||||||
@@ -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()
|
||||||
Reference in New Issue
Block a user