From 879778091a5f8280a72a577b536137fa7a7a852a Mon Sep 17 00:00:00 2001 From: Mitchell Pleune Date: Sat, 26 Mar 2016 12:02:00 -0400 Subject: iodine service: add clients implimentation - services.iodined moved to services.iodine - configuration file backwards compatable - old iodine server configuration moved to services.iodine.server - attribute set services.iodine.clients added to specify any number of iodine clients - example: iodine.clients.home = { server = "iodinesubdomain.yourserver.com"; ... }; - client services names iodine-name where name would be home --- nixos/modules/services/networking/iodine.nix | 136 ++++++++++++++++++++++++++ nixos/modules/services/networking/iodined.nix | 86 ---------------- 2 files changed, 136 insertions(+), 86 deletions(-) create mode 100644 nixos/modules/services/networking/iodine.nix delete mode 100644 nixos/modules/services/networking/iodined.nix (limited to 'nixos/modules/services/networking') diff --git a/nixos/modules/services/networking/iodine.nix b/nixos/modules/services/networking/iodine.nix new file mode 100644 index 000000000000..1b0d2d9a517c --- /dev/null +++ b/nixos/modules/services/networking/iodine.nix @@ -0,0 +1,136 @@ +# NixOS module for iodine, ip over dns daemon + +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.iodine; + + iodinedUser = "iodined"; + +in +{ + + ### configuration + + options = { + + services.iodine = { + clients = mkOption { + default = {}; + description = '' + Each attribute of this option defines a systemd service that + runs iodine. Many or none may be defined. + The name of each service is + iodine-name + where name is the name of the + corresponding attribute name. + ''; + example = literalExample '' + { + foo = { + server = "tunnel.mdomain.com"; + relay = "8.8.8.8"; + extraConfig = "-P mysecurepassword"; + } + } + ''; + type = types.attrsOf (types.submodule ( + { + options = { + server = mkOption { + type = types.str; + default = ""; + description = "Domain or Subdomain of server running iodined"; + example = "tunnel.mydomain.com"; + }; + + relay = mkOption { + type = types.str; + default = ""; + description = "DNS server to use as a intermediate relay to the iodined server"; + example = "8.8.8.8"; + }; + + extraConfig = mkOption { + type = types.str; + default = ""; + description = "Additional command line parameters"; + example = "-P mysecurepassword -l 192.168.1.10 -p 23"; + }; + }; + })); + }; + + server = { + enable = mkOption { + type = types.bool; + default = false; + description = "enable iodined server"; + }; + + ip = mkOption { + type = types.str; + default = ""; + description = "The assigned ip address or ip range"; + example = "172.16.10.1/24"; + }; + + domain = mkOption { + type = types.str; + default = ""; + description = "Domain or subdomain of which nameservers point to us"; + example = "tunnel.mydomain.com"; + }; + + extraConfig = mkOption { + type = types.str; + default = ""; + description = "Additional command line parameters"; + example = "-P mysecurepassword -l 192.168.1.10 -p 23"; + }; + }; + + }; + }; + + ### implementation + + config = mkIf (cfg.server.enable || cfg.clients != {}) { + environment.systemPackages = [ pkgs.iodine ]; + boot.kernelModules = [ "tun" ]; + + systemd.services = + let + createIodineClientService = name: cfg: + { + description = "iodine client - ${name}"; + wantedBy = [ "ip-up.target" ]; + serviceConfig = { + RestartSec = "30s"; + Restart = "always"; + ExecStart = "${pkgs.iodine}/bin/iodine -f -u ${iodinedUser} ${cfg.extraConfig} ${cfg.relay} ${cfg.server}"; + }; + }; + in + listToAttrs ( + mapAttrsToList + (name: value: nameValuePair "iodine-${name}" (createIodineClientService name value)) + cfg.clients + ) // { + iodined = mkIf (cfg.server.enable) { + description = "iodine, ip over dns server daemon"; + wantedBy = [ "ip-up.target" ]; + serviceConfig.ExecStart = "${pkgs.iodine}/bin/iodined -f -u ${iodinedUser} ${cfg.server.extraConfig} ${cfg.server.ip} ${cfg.server.domain}"; + }; + }; + + users.extraUsers = singleton { + name = iodinedUser; + uid = config.ids.uids.iodined; + description = "Iodine daemon user"; + }; + users.extraGroups.iodined.gid = config.ids.gids.iodined; + }; +} diff --git a/nixos/modules/services/networking/iodined.nix b/nixos/modules/services/networking/iodined.nix deleted file mode 100644 index 20d371c4e2d1..000000000000 --- a/nixos/modules/services/networking/iodined.nix +++ /dev/null @@ -1,86 +0,0 @@ -# NixOS module for iodine, ip over dns daemon - -{ config, lib, pkgs, ... }: - -with lib; - -let - cfg = config.services.iodined; - - iodinedUser = "iodined"; - -in - -{ - - ### configuration - - options = { - - services.iodined = { - - enable = mkOption { - type = types.bool; - default = false; - description = "Enable iodine, ip over dns daemon"; - }; - - client = mkOption { - type = types.bool; - default = false; - description = "Start iodine in client mode"; - }; - - ip = mkOption { - type = types.str; - default = ""; - description = "Assigned ip address or ip range"; - example = "172.16.10.1/24"; - }; - - domain = mkOption { - type = types.str; - default = ""; - description = "Domain or subdomain of which nameservers point to us"; - example = "tunnel.mydomain.com"; - }; - - extraConfig = mkOption { - type = types.str; - default = ""; - description = "Additional command line parameters"; - example = "-P mysecurepassword -l 192.168.1.10 -p 23"; - }; - - }; - - }; - - ### implementation - - config = mkIf cfg.enable { - environment.systemPackages = [ pkgs.iodine ]; - boot.kernelModules = [ "tun" ]; - - systemd.services.iodined = { - description = "iodine, ip over dns daemon"; - wantedBy = [ "ip-up.target" ]; - serviceConfig.ExecStart = "${pkgs.iodine}/sbin/iodined -f -u ${iodinedUser} ${cfg.extraConfig} ${cfg.ip} ${cfg.domain}"; - }; - - - users.extraUsers = singleton { - name = iodinedUser; - uid = config.ids.uids.iodined; - description = "Iodine daemon user"; - }; - users.extraGroups.iodined.gid = config.ids.gids.iodined; - - assertions = [{ assertion = if !cfg.client then cfg.ip != "" else true; - message = "cannot start iodined without ip set";} - { assertion = cfg.domain != ""; - message = "cannot start iodined without domain name set";}]; - - }; - -} -- cgit 1.4.1 From a98a918b1053e3808a3d550527443b9b8d38b926 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Fri, 1 Apr 2016 01:26:52 +0200 Subject: syncthing: run daemon with dedicated user as default --- nixos/modules/misc/ids.nix | 2 ++ nixos/modules/services/networking/syncthing.nix | 33 +++++++++++++++++++------ 2 files changed, 27 insertions(+), 8 deletions(-) (limited to 'nixos/modules/services/networking') diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index f71d1e3fe200..2b5008b9ca8f 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -257,6 +257,7 @@ radicale = 234; hydra-queue-runner = 235; hydra-www = 236; + syncthing = 237; # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! @@ -485,6 +486,7 @@ pdnsd = 229; octoprint = 230; radicale = 234; + syncthing = 237; # When adding a gid, make sure it doesn't match an existing # uid. Users and groups with the same name should have equal diff --git a/nixos/modules/services/networking/syncthing.nix b/nixos/modules/services/networking/syncthing.nix index 67b90516b996..da9a270f30b6 100644 --- a/nixos/modules/services/networking/syncthing.nix +++ b/nixos/modules/services/networking/syncthing.nix @@ -5,6 +5,7 @@ with lib; let cfg = config.services.syncthing; + defaultUser = "syncthing"; in @@ -17,6 +18,7 @@ in services.syncthing = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the Syncthing, self-hosted open-source alternative @@ -26,7 +28,8 @@ in }; user = mkOption { - default = "syncthing"; + type = types.string; + default = defaultUser; description = '' Syncthing will be run under this user (user must exist, this can be your user name). @@ -34,8 +37,8 @@ in }; all_proxy = mkOption { - type = types.string; - default = ""; + type = types.nullOr types.string; + default = null; example = "socks5://address.com:1234"; description = '' Overwrites all_proxy environment variable for the syncthing process to @@ -45,6 +48,7 @@ in }; dataDir = mkOption { + type = types.path; default = "/var/lib/syncthing"; description = '' Path where the settings and keys will exist. @@ -71,20 +75,33 @@ in config = mkIf cfg.enable { + users = mkIf (cfg.user == defaultUser) { + extraUsers."${defaultUser}" = + { group = defaultUser; + home = cfg.dataDir; + createHome = true; + uid = config.ids.uids.syncthing; + description = "Syncthing daemon user"; + }; + + extraGroups."${defaultUser}".gid = + config.ids.gids.syncthing; + }; + systemd.services.syncthing = { description = "Syncthing service"; - after = [ "network.target" ]; + after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; environment = { STNORESTART = "yes"; # do not self-restart STNOUPGRADE = "yes"; - } // - (config.networking.proxy.envVars) // - (if cfg.all_proxy != "" then { all_proxy = cfg.all_proxy; } else {}); + inherit (cfg) all_proxy; + } // config.networking.proxy.envVars; serviceConfig = { - User = "${cfg.user}"; + User = cfg.user; + Group = optionalString (cfg.user == defaultUser) defaultUser; PermissionsStartOnly = true; Restart = "on-failure"; ExecStart = "${pkgs.syncthing}/bin/syncthing -no-browser -home=${cfg.dataDir}"; -- cgit 1.4.1 From 0de2d2fbcdcea47292662d2509f5d06c81288e48 Mon Sep 17 00:00:00 2001 From: Eric Litak Date: Tue, 29 Mar 2016 05:27:51 -0700 Subject: mfi: init at 2.1.11 This package has some outdated dependencies, so old versions of mongodb and v8 had to be re-added as well. --- nixos/modules/misc/ids.nix | 2 + nixos/modules/module-list.nix | 1 + nixos/modules/services/networking/mfi.nix | 90 ++++++++++++++++++++++ pkgs/development/libraries/v8/3.14.nix | 28 +++++++ .../v8/fix-GetLocalizedMessage-usage.patch | 27 +++++++ pkgs/servers/mfi/default.nix | 28 +++++++ pkgs/servers/nosql/mongodb/2.4.8.nix | 45 +++++++++++ pkgs/top-level/all-packages.nix | 8 ++ 8 files changed, 229 insertions(+) create mode 100644 nixos/modules/services/networking/mfi.nix create mode 100644 pkgs/development/libraries/v8/3.14.nix create mode 100644 pkgs/development/libraries/v8/fix-GetLocalizedMessage-usage.patch create mode 100644 pkgs/servers/mfi/default.nix create mode 100644 pkgs/servers/nosql/mongodb/2.4.8.nix (limited to 'nixos/modules/services/networking') diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index 2b5008b9ca8f..1e14fe655fc0 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -258,6 +258,7 @@ hydra-queue-runner = 235; hydra-www = 236; syncthing = 237; + mfi = 238; # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! @@ -487,6 +488,7 @@ octoprint = 230; radicale = 234; syncthing = 237; + #mfi = 238; # unused # When adding a gid, make sure it doesn't match an existing # uid. Users and groups with the same name should have equal diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 9462d72996fc..f5352eb6ed0f 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -333,6 +333,7 @@ ./services/networking/lambdabot.nix ./services/networking/libreswan.nix ./services/networking/mailpile.nix + ./services/networking/mfi.nix ./services/networking/mjpg-streamer.nix ./services/networking/minidlna.nix ./services/networking/miniupnpd.nix diff --git a/nixos/modules/services/networking/mfi.nix b/nixos/modules/services/networking/mfi.nix new file mode 100644 index 000000000000..5afb83ed022f --- /dev/null +++ b/nixos/modules/services/networking/mfi.nix @@ -0,0 +1,90 @@ +{ config, lib, pkgs, utils, ... }: +with lib; +let + name = "Ubiquiti mFi Controller"; + cfg = config.services.mfi; + stateDir = "/var/lib/mfi"; + # XXX 2 runtime exceptions using jre8: JSPException on GET / ; can't initialize ./data/keystore on first run. + cmd = "@${pkgs.jre7}/bin/java java -jar ${stateDir}/lib/ace.jar"; + mountPoints = [ + { what = "${pkgs.mfi}/dl"; where = "${stateDir}/dl"; } + { what = "${pkgs.mfi}/lib"; where = "${stateDir}/lib"; } + { what = "${pkgs.mongodb248}/bin"; where = "${stateDir}/bin"; } + ]; + systemdMountPoints = map (m: "${utils.escapeSystemdPath m.where}.mount") mountPoints; + ports = [ 6080 6880 6443 6843 ]; +in +{ + options = { + services.mfi = { + enable = mkEnableOption name; + openPorts = mkOption { + type = types.bool; + default = true; + description = "Whether to open TCP ports ${concatMapStrings (a: "${toString a} ") ports}for the services."; + }; + }; + }; + + config = mkIf cfg.enable { + + networking.firewall.allowedTCPPorts = mkIf config.services.mfi.openPorts ports; + + users.users.mfi = { + uid = config.ids.uids.mfi; + description = "mFi controller daemon user"; + home = "${stateDir}"; + }; + + # We must create the binary directories as bind mounts instead of symlinks + # This is because the controller resolves all symlinks to absolute paths + # to be used as the working directory. + systemd.mounts = map ({ what, where }: { + bindsTo = [ "mfi.service" ]; + partOf = [ "mfi.service" ]; + unitConfig.RequiresMountsFor = stateDir; + options = "bind"; + what = what; + where = where; + }) mountPoints; + + systemd.services.mfi = { + description = "mFi controller daemon"; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ] ++ systemdMountPoints; + partOf = systemdMountPoints; + bindsTo = systemdMountPoints; + unitConfig.RequiresMountsFor = stateDir; + + preStart = '' + # Clear ./webapps each run. + rm -rf "${stateDir}/webapps" + mkdir -p "${stateDir}/webapps" + ln -s "${pkgs.mfi}/webapps/ROOT.war" "${stateDir}/webapps" + + # Copy initial config only once. + test -e "${stateDir}/conf" || cp -ar "${pkgs.mfi}/conf" "${stateDir}/conf" + test -e "${stateDir}/data" || cp -ar "${pkgs.mfi}/data" "${stateDir}/data" + + # Fix Permissions. + # (Bind-mounts cause errors; ignore exit codes) + chown -fR mfi: "${stateDir}" || true + chmod -fR u=rwX,go= "${stateDir}" || true + ''; + + postStop = '' + rm -rf "${stateDir}/webapps" + ''; + + serviceConfig = { + Type = "simple"; + ExecStart = "${cmd} start"; + ExecStop = "${cmd} stop"; + User = "mfi"; + PermissionsStartOnly = true; + UMask = "0077"; + WorkingDirectory = "${stateDir}"; + }; + }; + }; +} diff --git a/pkgs/development/libraries/v8/3.14.nix b/pkgs/development/libraries/v8/3.14.nix new file mode 100644 index 000000000000..fee0f868ea92 --- /dev/null +++ b/pkgs/development/libraries/v8/3.14.nix @@ -0,0 +1,28 @@ +{ stdenv, callPackage, fetchFromGitHub, python, ... } @ args: +with stdenv.lib; +let + version = "3.14.5.10"; + sha256 = "08vhl84166x13b3cbx8y0g99yqx772zd33gawsa1nxqkyrykql6k"; +in +(callPackage ./generic.nix (args // { + inherit version sha256; +})).overrideDerivation (oldAttrs:{ + patchPhase = [ + oldAttrs.patchPhase + "sed -i 's,#!/usr/bin/python,#!${python}/bin/python,' build/gyp_v8" + ]; + + # http://code.google.com/p/v8/issues/detail?id=2149 + NIX_CFLAGS_COMPILE = concatStringsSep " " [ + oldAttrs.NIX_CFLAGS_COMPILE + "-Wno-unused-local-typedefs" + "-Wno-aggressive-loop-optimizations" + ]; + + src = fetchFromGitHub { + owner = "v8"; + repo = "v8"; + rev = "${version}"; + inherit sha256; + }; +}) diff --git a/pkgs/development/libraries/v8/fix-GetLocalizedMessage-usage.patch b/pkgs/development/libraries/v8/fix-GetLocalizedMessage-usage.patch new file mode 100644 index 000000000000..3bc0fff4d509 --- /dev/null +++ b/pkgs/development/libraries/v8/fix-GetLocalizedMessage-usage.patch @@ -0,0 +1,27 @@ +From dbe142c4eda0f15fad9fa85743dd11b81292fa8f Mon Sep 17 00:00:00 2001 +From: Timothy J Fontaine +Date: Thu, 23 May 2013 13:57:59 -0700 +Subject: [PATCH] v8: fix GetLocalizedMessage usage + +As is the backport of the abort on uncaught exception wouldn't compile +because we it was passing in `this` when it was unnecessary. +--- + deps/v8/src/isolate.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/isolate.cc b/src/isolate.cc +index 04a438b..5a5293e 100644 +--- a/src/isolate.cc ++++ b/src/isolate.cc +@@ -1161,7 +1161,7 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) { + (report_exception || can_be_caught_externally)) { + fatal_exception_depth++; + fprintf(stderr, "%s\n\nFROM\n", +- *MessageHandler::GetLocalizedMessage(this, message_obj)); ++ *MessageHandler::GetLocalizedMessage(message_obj)); + PrintCurrentStackTrace(stderr); + OS::Abort(); + } +-- +1.8.1.6 + diff --git a/pkgs/servers/mfi/default.nix b/pkgs/servers/mfi/default.nix new file mode 100644 index 000000000000..e431ca993a90 --- /dev/null +++ b/pkgs/servers/mfi/default.nix @@ -0,0 +1,28 @@ +{ stdenv, fetchurl, unzip }: + +stdenv.mkDerivation rec { + name = "mfi-controller-${version}"; + version = "2.1.11"; + + src = fetchurl { + url = "https://dl.ubnt.com/mfi/${version}/mFi.unix.zip"; + sha256 = "0b9q6025zf9zjzq8dcmcyai8rslx67g52j41gacxsk9i5dspmw90"; + }; + + buildInputs = [ unzip ]; + + dontBuild = true; + + installPhase = '' + mkdir -p $out + cp -ar conf data dl lib webapps $out + ''; + + meta = with stdenv.lib; { + homepage = http://www.ubnt.com/; + description = "Controller for Ubiquiti mFi devices"; + license = licenses.unfree; + platforms = platforms.unix; + maintainers = with maintainers; [ elitak ]; + }; +} diff --git a/pkgs/servers/nosql/mongodb/2.4.8.nix b/pkgs/servers/nosql/mongodb/2.4.8.nix new file mode 100644 index 000000000000..448d260bdb9d --- /dev/null +++ b/pkgs/servers/nosql/mongodb/2.4.8.nix @@ -0,0 +1,45 @@ +# This derivation was resurrected from 4c8ec5e12e187347fd97b1a1a9a43eb19e009ed0 +# by elitak for use with the Ubiquiti mFi Controller package, which breaks at +# runtime on mongodb3+ and jre8+. We will need to pull in sufficiently old +# versions of boost and v8 to build this, as well. +{ stdenv, fetchurl, scons, boost155, v8_3_14, gperftools, pcre, snappy }: +with stdenv.lib; +let + version = "2.4.8"; +in +stdenv.mkDerivation rec { + name = "mongodb-${version}"; + + src = fetchurl { + url = "http://downloads.mongodb.org/src/mongodb-src-r${version}.tar.gz"; + sha256 = "1p6gnharypglfp39halp72fig96fqjhakyy7m76a1prxwpjkqw7x"; + }; + + nativeBuildInputs = [ scons boost155 v8_3_14 gperftools pcre snappy ]; + + postPatch = '' + substituteInPlace SConstruct \ + --replace "Environment( BUILD_DIR" "Environment( ENV = os.environ, BUILD_DIR" \ + --replace 'CCFLAGS=["-Werror", "-pipe"]' 'CCFLAGS=["-pipe"]' + ''; + + NIX_CFLAGS_COMPILE = "-Wno-unused-local-typedefs"; + + buildPhase = '' + export SCONSFLAGS="-j$NIX_BUILD_CORES" + scons all --use-system-all + ''; + + installPhase = '' + mkdir -p $out/lib + scons install --use-system-all --full --prefix=$out + ''; + + meta = { + description = "A scalable, high-performance, open source NoSQL database"; + homepage = http://www.mongodb.org; + license = licenses.agpl3; + maintainers = with maintainers; [ bluescreen303 elitak ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cca23969c83d..1a32ba98d319 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8907,6 +8907,10 @@ in gnutls = gnutls; }); + v8_3_14 = callPackage ../development/libraries/v8/3.14.nix { + inherit (pythonPackages) gyp; + }; + v8_3_16_14 = callPackage ../development/libraries/v8/3.16.14.nix { inherit (pythonPackages) gyp; # The build succeeds using gcc5 but it fails to build pkgs.consul-ui @@ -9624,6 +9628,8 @@ in meteor = callPackage ../servers/meteor/default.nix { }; + mfi = callPackage ../servers/mfi { }; + # Backwards compatibility. mod_dnssd = pkgs.apacheHttpdPackages.mod_dnssd; mod_evasive = pkgs.apacheHttpdPackages.mod_evasive; @@ -9741,6 +9747,8 @@ in sasl = cyrus_sasl; }; + mongodb248 = callPackage ../servers/nosql/mongodb/2.4.8.nix { }; + riak = callPackage ../servers/nosql/riak/2.1.1.nix { }; influxdb = (callPackage ../servers/nosql/influxdb { }).bin // { outputs = [ "bin" ]; }; -- cgit 1.4.1 From 4d87926795c4f0db9cc4cf65dfd35a32f892cefb Mon Sep 17 00:00:00 2001 From: Alexander Ried Date: Fri, 8 Apr 2016 22:36:03 +0200 Subject: minidlna: use hostname in DLNA friendly name --- nixos/modules/services/networking/minidlna.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nixos/modules/services/networking') diff --git a/nixos/modules/services/networking/minidlna.nix b/nixos/modules/services/networking/minidlna.nix index aa28502a12c4..bbbfe9d72e1a 100644 --- a/nixos/modules/services/networking/minidlna.nix +++ b/nixos/modules/services/networking/minidlna.nix @@ -58,7 +58,7 @@ in services.minidlna.config = '' port=${toString port} - friendly_name=NixOS Media Server + friendly_name=${config.networking.hostName} MiniDLNA db_dir=/var/cache/minidlna log_dir=/var/log/minidlna inotify=yes -- cgit 1.4.1 From 72cd570421d4a0f00a006bc2e5fc256692069380 Mon Sep 17 00:00:00 2001 From: Alexander Ried Date: Fri, 8 Apr 2016 22:37:11 +0200 Subject: minidlna: use journalctl for logging, systemd for runtimedir --- nixos/modules/services/networking/minidlna.nix | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'nixos/modules/services/networking') diff --git a/nixos/modules/services/networking/minidlna.nix b/nixos/modules/services/networking/minidlna.nix index bbbfe9d72e1a..61d063dbfe0e 100644 --- a/nixos/modules/services/networking/minidlna.nix +++ b/nixos/modules/services/networking/minidlna.nix @@ -60,7 +60,7 @@ in port=${toString port} friendly_name=${config.networking.hostName} MiniDLNA db_dir=/var/cache/minidlna - log_dir=/var/log/minidlna + log_level=warn inotify=yes ${concatMapStrings (dir: '' media_dir=${dir} @@ -83,21 +83,18 @@ in preStart = '' - mkdir -p /var/cache/minidlna /var/log/minidlna /run/minidlna - chown minidlna /var/cache/minidlna /var/log/minidlna /run/minidlna + mkdir -p /var/cache/minidlna + chown -R minidlna:minidlna /var/cache/minidlna ''; - # FIXME: log through the journal rather than - # /var/log/minidlna. The -d flag does that, but also raises - # the log level to debug... serviceConfig = { User = "minidlna"; - Group = "nogroup"; + Group = "minidlna"; PermissionsStartOnly = true; - Type = "forking"; + RuntimeDirectory = "minidlna"; PIDFile = "/run/minidlna/pid"; ExecStart = - "@${pkgs.minidlna}/sbin/minidlnad minidlnad -P /run/minidlna/pid" + + "${pkgs.minidlna}/sbin/minidlnad -S -P /run/minidlna/pid" + " -f ${pkgs.writeText "minidlna.conf" cfg.config}"; }; }; -- cgit 1.4.1