nixpkgs/pkgs/servers/memos/default.nix

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

55 lines
1.2 KiB
Nix
Raw Normal View History

2023-04-02 11:15:19 +02:00
{ fetchFromGitHub, buildGoModule, jq, buildNpmPackage, lib, makeWrapper }:
let
2023-07-14 17:29:16 +02:00
version = "0.13.2";
2023-04-02 11:15:19 +02:00
src = fetchFromGitHub {
owner = "usememos";
repo = "memos";
rev = "v${version}";
hash = "sha256-lcOZg5mlFPp04ZCm5GDhQfSwE2ahSmGhmdAw+pygK0A=";
2023-04-02 11:15:19 +02:00
};
frontend = buildNpmPackage {
pname = "memos-web";
inherit version;
src = "${src}/web";
2023-05-31 05:57:17 +02:00
npmDepsHash = "sha256-36UcHE98dsGvYQWLIc/xgP8Q0IyJ7la0Qoo3lZqUcmw=";
2023-04-02 11:15:19 +02: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;
vendorHash = "sha256-UM/xeRvfvlq+jGzWpc3EU5GJ6Dt7RmTbSt9h3da6f8w=";
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 = "Lightweight, self-hosted memo hub";
maintainers = with maintainers; [ indexyz ];
license = licenses.mit;
2023-11-23 22:09:35 +01:00
mainProgram = "memos";
2023-04-02 11:15:19 +02:00
};
}