aboutsummaryrefslogtreecommitdiff
path: root/users/ryan/modules/simple-bar/server.nix
blob: f9b636c7935ba8dd632b6868faed805f7a998c52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ pkgs, lib, ... }:
let
  src = builtins.fetchGit {
    url = "https://github.com/Jean-Tinland/simple-bar-server.git";
    rev = "0c99921d023b459e44bbba8cca6d8947262359b6";
    shallow = true;
  };

  simple-bar-server = pkgs.buildNpmPackage {
    pname = "simple-bar-server";
    version = "0-unstable";
    inherit src;

    npmDepsHash = "sha256-JKUiOqAAoE/TJriErvaaT03uKtX8t1gFh+JzG4GcriI=";
    dontNpmBuild = true;         # no build script, it's just a server

    installPhase = ''
      runHook preInstall
      mkdir -p $out/lib/simple-bar-server
      cp -r . $out/lib/simple-bar-server/
      runHook postInstall
    '';
  };
in
{
    enable = true;
    config = {
        ProgramArguments = [ "${pkgs.nodejs}/bin/node" "${simple-bar-server}/lib/simple-bar-server/index.js" ];
        KeepAlive = true;
        RunAtLoad = true;
        StandardOutPath = "/tmp/simple-bar-server.out.log";
        StandardErrorPath = "/tmp/simple-bar-server.err.log";
    };
}