Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 74 additions & 11 deletions .github/workflows/wps365-cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,48 @@ on:
workflow_dispatch:

jobs:
check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- system: x86_64-linux
os: ubuntu-22.04
- system: aarch64-linux
os: ubuntu-24.04-arm
flake-check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v12
with:
extra-conf: |
accept-flake-config = true
allow-import-from-derivation = true

- name: Configure Nix for unfree packages
run: |
mkdir -p ~/.config/nixpkgs
echo '{ allowUnfree = true; }' > ~/.config/nixpkgs/config.nix

- name: Check flake
run: nix flake check --impure

build-x86_64:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v12
with:
extra-conf: |
accept-flake-config = true
allow-import-from-derivation = true

- name: Configure Nix for unfree packages
run: |
mkdir -p ~/.config/nixpkgs
echo '{ allowUnfree = true; }' > ~/.config/nixpkgs/config.nix

- name: Build wps365-cn (x86_64-linux)
run: nix build .#packages.x86_64-linux.wps365-cn --print-out-paths --impure

build-aarch64:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4

Expand All @@ -33,5 +66,35 @@ jobs:
mkdir -p ~/.config/nixpkgs
echo '{ allowUnfree = true; }' > ~/.config/nixpkgs/config.nix

- name: Build wps365-cn
run: nix build .#packages.${{ matrix.system }}.wps365-cn --print-out-paths --impure
- name: Build wps365-cn (aarch64-linux)
run: nix build .#packages.aarch64-linux.wps365-cn --print-out-paths --impure

build-loongarch64:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Setup QEMU for loongarch64
uses: docker/setup-qemu-action@v3
with:
platforms: linux/loong64

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v12
with:
extra-conf: |
accept-flake-config = true
allow-import-from-derivation = true
extra-platforms = loongarch64-linux
system-features = gccarch-la64v1.0
extra-substituters = https://cache.nix4loong.cn
extra-trusted-public-keys = cache.nix4loong.cn-1:zmkwLihdSUyy6OFSVgvK3br0EaUEczLiJgDfvOmm3pA=

- name: Configure Nix for unfree packages
run: |
mkdir -p ~/.config/nixpkgs
echo '{ allowUnfree = true; }' > ~/.config/nixpkgs/config.nix

- name: Build wps365-cn (loongarch64-linux)
run: |
nix build .#packages.loongarch64-linux.wps365-cn --print-out-paths -L
11 changes: 9 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@
self,
nixpkgs,
}: let
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "loongarch64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in {
packages = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
in {
wps365-cn = pkgs.callPackage ./pkgs/wps365-cn {};
}
// pkgs.lib.optionalAttrs (system == "x86_64-linux") {
wpsoffice-xa = pkgs.callPackage ./pkgs/wpsoffice-xa {};
wpsoffice-cn = pkgs.callPackage ./pkgs/wpsoffice-cn {};
}
// {
default = self.packages.${system}.wps365-cn;
});
};
Expand Down
7 changes: 6 additions & 1 deletion pkgs/wps365-cn/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ let
meta = {
description = "WPS365 Office Suite";
homepage = "https://www.wps.cn";
platforms = [ "x86_64-linux" "aarch64-linux" ];
platforms = [ "x86_64-linux" "aarch64-linux" "loongarch64-linux" ];
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
hydraPlatforms = [ ];
license = lib.licenses.unfree;
Expand All @@ -74,6 +74,11 @@ stdenv.mkDerivation {
gnutar
];

autoPatchelfIgnoreMissingDeps = lib.optionals (stdenv.hostPlatform.system == "loongarch64-linux") [
"ld.so.1"
"libde265.so.0"
];

buildInputs = [
alsa-lib
libjpeg
Expand Down
4 changes: 4 additions & 0 deletions pkgs/wps365-cn/sources.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@
url = "https://pubwps-wps365-obs.wpscdn.cn/download/Linux/24730/wps-office_12.1.2.24730.AK.preread.sw_644358_arm64.deb";
hash = "sha256-oj28gypiX9FcZqCR1Czdmg+Orv5r3eDEprSLuy4lu0A=";
};
loongarch64-linux = {
url = "https://pubwps-wps365-obs.wpscdn.cn/download/Linux/24730/wps-office_12.1.2.24730.AK.preread.sw_625684_loongarch64.deb";
hash = "sha256-0rH7dF4iXcNORxKzspkW3JnXbV1a/RujpVknmyoLgAM=";
};
}
12 changes: 12 additions & 0 deletions pkgs/wps365-cn/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ BUILD_NUMBER="24730"

URL_AMD64="https://pubwps-wps365-obs.wpscdn.cn/download/Linux/${BUILD_NUMBER}/wps-office_${VERSION}.AK.preread.sw_644359_amd64.deb"
URL_ARM64="https://pubwps-wps365-obs.wpscdn.cn/download/Linux/${BUILD_NUMBER}/wps-office_${VERSION}.AK.preread.sw_644358_arm64.deb"
URL_LOONGARCH64="https://pubwps-wps365-obs.wpscdn.cn/download/Linux/${BUILD_NUMBER}/wps-office_${VERSION}.AK.preread.sw_625684_loongarch64.deb"

echo "Fetching new hash for x86_64-linux version ${VERSION}..."
HASH_AMD64_OUTPUT=$(nix-prefetch-url --name "wps-office_${VERSION}_amd64.deb" "$URL_AMD64" 2>&1)
Expand All @@ -27,6 +28,13 @@ SRI_HASH_ARM64=$(nix hash to-sri --type sha256 "$HASH_ARM64")

echo "New hash for aarch64-linux: $SRI_HASH_ARM64"

echo "Fetching new hash for loongarch64-linux version ${VERSION}..."
HASH_LOONGARCH64_OUTPUT=$(nix-prefetch-url --name "wps-office_${VERSION}_loongarch64.deb" "$URL_LOONGARCH64" 2>&1)
HASH_LOONGARCH64=$(echo "$HASH_LOONGARCH64_OUTPUT" | tail -n 1)
SRI_HASH_LOONGARCH64=$(nix hash to-sri --type sha256 "$HASH_LOONGARCH64")

echo "New hash for loongarch64-linux: $SRI_HASH_LOONGARCH64"

cat > "$SOURCES_FILE" << EOF
# Generated by ./update.sh - do not update manually!
# Last updated: $(date +%Y-%m-%d)
Expand All @@ -40,6 +48,10 @@ cat > "$SOURCES_FILE" << EOF
url = "${URL_ARM64}";
hash = "${SRI_HASH_ARM64}";
};
loongarch64-linux = {
url = "${URL_LOONGARCH64}";
hash = "${SRI_HASH_LOONGARCH64}";
};
}
EOF

Expand Down
Loading