NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.36k stars 13.59k forks source link

BUG: homepage-dashboard customJS config is not respected #297168

Open mgdigital opened 5 months ago

mgdigital commented 5 months ago

Describe the bug

The customJS configuration of the homepage-dashboard service is not respected.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Specify some custom javascript in the customJS option
  2. See that the custom javascript is not loaded

Expected behavior

The custom javascript should be loaded

Additional context

I can see my custom javascript in /etc/homepage-dashboard/custom.js, but the loaded file /api/config/custom.js is blank (I suspect it is loading the empty file at /var/lib/homepage-dashboard/custom.js?)

If it makes any difference, I have the following as per the example, as it doesn't work without this:

  disabledModules = ["services/misc/homepage-dashboard.nix"];
  imports = ["${inputs.nixpkgs-unstable}/nixos/modules/services/misc/homepage-dashboard.nix"];

Notify maintainers

@jnsgruk , btw many thanks for adding this module and for your informative blog post :)

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.81, NixOS, 23.11 (Tapir), 23.11.20240314.878ef7d`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.21.0`
 - channels(root): `"nixos-23.11"`
 - nixpkgs: `/etc/nix/path/nixpkgs`

Add a :+1: reaction to issues you find important.

jnsgruk commented 5 months ago

Hey!

Sorry about this! I'm afk this week due to a house move, but I'll take a look when I can!

jnsgruk commented 5 months ago

Could you add the output of journalctl -u homepage-dashboard? And the section of your config?

mgdigital commented 5 months ago

Sorry about this! I'm afk this week due to a house move, but I'll take a look when I can!

No problem at all!

Could you add the output of journalctl -u homepage-dashboard? And the section of your config?

Yes here's the output:

Mar 19 15:30:16 hetzner-nixos-1 systemd[1]: Started Homepage Dashboard.
Mar 19 15:30:17 hetzner-nixos-1 homepage[257085]: Listening on port 8082
Mar 19 15:31:09 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:31:09.967Z] error: undefined
Mar 19 15:31:16 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:31:16.244Z] error: undefined
Mar 19 15:31:25 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:31:25.744Z] error: undefined
Mar 19 15:31:28 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:31:28.444Z] error: undefined
Mar 19 15:33:15 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:33:15.893Z] error: undefined
Mar 19 15:33:16 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:33:16.237Z] warn: Failed to update prerender cache for /en [Error: EROFS: read-only file system, open '/nix/store/8kl419hdxh7dz1wi5wgq4w3bi1x1s9bg-homepage-dashboard-0.8.9/shar>
Mar 19 15:33:16 hetzner-nixos-1 homepage[257085]:   errno: -30,
Mar 19 15:33:16 hetzner-nixos-1 homepage[257085]:   code: 'EROFS',
Mar 19 15:33:16 hetzner-nixos-1 homepage[257085]:   syscall: 'open',
Mar 19 15:33:16 hetzner-nixos-1 homepage[257085]:   path: '/nix/store/8kl419hdxh7dz1wi5wgq4w3bi1x1s9bg-homepage-dashboard-0.8.9/share/homepage/.next/server/pages/en.html'
Mar 19 15:33:16 hetzner-nixos-1 homepage[257085]: }
Mar 19 15:33:16 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:33:16.608Z] error: undefined
Mar 19 15:33:16 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:33:16.671Z] error: undefined
Mar 19 15:33:16 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:33:16.759Z] error: undefined
Mar 19 15:33:19 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:33:19.044Z] error: undefined
Mar 19 15:33:19 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:33:19.082Z] error: undefined
Mar 19 15:33:19 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:33:19.097Z] error: undefined
Mar 19 15:33:19 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:33:19.184Z] error: undefined
Mar 19 15:33:20 hetzner-nixos-1 homepage[257085]: [2024-03-19T15:33:20.229Z] error: undefined

The above errors seem to only occur when I have custom JS so it may be related.

Here is the associated bit of config:

    customJS = ''
alert("customJS worked!");
'';

For further context, I'm trying to work around the shortcoming of homepage described here, by replacing the glances link href with the correct one: https://github.com/gethomepage/homepage/discussions/3140

jnsgruk commented 4 weeks ago

Hi @mgdigital - is this still an issue for you? I've tried the above configuration today and the alert box displays as I would expect it.

The warning in log can be ignored (I think) - there is some more detail in #328621, but as far as I can tell it's innocuous.