audio: use extraConfig text type
This commit is contained in:
parent
b79aea9280
commit
6d59613a23
|
@ -4,7 +4,7 @@ let
|
||||||
cfg = config.c3d2.audioStreaming;
|
cfg = config.c3d2.audioStreaming;
|
||||||
isGraphical = config.services.xserver.enable || config.services.xserver.displayManager.defaultSession != null;
|
isGraphical = config.services.xserver.enable || config.services.xserver.displayManager.defaultSession != null;
|
||||||
|
|
||||||
hasConfigPackages = options.services.pipewire?configPackages;
|
hasExtraConfig = options.services.pipewire?extraConfig;
|
||||||
zeroconfConfig = builtins.toJSON {
|
zeroconfConfig = builtins.toJSON {
|
||||||
"context.modules" = [ {
|
"context.modules" = [ {
|
||||||
"name" = "libpipewire-module-zeroconf-discover";
|
"name" = "libpipewire-module-zeroconf-discover";
|
||||||
|
@ -17,12 +17,8 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg {
|
config = lib.mkIf cfg {
|
||||||
environment.etc = lib.mkIf (!hasConfigPackages) {
|
environment.etc = lib.mkIf (!hasExtraConfig) {
|
||||||
"pipewire/pipewire.conf.d/zeroconf.conf".text = builtins.toJSON {
|
"pipewire/pipewire.conf.d/zeroconf.conf".text = zeroconfConfig;
|
||||||
"context.modules" = [ {
|
|
||||||
"name" = "libpipewire-module-zeroconf-discover";
|
|
||||||
} ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = lib.mkIf isGraphical (with pkgs; [
|
environment.systemPackages = lib.mkIf isGraphical (with pkgs; [
|
||||||
|
@ -76,11 +72,8 @@ in
|
||||||
"${nssmdns}" = true;
|
"${nssmdns}" = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
pipewire = lib.optionalAttrs hasConfigPackages {
|
pipewire = lib.optionalAttrs hasExtraConfig {
|
||||||
configPackages = [ (pkgs.runCommand "zeroconf.conf" { } ''
|
extraConfig.pipewire.zeroconf = zeroconfConfig;
|
||||||
mkdir -p $out/share/pipewire/pipewire.conf.d/
|
|
||||||
ln -s ${pkgs.writeText "zeroconf.conf" zeroconfConfig} $out/share/pipewire/pipewire.conf.d/zeroconf.conf
|
|
||||||
'') ];
|
|
||||||
}// {
|
}// {
|
||||||
pulse.enable = true;
|
pulse.enable = true;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue