omnom: 0-unstable-2024-08-29 -> 0-unstable-2024-11-20 (#357835)

This commit is contained in:
kirillrdy
2024-11-25 06:58:38 +11:00
committed by GitHub
+45 -19
View File
@@ -3,17 +3,21 @@
buildGoModule,
fetchFromGitHub,
makeWrapper,
# for addons
buildNpmPackage,
zip,
}:
buildGoModule {
buildGoModule rec {
pname = "omnom";
version = "0-unstable-2024-08-29";
version = "0-unstable-2024-11-20";
src = fetchFromGitHub {
owner = "asciimoo";
repo = "omnom";
rev = "1fcd7787886503f703bbcd31b193d4c93acc5610";
hash = "sha256-o/n8rgngQkYEn8J0aFpCiD4qrWVFaaa305OxiscU6+8=";
rev = "dbf40c9c50b74335286faea7c5070bba11dced83";
hash = "sha256-dl0jfFwn+Fd8/aQNhXFNEoDIMgMia2MHZntp0EKhimg=";
fetchSubmodules = true;
};
@@ -28,24 +32,46 @@ buildGoModule {
"-w"
];
postPatch = ''
# For the default config to work, we have to put `static/data` and
# `db.sqlite3` in a temporary directory since they need to be writeable.
#
# NOTE: Currently, `static/data` only holds the snapshots directory.
substituteInPlace config.yml \
--replace-fail 'root: "./static/data"' 'root: "/tmp/omnom/static/data"' \
--replace-fail 'connection: "./db.sqlite3"' 'connection: "/tmp/omnom/db.sqlite3"' \
--replace-fail 'debug: true' 'debug: false'
'';
postBuild =
let
omnom-addons = buildNpmPackage {
pname = "omnom-addons";
inherit version src;
npmDepsHash = "sha256-sUn5IvcHWJ/yaqeGz9SGvGx9HHAlrcnS0lJxIxUVS6M=";
sourceRoot = "${src.name}/ext";
npmPackFlags = [ "--ignore-scripts" ];
nativeBuildInputs = [ zip ];
postBuild = ''
mkdir -p $out
zip -r "$out/omnom_ext_src.zip" README.md src utils package* webpack.config.js
pushd build
zip "$out/omnom_ext_chrome.zip" ./* icons/* -x manifest_ff.json
zip "$out/omnom_ext_firefox.zip" ./* icons/* -x manifest_ff.json
popd
'';
postCheck = ''
npm run build-test
'';
};
in
''
mkdir -p $out/share/addons
# Copy Firefox and Chrome addons
cp -r ${omnom-addons}/*.zip $out/share/addons
'';
postInstall = ''
mkdir -p $out/share
cp -r config.yml static templates $out/share
mkdir -p $out/share/examples
wrapProgram $out/bin/omnom \
--chdir $out/share \
--set-default GIN_MODE release
cp -r static templates $out/share
cp config.yml_sample $out/share/examples/config.yml
'';
meta = {