diff --git a/config/audio-server/default.nix b/config/audio-server/default.nix index 52ad7384..3285b637 100644 --- a/config/audio-server/default.nix +++ b/config/audio-server/default.nix @@ -18,15 +18,17 @@ hardware.pulseaudio = { enable = true; systemWide = true; - tcp.enable = true; - tcp.anonymousClients.allowedIpRanges = [ - "127.0.0.0/8" - "::1/128" - "fd23:42:c3d2:500::/56" - "172.22.99.0/24" - "172.20.72.0/21" - "2a00:8180:2c00:200::/56" - ]; + tcp = { + enable = true; + anonymousClients.allowedIpRanges = [ + "127.0.0.0/8" + "::1/128" + "fd23:42:c3d2:500::/56" + "172.22.99.0/24" + "172.20.72.0/21" + "2a00:8180:2c00:200::/56" + ]; + }; zeroconf.publish.enable = true; package = (pkgs.pulseaudio.override { bluetoothSupport = true; @@ -38,13 +40,14 @@ }); }; - # TODO: configure system wide service - #services.pipewire = { - # enable = true; - # alsa.enable = true; - # config.pipewire-pulse = lib.importJSON ./pipewire-pulse.conf.json; - # pulse.enable = true; - #}; + # pipewire has no systemwide pipewire-pulse + # services.pipewire = { + # enable = true; + # config.pipewire-pulse = lib.importJSON ./pipewire-pulse.conf.json; + # pulse.enable = true; + # socketActivation = false; + # systemWide = true; + # }; security.rtkit.enable = true; @@ -70,5 +73,15 @@ RestartSec = 60; }; }; + + users = { + groups = { + pulse-access = { }; + }; + users.k-ot.extraGroups = [ + "pipewire" + "pulse-access" # required for system wide pulseaudio + ]; + }; }; } diff --git a/config/audio-server/generate.sh b/config/audio-server/generate.sh index 4407ee35..c1edabc0 100755 --- a/config/audio-server/generate.sh +++ b/config/audio-server/generate.sh @@ -4,6 +4,6 @@ # shellcheck shell=bash dir=$(dirname "$(readlink -f "$0")") -default_pipewire_pulse=$(nix-instantiate --eval -E '(import { }).pkgs.path')/nixos/modules/services/desktops/pipewire/pipewire-pulse.conf.json +default_pipewire_pulse=$(nix-instantiate --eval -E '(import { }).pkgs.path')/nixos/modules/services/desktops/pipewire/daemon/pipewire-pulse.conf.json jq -s '.[0] * .[1] * .[2]' "$dir/pipewire-pulse.conf.in.json" "$default_pipewire_pulse" > "$dir/pipewire-pulse.conf.json" <(jq -cnS '{ "context.modules": [ inputs."context.modules" ] | add}' "$default_pipewire_pulse" "$dir/pipewire-pulse.conf.in.json") diff --git a/config/audio-server/pipewire-pulse.conf.in.json b/config/audio-server/pipewire-pulse.conf.in.json index 9ff61a85..8c119824 100644 --- a/config/audio-server/pipewire-pulse.conf.in.json +++ b/config/audio-server/pipewire-pulse.conf.in.json @@ -6,10 +6,25 @@ { "name": "libpipewire-module-protocol-pulse", "args": { + "auth-ip-acl": [ + "127.0.0.0/8", + "::1/128", + "fd23:42:c3d2:500::/56", + "172.22.99.0/24", + "172.20.72.0/21", + "2a00:8180:2c00:200::/56" + ], "server.address": [ "unix:native", "tcp:4713" - ] + ], + "pulse.min.req": "256/48000", + "pulse.default.req": "960/48000", + "pulse.min.frag": "256/48000", + "pulse.default.frag": "96000/48000", + "pulse.default.tlength": "96000/48000", + "pulse.min.quantum": "256/48000", + "pulse.default.format": "F32" } } ] diff --git a/config/audio-server/pipewire-pulse.conf.json b/config/audio-server/pipewire-pulse.conf.json index 3e04a2c5..06b56572 100644 --- a/config/audio-server/pipewire-pulse.conf.json +++ b/config/audio-server/pipewire-pulse.conf.json @@ -1,12 +1,14 @@ { "context.modules": [ { - "args": {}, + "args": { + "nice.level": -11 + }, "flags": [ "ifexists", "nofail" ], - "name": "libpipewire-module-rtkit" + "name": "libpipewire-module-rt" }, { "name": "libpipewire-module-protocol-native" @@ -21,19 +23,35 @@ "name": "libpipewire-module-metadata" }, { - "args": { - "server.address": [ - "unix:native", - "tcp:4713" - ], - "vm.overrides": { - "pulse.min.quantum": "1024/48000" - } - }, + "args": {}, "name": "libpipewire-module-protocol-pulse" }, { "name": "libpipewire-module-zeroconf-publish" + }, + { + "args": { + "auth-ip-acl": [ + "127.0.0.0/8", + "::1/128", + "fd23:42:c3d2:500::/56", + "172.22.99.0/24", + "172.20.72.0/21", + "2a00:8180:2c00:200::/56" + ], + "pulse.default.format": "F32", + "pulse.default.frag": "96000/48000", + "pulse.default.req": "960/48000", + "pulse.default.tlength": "96000/48000", + "pulse.min.frag": "256/48000", + "pulse.min.quantum": "256/48000", + "pulse.min.req": "256/48000", + "server.address": [ + "unix:native", + "tcp:4713" + ] + }, + "name": "libpipewire-module-protocol-pulse" } ], "context.properties": {}, @@ -41,6 +59,72 @@ "audio.convert.*": "audioconvert/libspa-audioconvert", "support.*": "support/libspa-support" }, - "context.exec": [], - "stream.properties": {} + "context.exec": [ + { + "path": "pactl", + "args": "load-module module-always-sink" + } + ], + "stream.properties": {}, + "pulse.properties": { + "server.address": [ + "unix:native" + ], + "vm.overrides": { + "pulse.min.quantum": "1024/48000" + } + }, + "pulse.rules": [ + { + "matches": [ + {} + ], + "actions": { + "update-props": {} + } + }, + { + "matches": [ + { + "application.process.binary": "teams" + }, + { + "application.process.binary": "teams-insiders" + }, + { + "application.process.binary": "skypeforlinux" + } + ], + "actions": { + "quirks": [ + "force-s16-info" + ] + } + }, + { + "matches": [ + { + "application.process.binary": "firefox" + } + ], + "actions": { + "quirks": [ + "remove-capture-dont-move" + ] + } + }, + { + "matches": [ + { + "application.name": "~speech-dispatcher*" + } + ], + "actions": { + "update-props": { + "pulse.min.req": "1024/48000", + "pulse.min.quantum": "1024/48000" + } + } + } + ] } diff --git a/flake.lock b/flake.lock index 9679f3de..77857587 100644 --- a/flake.lock +++ b/flake.lock @@ -34,17 +34,18 @@ ] }, "locked": { - "lastModified": 1663370480, - "narHash": "sha256-fCC/ukecfQZx8M3gNgQ2LCJAXWFIW3uXF7X19oSAVJc=", - "owner": "matelab", - "repo": "bevy_julia", - "rev": "6ced0d32cd785d206acdf97f0bde7fb50583b4e5", - "type": "github" + "lastModified": 1663441942, + "narHash": "sha256-KNKnxcD8mHfjCqI0FluGOY1gfDfOMo8K9upGnCGksGo=", + "ref": "main", + "rev": "7feee1b6c436230f2adea774aab14a74d862e355", + "revCount": 3, + "type": "git", + "url": "https://gitea.c3d2.de/astro/bevy-julia.git" }, "original": { - "owner": "matelab", - "repo": "bevy_julia", - "type": "github" + "ref": "main", + "type": "git", + "url": "https://gitea.c3d2.de/astro/bevy-julia.git" } }, "bevy-mandelbrot": { diff --git a/flake.nix b/flake.nix index e313c4e4..6a09bbeb 100644 --- a/flake.nix +++ b/flake.nix @@ -24,7 +24,8 @@ }; }; bevy-julia = { - url = "github:matelab/bevy_julia"; + # url = "github:matelab/bevy_julia"; + url = "git+https://gitea.c3d2.de/astro/bevy-julia.git?ref=main"; inputs = { nixpkgs.follows = "nixos"; # breaks the build: @@ -344,7 +345,7 @@ "${name}-nixos-rebuild-local" = pkgs.writeScriptBin "${name}-nixos-rebuild" '' #!${pkgs.runtimeShell} -ex - [[ $(ssh ${target} cat /etc/hostname) == ${name} ]] + [[ $1 == build || $(ssh ${target} cat /etc/hostname) == ${name} ]] ${pkgs.nixos-rebuild}/bin/nixos-rebuild ${rebuildArg} --target-host ${target} --use-remote-sudo "$@" ''; diff --git a/hosts/rpi-netboot/default.nix b/hosts/rpi-netboot/default.nix index 09114c8f..b2a2bd9c 100644 --- a/hosts/rpi-netboot/default.nix +++ b/hosts/rpi-netboot/default.nix @@ -66,6 +66,7 @@ firefox pavucontrol glxinfo + projectm tracer-game bevy_julia bevy_mandelbrot diff --git a/modules/c3d2.nix b/modules/c3d2.nix index 3140cec3..ead2b8ba 100644 --- a/modules/c3d2.nix +++ b/modules/c3d2.nix @@ -182,9 +182,6 @@ in users.motd = lib.mkIf cfg.enableMotd (builtins.readFile ./motd); users = { - groups = { - pulse-access = { }; - }; users = { k-ot = lib.mkIf cfg.k-ot.enable { packages = with pkgs; [ screen tmux ]; @@ -193,7 +190,6 @@ in uid = 1000; extraGroups = [ "audio" - "pulse-access" # required for system wide pulseaudio "video" "wheel" ]; diff --git a/modules/microvm.nix b/modules/microvm.nix index fd69b3cb..4be9f388 100644 --- a/modules/microvm.nix +++ b/modules/microvm.nix @@ -4,6 +4,7 @@ let serv = "serv-gw"; c3d2 = "c3d2-gw3"; pub = "pub-gw"; + flpk = "flpk-gw"; }; inherit (config.networking) hostName;