Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@
./services/networking/searx.nix
./services/networking/seeks.nix
./services/networking/skydns.nix
./services/networking/shairport-sync.nix
./services/networking/shout.nix
./services/networking/softether.nix
./services/networking/spiped.nix
Expand Down
80 changes: 80 additions & 0 deletions nixos/modules/services/networking/shairport-sync.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{ config, lib, pkgs, ... }:

with lib;

let

cfg = config.services.shairport-sync;

in

{

###### interface

options = {

services.shairport-sync = {

enable = mkOption {
default = false;
description = ''
Enable the shairport-sync daemon.

Running with a local system-wide or remote pulseaudio server
is recommended.
'';
};

arguments = mkOption {
default = "-v -o pulse";
description = ''
Arguments to pass to the daemon. Defaults to a local pulseaudio
server.
'';
};

user = mkOption {
default = "shairport";
description = ''
User account name under which to run shairport-sync. The account
will be created.
'';
};

};

};


###### implementation

config = mkIf config.services.shairport-sync.enable {

services.avahi.enable = true;

users.extraUsers = singleton
{ name = cfg.user;
description = "Shairport user";
isSystemUser = true;
createHome = true;
home = "/var/lib/shairport-sync";
extraGroups = [ "audio" ] ++ optional config.hardware.pulseaudio.enable "pulse";
};

systemd.services.shairport-sync =
{
description = "shairport-sync";
after = [ "network.target" "avahi-daemon.service" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = cfg.user;
ExecStart = "${pkgs.shairport-sync}/bin/shairport-sync ${cfg.arguments}";
};
};

environment.systemPackages = [ pkgs.shairport-sync ];

};

}