Files
nixpkgs/pkgs/by-name/op/openlist/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

98 lines
2.9 KiB
Nix

{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
callPackage,
installShellFiles,
versionCheckHook,
fuse,
}:
buildGoModule (finalAttrs: {
pname = "openlist";
version = "4.1.0";
src = fetchFromGitHub {
owner = "OpenListTeam";
repo = "OpenList";
tag = "v${finalAttrs.version}";
hash = "sha256-505rEnqIwn1EGhzqhcVWYgYqyPsV/obJzaHaK9W2tVA=";
# 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-J8ssJbILb3Gf6Br/PYkRAn4Haduf82iCYCfSAEi3nO4=";
buildInputs = [ fuse ];
tags = [ "jsoniter" ];
ldflags = [
"-s"
"-X \"github.com/OpenListTeam/OpenList/v4/internal/conf.GitAuthor=The OpenList Projects Contributors <noreply@openlist.team>\""
"-X github.com/OpenListTeam/OpenList/v4/internal/conf.Version=${finalAttrs.version}"
"-X github.com/OpenListTeam/OpenList/v4/internal/conf.WebVersion=${finalAttrs.frontend.version}"
];
preConfigure = ''
rm -rf public/dist
cp -r ${finalAttrs.frontend} public/dist
'';
preBuild = ''
ldflags+=" -X \"github.com/OpenListTeam/OpenList/v4/internal/conf.BuiltAt=$(<SOURCE_DATE_EPOCH)\""
ldflags+=" -X github.com/OpenListTeam/OpenList/v4/internal/conf.GitCommit=$(<COMMIT)"
'';
checkFlags =
let
# Skip tests that require network access
skippedTests = [
"TestHTTPAll"
"TestWebsocketAll"
"TestWebsocketCaller"
"TestDownloadOrder"
];
in
[ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
nativeBuildInputs = [ installShellFiles ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd OpenList \
--bash <($out/bin/OpenList completion bash) \
--fish <($out/bin/OpenList completion fish) \
--zsh <($out/bin/OpenList completion zsh)
mkdir $out/share/powershell/ -p
$out/bin/OpenList completion powershell > $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";
};
})