Skip to content

Commit

Permalink
feat: alist use source
Browse files Browse the repository at this point in the history
  • Loading branch information
5aaee9 committed Jun 27, 2024
1 parent ccfc3ff commit 9ea5f4b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 56 deletions.
58 changes: 32 additions & 26 deletions packages/alist/pkg.nix
Original file line number Diff line number Diff line change
@@ -1,39 +1,45 @@
{ stdenv, glibc, fetchurl }:

{ stdenv, glibc, fetchFromGitHub, buildGoModule, fetchurl, lib }:

let
info = import ./version.nix;
inherit (info) version hash;

fetchSrc = {
x86_64-linux = {
url = "https://github.com/alist-org/alist/releases/download/v${version}/alist-linux-musl-amd64.tar.gz";
sha256 = hash.x86_64-linux;
};
aarch64-linux = {
url = "https://github.com/alist-org/alist/releases/download/v${version}/alist-linux-musl-arm64.tar.gz";
sha256 = hash.aarch64-linux;
};
}."${stdenv.system}" or (throw "Unsupported system");
version = "3.35.0";
alist-web = fetchurl {
url = "https://github.com/alist-org/alist-web/releases/download/${version}/dist.tar.gz";
sha256 = "sha256-lAYIwrn2TPWFrU0kFUXl8eWeX25U746iycOimZgxP8c=";
};
in
stdenv.mkDerivation rec {
buildGoModule rec {
pname = "alist";
inherit version;
version = "3.35.0";

src = fetchurl {
inherit (fetchSrc) url sha256;
name = "${pname}-${version}.tgz";
src = fetchFromGitHub {
owner = "alist-org";
repo = "alist";
rev = "v${version}";
sha256 = "sha256-N9WgaPzc8cuDN7N0Ny3t6ARGla0lCluzF2Mut3Pg880=";
};

phases = "installPhase";
vendorHash = "sha256-lZIM1Cy3JmcrnxC+HN9Ni7P70yVR1LtHVKe3nOhA4fg=";

ldflags = [
"-s"
"-w"
"-X github.com/alist-org/alist/v3/internal/conf.Version=v${version}"
"-X github.com/alist-org/alist/v3/internal/conf.WebVersion=v${version}"
];

installPhase = ''
tar zxvf $src
mkdir -p "$out"/bin/
install -m 755 alist -t "$out"/bin/
postPatch = ''
tar zxvf ${alist-web}
rm -rf public/dist
mv dist public/
'';

passthru.updateScript = ./update.sh;
tags = [
"jsoniter"
];

modSha256 = lib.fakeSha256;
subPackages = [ "." ];

meta = {
mainProgram = "alist";
};
Expand Down
21 changes: 0 additions & 21 deletions packages/alist/update.sh

This file was deleted.

7 changes: 0 additions & 7 deletions packages/alist/version.nix

This file was deleted.

4 changes: 2 additions & 2 deletions update.bash
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ nix-update --commit --flake aliyundrive-webdav
nix-update --commit --version "$(curl --fail -sI 'https://mikrotik.com/mt_redirect.php?code=winbox64' | grep -i Location | grep -oP '([\d]{1,}\.[\d]{1,})')" --flake winbox
nix-update --commit --version "$(curl --fail -s 'https://mattermost.com/download/' | grep -oP "Latest Release:</strong> \K([0-9\\.]*)(?=</p>)")" --flake mattermost-ent

for package in "alist" "teleport-ent"; do
for package in "teleport-ent"; do
current_verision=$(nix eval --raw .#packages.x86_64-linux."$package".version)
pushd packages/$package/
bash update.sh
Expand All @@ -49,4 +49,4 @@ for package in "alist" "teleport-ent"; do
done
# nix-update -commit --flake teleport-ent
# nix-update --commit --flake alist
nix-update --commit --flake alist

0 comments on commit 9ea5f4b

Please sign in to comment.