diff --git a/hosts/ni/default.nix b/hosts/ni/default.nix index 3eef3cf5..c3cdb3f7 100644 --- a/hosts/ni/default.nix +++ b/hosts/ni/default.nix @@ -30,6 +30,7 @@ networking.enable = true; networking.setup = "networkmanager"; networking.wireguard.enable = true; + setups.music.enable = true; }; disko.devices = import ./disko.nix { @@ -47,24 +48,6 @@ "time.facebook.com" ]; - # My portable music streaming server. - services.gonic = { - enable = true; - settings = { - listen-addr = "127.0.0.1:4747"; - cache-path = "/var/cache/gonic"; - music-path = [ - "/srv/music" - ]; - podcast-path = "/var/cache/gonic/podcasts"; - - jukebox-enabled = true; - - scan-interval = 1; - scan-at-start-enabled = true; - }; - }; - sops.secrets = lib.getSecrets ./secrets/secrets.yaml { "ssh-key" = { }; }; diff --git a/hosts/ni/modules/default.nix b/hosts/ni/modules/default.nix index cfa7996e..73984b68 100644 --- a/hosts/ni/modules/default.nix +++ b/hosts/ni/modules/default.nix @@ -4,5 +4,6 @@ ./hardware/qol.nix ./networking/setup.nix ./networking/wireguard.nix + ./setups/music.nix ]; } diff --git a/hosts/ni/modules/setups/music.nix b/hosts/ni/modules/setups/music.nix new file mode 100644 index 00000000..fb8b04f8 --- /dev/null +++ b/hosts/ni/modules/setups/music.nix @@ -0,0 +1,29 @@ +{ config, lib, pkgs, ... }: + +let + hostCfg = config.hosts.ni; + cfg = hostCfg.setups.music; +in +{ + options.hosts.ni.setups.music.enable = lib.mkEnableOption "music streaming and organizing setup"; + + config = lib.mkIf cfg.enable { + # My portable music streaming server. + services.gonic = { + enable = true; + settings = { + listen-addr = "localhost:4747"; + cache-path = "/var/cache/gonic"; + music-path = [ + "/srv/music" + ]; + podcast-path = "/var/cache/gonic/podcasts"; + + jukebox-enabled = true; + + scan-interval = 1; + scan-at-start-enabled = true; + }; + }; + }; +} diff --git a/users/home-manager/foo-dogsquared/modules/music-setup.nix b/users/home-manager/foo-dogsquared/modules/music-setup.nix index 0fb8d79d..fe6053ec 100644 --- a/users/home-manager/foo-dogsquared/modules/music-setup.nix +++ b/users/home-manager/foo-dogsquared/modules/music-setup.nix @@ -5,7 +5,7 @@ let cfg = userCfg.music; ytdlpAudio = pkgs.writeScriptBin "yt-dlp-audio" '' - ${pkgs.yt-dlp}/bin/yt-dlp --config-location "${../config/yt-dlp-audio.conf}" $@ + ${pkgs.yt-dlp}/bin/yt-dlp --config-location "${../../config/yt-dlp-audio.conf}" $@ ''; musicDir = config.xdg.userDirs.music;