Add slimserver nixos module
This commit is contained in:
parent
ad88df249c
commit
45d8d6ebeb
|
@ -288,6 +288,7 @@
|
||||||
kresd = 270;
|
kresd = 270;
|
||||||
rpc = 271;
|
rpc = 271;
|
||||||
geoip = 272;
|
geoip = 272;
|
||||||
|
slimserver = 273;
|
||||||
|
|
||||||
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
||||||
|
|
||||||
|
@ -545,6 +546,7 @@
|
||||||
kresd = 270;
|
kresd = 270;
|
||||||
#rpc = 271; # unused
|
#rpc = 271; # unused
|
||||||
#geoip = 272; # unused
|
#geoip = 272; # unused
|
||||||
|
slimserver = 273;
|
||||||
|
|
||||||
# When adding a gid, make sure it doesn't match an existing
|
# When adding a gid, make sure it doesn't match an existing
|
||||||
# uid. Users and groups with the same name should have equal
|
# uid. Users and groups with the same name should have equal
|
||||||
|
|
|
@ -128,6 +128,7 @@
|
||||||
./services/audio/liquidsoap.nix
|
./services/audio/liquidsoap.nix
|
||||||
./services/audio/mpd.nix
|
./services/audio/mpd.nix
|
||||||
./services/audio/mopidy.nix
|
./services/audio/mopidy.nix
|
||||||
|
./services/audio/slimserver.nix
|
||||||
./services/audio/squeezelite.nix
|
./services/audio/squeezelite.nix
|
||||||
./services/audio/ympd.nix
|
./services/audio/ympd.nix
|
||||||
./services/backup/almir.nix
|
./services/backup/almir.nix
|
||||||
|
|
95
nixos/modules/services/audio/slimserver.nix
Normal file
95
nixos/modules/services/audio/slimserver.nix
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
cfg = config.services.slimserver;
|
||||||
|
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
|
||||||
|
services.slimserver = {
|
||||||
|
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to enable slimserver.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.slimserver;
|
||||||
|
defaultText = "pkgs.slimserver";
|
||||||
|
description = "Slimserver package to use.";
|
||||||
|
};
|
||||||
|
|
||||||
|
dataDir = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "/var/lib/slimserver";
|
||||||
|
description = ''
|
||||||
|
The directory where slimserver stores its state, tag cache,
|
||||||
|
playlists etc.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
network = {
|
||||||
|
|
||||||
|
listenAddress = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "127.0.0.1";
|
||||||
|
example = "any";
|
||||||
|
description = ''
|
||||||
|
The address for the daemon to listen on.
|
||||||
|
Use <literal>any</literal> to listen on all addresses.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
port = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 6600;
|
||||||
|
description = ''
|
||||||
|
This setting is the TCP port that is desired for the daemon to get assigned
|
||||||
|
to.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
systemd.services.slimserver = {
|
||||||
|
after = [ "network.target" ];
|
||||||
|
description = "Slim Server for Logitech Squeezebox Players";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
preStart = "mkdir -p ${cfg.dataDir} && chown -R slimserver:slimserver ${cfg.dataDir}";
|
||||||
|
serviceConfig = {
|
||||||
|
User = "slimserver";
|
||||||
|
PermissionsStartOnly = true;
|
||||||
|
ExecStart = "${cfg.package}/slimserver.pl --logdir ${cfg.dataDir}/logs --prefsdir ${cfg.dataDir}/prefs --cachedir ${cfg.dataDir}/cache";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
users = {
|
||||||
|
groups.slimserver.gid = config.ids.gids.slimserver;
|
||||||
|
users.slimserver = {
|
||||||
|
uid = config.ids.uids.slimserver;
|
||||||
|
description = "Slimserver daemon user";
|
||||||
|
home = cfg.dataDir;
|
||||||
|
group = "slimserver";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue