1 { config, lib, pkgs, ... }:
6 streams = builtins.attrNames config.services.liquidsoap.streams;
10 let stream = builtins.getAttr name config.services.liquidsoap.streams; in
13 after = [ "network-online.target" "sound.target" ];
14 description = "${name} liquidsoap stream";
15 wantedBy = [ "multi-user.target" ];
18 ExecStart = "${pkgs.liquidsoap}/bin/liquidsoap ${stream}";
20 LogsDirectory = "liquidsoap";
32 services.liquidsoap.streams = mkOption {
35 Set of Liquidsoap streams to start,
36 one systemd service per stream.
41 example = literalExpression ''
43 myStream1 = "/etc/liquidsoap/myStream1.liq";
44 myStream2 = ./myStream2.liq;
45 myStream3 = "out(playlist(\"/srv/music/\"))";
49 type = types.attrsOf (types.either types.path types.str);
55 config = mkIf (builtins.length streams != 0) {
57 users.users.liquidsoap = {
58 uid = config.ids.uids.liquidsoap;
60 extraGroups = [ "audio" ];
61 description = "Liquidsoap streaming user";
62 home = "/var/lib/liquidsoap";
66 users.groups.liquidsoap.gid = config.ids.gids.liquidsoap;
68 systemd.services = builtins.listToAttrs ( map streamService streams );