nixpkgs-suyu/pkgs/servers/memos/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.1 KiB
Nix
Raw Normal View History

2023-04-02 11:15:19 +02:00
{ fetchFromGitHub, buildGoModule, jq, buildNpmPackage, lib, makeWrapper }:
let
2023-05-25 06:32:02 +02:00
version = "0.13.0";
2023-04-02 11:15:19 +02:00
src = fetchFromGitHub {
owner = "usememos";
repo = "memos";
rev = "v${version}";
2023-05-25 06:32:02 +02:00
sha256 = "7rMs1jFyGlCfc7LVZvsQ9tuBLsWP/S9DXYcEPZ86tKw=";
2023-04-02 11:15:19 +02:00
};
frontend = buildNpmPackage {
pname = "memos-web";
inherit version;
src = "${src}/web";
npmDepsHash = "sha256-vgO5HWbV/oR1GenK9q5a1bhlTSJqtF4HBcQTZ3DqZq8=";
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 06:32:02 +02:00
vendorSha256 = "sha256-OztHMpOj7Ewmxu+pzPmzmtHBDe1sbzj805In37mFjzU=";
2023-04-02 11:15:19 +02: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;
};
}