summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2021-12-05 22:03:03 +0100
committerpennae <github@quasiparticle.net>2021-12-09 01:38:24 +0100
commit6eaf4f90c2b25918109fb2689d56e33a4f59f37d (patch)
treed2d6b98f58f9fafbe23aee54f524c359ea6f2f54 /nixos/modules
parentb9950385e574b9b13ddc31bd34695d6532aa4e64 (diff)
downloadnixpkgs-6eaf4f90c2b25918109fb2689d56e33a4f59f37d.tar
nixpkgs-6eaf4f90c2b25918109fb2689d56e33a4f59f37d.tar.gz
nixpkgs-6eaf4f90c2b25918109fb2689d56e33a4f59f37d.tar.bz2
nixpkgs-6eaf4f90c2b25918109fb2689d56e33a4f59f37d.tar.lz
nixpkgs-6eaf4f90c2b25918109fb2689d56e33a4f59f37d.tar.xz
nixpkgs-6eaf4f90c2b25918109fb2689d56e33a4f59f37d.tar.zst
nixpkgs-6eaf4f90c2b25918109fb2689d56e33a4f59f37d.zip
nixos/mpdscribble: add defaultText for some options using mpdCfg
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/audio/mpdscribble.nix9
1 files changed, 8 insertions, 1 deletions
diff --git a/nixos/modules/services/audio/mpdscribble.nix b/nixos/modules/services/audio/mpdscribble.nix
index 1368543ae1a..57d3ef77b34 100644
--- a/nixos/modules/services/audio/mpdscribble.nix
+++ b/nixos/modules/services/audio/mpdscribble.nix
@@ -1,10 +1,11 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
 
 with lib;
 
 let
   cfg = config.services.mpdscribble;
   mpdCfg = config.services.mpd;
+  mpdOpt = options.services.mpd;
 
   endpointUrls = {
     "last.fm" = "http://post.audioscrobbler.com";
@@ -108,6 +109,11 @@ in {
         mpdCfg.network.listenAddress
       else
         "localhost");
+      defaultText = literalExpression ''
+        if config.${mpdOpt.network.listenAddress} != "any"
+        then config.${mpdOpt.network.listenAddress}
+        else "localhost"
+      '';
       type = types.str;
       description = ''
         Host for the mpdscribble daemon to search for a mpd daemon on.
@@ -132,6 +138,7 @@ in {
 
     port = mkOption {
       default = mpdCfg.network.port;
+      defaultText = literalExpression "config.${mpdOpt.network.port}";
       type = types.port;
       description = ''
         Port for the mpdscribble daemon to search for a mpd daemon on.