1{ pkgs, ... }:
2{
3 name = "your_spotify";
4 meta = with pkgs.lib.maintainers; {
5 maintainers = [ patrickdag ];
6 };
7
8 nodes.machine = {
9 services.your_spotify = {
10 enable = true;
11 spotifySecretFile = pkgs.writeText "spotifySecretFile" "deadbeef";
12 settings = {
13 CLIENT_ENDPOINT = "http://localhost";
14 API_ENDPOINT = "http://localhost:3000";
15 SPOTIFY_PUBLIC = "beefdead";
16 };
17 enableLocalDB = true;
18 nginxVirtualHost = "localhost";
19 };
20 };
21
22 testScript = ''
23 machine.wait_for_unit("your_spotify.service")
24
25 machine.wait_for_open_port(3000)
26 machine.wait_for_open_port(80)
27
28 out = machine.succeed("curl --fail -X GET 'http://localhost:3000/'")
29 assert "Hello !" in out
30
31 out = machine.succeed("curl --fail -X GET 'http://localhost:80/'")
32 assert "<title>Your Spotify</title>" in out
33 '';
34}