From e2a68ed112c98ba7da849cf368cf21e504eeeb6b Mon Sep 17 00:00:00 2001 From: Moraxyc Date: Sat, 21 Jun 2025 15:50:22 +0800 Subject: [PATCH 1/2] openlist: init at 4.0.0 --- pkgs/by-name/op/openlist/frontend.nix | 62 ++++++++++++++++ pkgs/by-name/op/openlist/package.nix | 103 ++++++++++++++++++++++++++ pkgs/by-name/op/openlist/update.nix | 47 ++++++++++++ 3 files changed, 212 insertions(+) create mode 100644 pkgs/by-name/op/openlist/frontend.nix create mode 100644 pkgs/by-name/op/openlist/package.nix create mode 100644 pkgs/by-name/op/openlist/update.nix diff --git a/pkgs/by-name/op/openlist/frontend.nix b/pkgs/by-name/op/openlist/frontend.nix new file mode 100644 index 000000000000..2d01560617af --- /dev/null +++ b/pkgs/by-name/op/openlist/frontend.nix @@ -0,0 +1,62 @@ +{ + lib, + stdenvNoCC, + fetchFromGitHub, + fetchzip, + + nodejs, + pnpm_10, +}: + +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "openlist-frontend"; + version = "4.0.0-rc.4"; + + src = fetchFromGitHub { + owner = "OpenListTeam"; + repo = "OpenList-Frontend"; + tag = "v${finalAttrs.version}"; + hash = "sha256-ZAEaGFOWzL3apV6KXokLV8GGhmp9C38npUhBngdPbq0="; + }; + + i18n = fetchzip { + url = "https://github.com/OpenListTeam/OpenList-Frontend/releases/download/v${finalAttrs.version}/i18n.tar.gz"; + hash = "sha256-AzH1rZFqEH8sovZZfJykvsEmCedEZWigQFHWHl6/PiE="; + stripRoot = false; + }; + + nativeBuildInputs = [ + nodejs + pnpm_10.configHook + ]; + + pnpmDeps = pnpm_10.fetchDeps { + inherit (finalAttrs) pname version src; + hash = "sha256-4NKzy4q6DjWgTL63WBEeDxjAsrgcM5vfHqtmZpS5dug="; + }; + + buildPhase = '' + runHook preBuild + + cp -r ${finalAttrs.i18n}/* src/lang/ + pnpm build + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + cp -r dist $out + echo -n "v${finalAttrs.version}" > $out/VERSION + + runHook postInstall + ''; + + meta = { + description = "Frontend of OpenList"; + homepage = "https://github.com/OpenListTeam/OpenList-Frontend"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ moraxyc ]; + }; +}) diff --git a/pkgs/by-name/op/openlist/package.nix b/pkgs/by-name/op/openlist/package.nix new file mode 100644 index 000000000000..d0fa4fdb52f5 --- /dev/null +++ b/pkgs/by-name/op/openlist/package.nix @@ -0,0 +1,103 @@ +{ + lib, + stdenv, + buildGoModule, + fetchFromGitHub, + callPackage, + buildPackages, + installShellFiles, + versionCheckHook, + fuse, +}: + +buildGoModule (finalAttrs: { + pname = "openlist"; + version = "4.0.0"; + + src = fetchFromGitHub { + owner = "OpenListTeam"; + repo = "OpenList"; + tag = "v${finalAttrs.version}"; + hash = "sha256-ir1yOVbf4qP0YUkE0yxOEp92PPMRyHw0VrIH5DQAvZQ="; + # populate values that require us to use git. By doing this in postFetch we + # can delete .git afterwards and maintain better reproducibility of the src. + leaveDotGit = true; + postFetch = '' + cd "$out" + git rev-parse HEAD > $out/COMMIT + # '0000-00-00T00:00:00Z' + date -u -d "@$(git log -1 --pretty=%ct)" "+%Y-%m-%dT%H:%M:%SZ" > $out/SOURCE_DATE_EPOCH + find "$out" -name .git -print0 | xargs -0 rm -rf + ''; + }; + + frontend = callPackage ./frontend.nix { }; + + proxyVendor = true; + vendorHash = "sha256-e1glgNp5aYl1cEuLdMMLa8sE9lSuiLVdPCX9pek5grE="; + + buildInputs = [ fuse ]; + + tags = [ "jsoniter" ]; + + ldflags = [ + "-s" + "-X \"github.com/OpenListTeam/OpenList/internal/conf.GitAuthor=The OpenList Projects Contributors \"" + "-X github.com/OpenListTeam/OpenList/internal/conf.Version=${finalAttrs.version}" + "-X github.com/OpenListTeam/OpenList/internal/conf.WebVersion=${finalAttrs.frontend.version}" + ]; + + preConfigure = '' + rm -rf public/dist + cp -r ${finalAttrs.frontend} public/dist + ''; + + preBuild = '' + ldflags+=" -X \"github.com/OpenListTeam/OpenList/internal/conf.BuiltAt=$( $out/share/powershell/OpenList.Completion.ps1 + '' + ); + + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgram = "${placeholder "out"}/bin/OpenList"; + versionCheckProgramArg = "version"; + + passthru.updateScript = lib.getExe (callPackage ./update.nix { }); + + meta = { + description = "AList Fork to Anti Trust Crisis"; + homepage = "https://github.com/OpenListTeam/OpenList"; + license = lib.licenses.agpl3Only; + maintainers = with lib.maintainers; [ moraxyc ]; + mainProgram = "OpenList"; + }; +}) diff --git a/pkgs/by-name/op/openlist/update.nix b/pkgs/by-name/op/openlist/update.nix new file mode 100644 index 000000000000..fc181992d576 --- /dev/null +++ b/pkgs/by-name/op/openlist/update.nix @@ -0,0 +1,47 @@ +{ + writeShellApplication, + nix, + nix-update, + curl, + common-updater-scripts, + jq, +}: + +writeShellApplication { + name = "update-openlist"; + runtimeInputs = [ + curl + jq + nix + common-updater-scripts + nix-update + ]; + + text = '' + # get old info + oldVersion=$(nix-instantiate --eval --strict -A "openlist.version" | jq -e -r) + + get_latest_release() { + local repo=$1 + curl --fail ''${GITHUB_TOKEN:+ -H "Authorization: bearer $GITHUB_TOKEN"} \ + -s "https://api.github.com/repos/OpenListTeam/$repo/releases/latest" | jq -r ".tag_name" + } + + version=$(get_latest_release "OpenList") + version="''${version#v}" + frontendVersion=$(get_latest_release "OpenList-Frontend") + frontendVersion="''${frontendVersion#v}" + + if [[ "$oldVersion" == "$version" ]]; then + echo "Already up to date!" + exit 0 + fi + + nix-update openlist.frontend --version="$frontendVersion" + update-source-version openlist.frontend "$frontendVersion" \ + --source-key=i18n --ignore-same-version \ + --file=pkgs/by-name/op/openlist/frontend.nix + + nix-update openlist --version="$version" + ''; +} From d8bbec0b56378f96fbcbac40aea57cf9fcc1c736 Mon Sep 17 00:00:00 2001 From: Moraxyc Date: Mon, 23 Jun 2025 00:03:14 +0800 Subject: [PATCH 2/2] openlist: 4.0.0 -> 4.0.1 --- pkgs/by-name/op/openlist/frontend.nix | 8 ++++---- pkgs/by-name/op/openlist/package.nix | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/by-name/op/openlist/frontend.nix b/pkgs/by-name/op/openlist/frontend.nix index 2d01560617af..3d4bd099069b 100644 --- a/pkgs/by-name/op/openlist/frontend.nix +++ b/pkgs/by-name/op/openlist/frontend.nix @@ -10,18 +10,18 @@ stdenvNoCC.mkDerivation (finalAttrs: { pname = "openlist-frontend"; - version = "4.0.0-rc.4"; + version = "4.0.1"; src = fetchFromGitHub { owner = "OpenListTeam"; repo = "OpenList-Frontend"; tag = "v${finalAttrs.version}"; - hash = "sha256-ZAEaGFOWzL3apV6KXokLV8GGhmp9C38npUhBngdPbq0="; + hash = "sha256-WflnK/DXg2kmTcOD97jiZP8kb/cEdW7SrVnNQLrWKjA="; }; i18n = fetchzip { url = "https://github.com/OpenListTeam/OpenList-Frontend/releases/download/v${finalAttrs.version}/i18n.tar.gz"; - hash = "sha256-AzH1rZFqEH8sovZZfJykvsEmCedEZWigQFHWHl6/PiE="; + hash = "sha256-zms4x4C1CW39o/8uVm5gbasKCJQx6Oh3h66BHF1vnWY="; stripRoot = false; }; @@ -32,7 +32,7 @@ stdenvNoCC.mkDerivation (finalAttrs: { pnpmDeps = pnpm_10.fetchDeps { inherit (finalAttrs) pname version src; - hash = "sha256-4NKzy4q6DjWgTL63WBEeDxjAsrgcM5vfHqtmZpS5dug="; + hash = "sha256-PTZ+Vhg3hNnORnulkzuVg6TF/jY0PvUWYja9z7S4GdM="; }; buildPhase = '' diff --git a/pkgs/by-name/op/openlist/package.nix b/pkgs/by-name/op/openlist/package.nix index d0fa4fdb52f5..515b7d9b479a 100644 --- a/pkgs/by-name/op/openlist/package.nix +++ b/pkgs/by-name/op/openlist/package.nix @@ -12,13 +12,13 @@ buildGoModule (finalAttrs: { pname = "openlist"; - version = "4.0.0"; + version = "4.0.1"; src = fetchFromGitHub { owner = "OpenListTeam"; repo = "OpenList"; tag = "v${finalAttrs.version}"; - hash = "sha256-ir1yOVbf4qP0YUkE0yxOEp92PPMRyHw0VrIH5DQAvZQ="; + hash = "sha256-PqCGA2DAfZvDqdnQzqlmz2vlybYokJe+Ybzp5BcJDGU="; # populate values that require us to use git. By doing this in postFetch we # can delete .git afterwards and maintain better reproducibility of the src. leaveDotGit = true;