lol
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchYarnDeps,
6 yarnConfigHook,
7 yarnBuildHook,
8 yarn,
9 fixup-yarn-lock,
10 prefetch-yarn-deps,
11 nixosTests,
12 nodejs_20,
13 nodejs-slim_20,
14 remarshal_0_17,
15 settings ? { },
16}:
17stdenv.mkDerivation (finalAttrs: {
18 pname = "dashy-ui";
19 version = "3.1.1-unstable-2025-09-12";
20 src = fetchFromGitHub {
21 owner = "lissy93";
22 repo = "dashy";
23 rev = "e70ade555fdccf4e723a90f8a2d46fcf83645c4f";
24 hash = "sha256-edsGHc6Hi306aq+TA2g5FL/ZYNfExbcgHS5PWF9O0+0=";
25 };
26 yarnOfflineCache = fetchYarnDeps {
27 yarnLock = finalAttrs.src + "/yarn.lock";
28 hash = "sha256-r36w3Cz/V7E/xPYYpvfQsdk2QXfCVDYE9OxiFNyKP2s=";
29 };
30
31 passthru.tests = {
32 dashy = nixosTests.dashy;
33 };
34
35 # - If no settings are passed, use the default config provided by upstream
36 # - Despite JSON being valid YAML (and the JSON passing the config validator),
37 # there seem to be some issues with JSON in the final build - potentially due to
38 # the way the client parses things
39 # - Instead, we use `remarshal` to convert it to yaml
40 # Config validation needs to happen after yarnConfigHook, since it's what sets the yarn offline cache
41 preBuild = lib.optional (settings != { }) ''
42 echo "Writing settings override..."
43 json2yaml '${builtins.toFile "conf.json" (builtins.toJSON settings)}' user-data/conf.yml
44 yarn validate-config --offline
45 '';
46 installPhase = ''
47 mkdir $out
48 cp -R dist/* $out
49 '';
50
51 nativeBuildInputs = [
52 # This is required to fully pin the NodeJS version, since yarn*Hooks pull in the latest LTS in nixpkgs
53 # The yarn override is the only one technically required (fixup-yarn-lock and prefetch-yarn-deps' node version doesn't affect the end result),
54 # but they've been overridden for the sake of consistency/in case future updates to dashy/node would cause issues with differing major versions
55 (yarnConfigHook.override {
56 fixup-yarn-lock = fixup-yarn-lock.override {
57 nodejs-slim = nodejs-slim_20;
58 };
59 prefetch-yarn-deps = prefetch-yarn-deps.override {
60 nodejs-slim = nodejs-slim_20;
61 };
62 yarn = yarn.override {
63 nodejs = nodejs_20;
64 };
65 })
66 yarnBuildHook
67 nodejs_20
68 # For yaml conversion
69 remarshal_0_17
70 ];
71 doDist = false;
72 meta = {
73 description = "Open source, highly customizable, easy-to-use, privacy-respecting dashboard app";
74 homepage = "https://dashy.to";
75 license = lib.licenses.mit;
76 maintainers = [ lib.maintainers.therealgramdalf ];
77 };
78})