diff --git a/nixos/modules/services/audio/icecast.nix b/nixos/modules/services/audio/icecast.nix
index 930b6af004a2..feb78ca8fc5c 100644
--- a/nixos/modules/services/audio/icecast.nix
+++ b/nixos/modules/services/audio/icecast.nix
@@ -5,8 +5,14 @@
...
}:
let
+ inherit (lib)
+ mkRemovedOptionModule
+ mkRenamedOptionModule
+ ;
+
cfg = config.services.icecast;
configFile = pkgs.writeText "icecast.xml" ''
+
${cfg.hostname}
@@ -16,7 +22,7 @@ let
- ${cfg.logDir}
+ /var/log/icecast
${pkgs.icecast}/share/icecast/admin
${pkgs.icecast}/share/icecast/web
@@ -29,18 +35,27 @@ let
0
-
- ${cfg.user}
- ${cfg.group}
-
- ${cfg.extraConf}
+ ${cfg.extraConfig}
'';
in
{
+ imports = [
+ (mkRemovedOptionModule [ "services" "icecast" "logDir" ] ''
+ The log directory is now managed by systemd's LogsDirectory= directive.
+ '')
+ (mkRemovedOptionModule [ "services" "icecast" "user" ] ''
+ The service now runs under the dynamically allocated `icecast` user.
+ '')
+ (mkRemovedOptionModule [ "services" "icecast" "group" ] ''
+ The service now runs under the dynamically allocated `icecast` group.
+ '')
+ (mkRenamedOptionModule [ "services" "icecast" "extraConf" ] [ "services" "icecast" "extraConfig" ])
+ ];
+
###### interface
options = {
@@ -69,12 +84,6 @@ in
};
};
- logDir = lib.mkOption {
- type = lib.types.path;
- description = "Base directory used for logging.";
- default = "/var/log/icecast";
- };
-
listen = {
port = lib.mkOption {
type = lib.types.port;
@@ -89,22 +98,12 @@ in
};
};
- user = lib.mkOption {
- type = lib.types.str;
- description = "User privileges for the server.";
- default = "nobody";
- };
-
- group = lib.mkOption {
- type = lib.types.str;
- description = "Group privileges for the server.";
- default = "nogroup";
- };
-
- extraConf = lib.mkOption {
+ extraConfig = lib.mkOption {
type = lib.types.lines;
- description = "icecast.xml content.";
default = "";
+ description = ''
+ Extra configuration added to {file}`icecast.xml` inside the `` element.
+ '';
};
};
@@ -120,11 +119,20 @@ in
description = "Icecast Network Audio Streaming Server";
wantedBy = [ "multi-user.target" ];
- preStart = "mkdir -p ${cfg.logDir} && chown ${cfg.user}:${cfg.group} ${cfg.logDir}";
serviceConfig = {
Type = "simple";
- ExecStart = "${pkgs.icecast}/bin/icecast -c ${configFile}";
- ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
+ DynamicUser = true;
+ ExecStart = toString [
+ (lib.getExe pkgs.icecast)
+ "-c"
+ configFile
+ ];
+ ExecReload = toString [
+ (lib.getExe' pkgs.coreutils "kill")
+ "-HUP"
+ "$MAINPID"
+ ];
+ LogsDirectory = "icecast";
};
};
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 4edc8777cf16..be7df9027bb4 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -748,6 +748,7 @@ in
hydra = runTest ./hydra;
i18n = runTest ./i18n.nix;
i3wm = runTest ./i3wm.nix;
+ icecast = runTest ./icecast.nix;
icingaweb2 = runTest ./icingaweb2.nix;
ifm = runTest ./ifm.nix;
ifstate = import ./ifstate { inherit runTest; };
diff --git a/nixos/tests/icecast.nix b/nixos/tests/icecast.nix
new file mode 100644
index 000000000000..bb6652e8ecf8
--- /dev/null
+++ b/nixos/tests/icecast.nix
@@ -0,0 +1,25 @@
+{
+ pkgs,
+ ...
+}:
+
+{
+ name = "icecast";
+ meta = {
+ inherit (pkgs.icecast.meta) maintainers;
+ };
+
+ nodes.machine = {
+ services.icecast = {
+ enable = true;
+ hostname = "nixos.test";
+ admin.password = "test";
+ };
+ };
+
+ testScript = ''
+ machine.wait_for_unit("icecast.service")
+ machine.wait_for_open_port(8000)
+ machine.succeed("curl -fail http://localhost:8000 | grep -q 'DO NOT ATTEMPT TO PARSE ICECAST HTML OUTPUT'")
+ '';
+}
diff --git a/pkgs/by-name/ic/icecast/package.nix b/pkgs/by-name/ic/icecast/package.nix
index 7200b2e25c90..770ce90b5f8c 100644
--- a/pkgs/by-name/ic/icecast/package.nix
+++ b/pkgs/by-name/ic/icecast/package.nix
@@ -2,36 +2,48 @@
lib,
stdenv,
fetchurl,
- libxml2,
- libxslt,
+ pkg-config,
curl,
- libvorbis,
- libtheora,
- speex,
+ libigloo,
libkate,
libopus,
+ libtheora,
+ libvorbis,
+ libxml2,
+ libxslt,
+ rhash,
+ speex,
+ nixosTests,
}:
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
pname = "icecast";
- version = "2.4.4";
+ version = "2.5.0";
src = fetchurl {
- url = "http://downloads.xiph.org/releases/icecast/icecast-${version}.tar.gz";
- sha256 = "0i2d9rhav0x6js2qhjf5iy6j2a7f0d11ail0lfv40hb1kygrgda9";
+ url = "http://downloads.xiph.org/releases/icecast/icecast-${finalAttrs.version}.tar.gz";
+ hash = "sha256-2aoHx0Ka7BnZUP9v1CXDcfdxWM00/yIPwZGywYbGfHo=";
};
+ nativeBuildInputs = [ pkg-config ];
+
buildInputs = [
- libxml2
- libxslt
curl
- libvorbis
- libtheora
- speex
+ libigloo
libkate
libopus
+ libtheora
+ libvorbis
+ libxml2
+ libxslt
+ rhash
+ speex
];
+ passthru.tests = {
+ inherit (nixosTests) icecast;
+ };
+
meta = {
description = "Server software for streaming multimedia";
mainProgram = "icecast";
@@ -50,4 +62,4 @@ stdenv.mkDerivation rec {
maintainers = with lib.maintainers; [ jcumming ];
platforms = with lib.platforms; unix;
};
-}
+})
diff --git a/pkgs/by-name/li/libigloo/package.nix b/pkgs/by-name/li/libigloo/package.nix
new file mode 100644
index 000000000000..89dc3a318127
--- /dev/null
+++ b/pkgs/by-name/li/libigloo/package.nix
@@ -0,0 +1,27 @@
+{
+ lib,
+ stdenv,
+ fetchurl,
+ rhash,
+ icecast,
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+ pname = "libigloo";
+ version = "0.9.5";
+
+ src = fetchurl {
+ url = "https://downloads.xiph.org/releases/igloo/libigloo-${finalAttrs.version}.tar.gz";
+ hash = "sha256-6iLpEZ96IYiBD5kQDFFVxnYtRZWuITuawp5ptPC4cok=";
+ };
+
+ buildInputs = [ rhash ];
+
+ doCheck = true;
+
+ meta = {
+ description = "Generic C framework used and developed by the Icecast project";
+ license = lib.licenses.gpl2Only;
+ inherit (icecast.meta) maintainers;
+ };
+})