2023-04-02 09:15:19 +00:00
|
|
|
{ fetchFromGitHub, buildGoModule, jq, buildNpmPackage, lib, makeWrapper }:
|
|
|
|
|
|
|
|
let
|
2023-05-31 03:57:17 +00:00
|
|
|
version = "0.13.1";
|
2023-04-02 09:15:19 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "usememos";
|
|
|
|
repo = "memos";
|
|
|
|
rev = "v${version}";
|
2023-05-31 03:57:17 +00:00
|
|
|
sha256 = "VUY81ir7cPtuHodJhkSz3bmnoIeQH20kbg+duDcjfwM=";
|
2023-04-02 09:15:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
frontend = buildNpmPackage {
|
|
|
|
pname = "memos-web";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = "${src}/web";
|
|
|
|
|
2023-05-31 03:57:17 +00:00
|
|
|
npmDepsHash = "sha256-36UcHE98dsGvYQWLIc/xgP8Q0IyJ7la0Qoo3lZqUcmw=";
|
2023-04-02 09:15:19 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
cp ${./package-lock.json} package-lock.json
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cp -r dist $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "memos";
|
|
|
|
inherit version src;
|
|
|
|
|
|
|
|
# check will unable to access network in sandbox
|
|
|
|
doCheck = false;
|
2023-05-25 04:32:02 +00:00
|
|
|
vendorSha256 = "sha256-OztHMpOj7Ewmxu+pzPmzmtHBDe1sbzj805In37mFjzU=";
|
2023-04-02 09:15:19 +00:00
|
|
|
|
|
|
|
# Inject frontend assets into go embed
|
|
|
|
prePatch = ''
|
|
|
|
rm -rf server/dist
|
|
|
|
cp -r ${frontend} server/dist
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
updateScript = ./update.sh;
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://usememos.com";
|
|
|
|
description = "A lightweight, self-hosted memo hub";
|
|
|
|
maintainers = with maintainers; [ indexyz ];
|
|
|
|
license = licenses.mit;
|
|
|
|
};
|
|
|
|
}
|