nixpkgs/pkgs/by-name/wo/workout-tracker/package.nix
Nikolay Korotkiy 47d2cf0c88
workout-tracker: add assets
From server log:
```sh
12:58PM WRN Not Found app=workout-tracker version=local sha=local module=webserver request.time="2024-09-15 12:58:39.875195 +0400 +04" request.method=GET request.host=localhost:8080 request.path=/assets/dist/htmx.min.js request.query="" request.params=map[*:/dist/htmx.min.js] request.route=/assets* request.ip=127.0.0.1 request.referer=http://localhost:8080/user/signin request.length=0 response.time="2024-09-15 12:58:39.875636 +0400 +04" response.latency=441.574µs response.status=404 response.length=0 error="map[code:404 internal:<nil> message:Not Found]"
```
2024-09-16 21:13:47 +04:00

61 lines
1.3 KiB
Nix

{
lib,
buildGoModule,
buildNpmPackage,
fetchFromGitHub,
nix-update-script,
nixosTests,
...
}:
let
pname = "workout-tracker";
version = "1.18.1";
src = fetchFromGitHub {
owner = "jovandeginste";
repo = "workout-tracker";
rev = "refs/tags/v${version}";
hash = "sha256-Sn6SOHrsp1ZgsPntc2+cmlAEPVBUrYv1vKLKAQvT9m4=";
};
assets = buildNpmPackage {
pname = "${pname}-assets";
inherit version src;
npmDepsHash = "sha256-jHpvCMgjGvaAOfbslaIKfIRiPafScpn3WLnYamm+lbs=";
dontNpmBuild = true;
postPatch = ''
rm Makefile
'';
installPhase = ''
runHook preInstall
cp -r . "$out"
runHook postInstall
'';
};
in
buildGoModule rec {
inherit pname version src;
vendorHash = null;
postPatch = ''
ln -s ${assets}/node_modules ./node_modules
make build-dist
'';
passthru.updateScript = nix-update-script { };
passthru.tests = {
inherit (nixosTests) workout-tracker;
};
meta = {
changelog = "https://github.com/jovandeginste/workout-tracker/releases/tag/v${version}";
description = "Workout tracking web application for personal use";
homepage = "https://github.com/jovandeginste/workout-tracker";
license = lib.licenses.mit;
mainProgram = "workout-tracker";
maintainers = with lib.maintainers; [ bhankas ];
};
}