From 9113efdbf811952740222cffc74b773e5af8319a Mon Sep 17 00:00:00 2001 From: Astro Date: Sat, 17 Sep 2022 19:31:10 +0200 Subject: [PATCH 1/8] rpi-netboot: add projectm --- hosts/rpi-netboot/default.nix | 1 + 1 file changed, 1 insertion(+) 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 From c1452bb3c8f7f73a9c14d86672270f00d70d60a9 Mon Sep 17 00:00:00 2001 From: Astro Date: Sat, 17 Sep 2022 19:31:38 +0200 Subject: [PATCH 2/8] dacbert, rpi-netboot: install projectm --- hosts/dacbert/default.nix | 2 +- hosts/rpi-netboot/default.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hosts/dacbert/default.nix b/hosts/dacbert/default.nix index e013c409..fd1a777c 100644 --- a/hosts/dacbert/default.nix +++ b/hosts/dacbert/default.nix @@ -96,7 +96,7 @@ pavucontrol glxinfo tracer-game - bevy_julia + # bevy_julia bevy_mandelbrot allcolors ]; diff --git a/hosts/rpi-netboot/default.nix b/hosts/rpi-netboot/default.nix index b2a2bd9c..9212e163 100644 --- a/hosts/rpi-netboot/default.nix +++ b/hosts/rpi-netboot/default.nix @@ -68,7 +68,7 @@ glxinfo projectm tracer-game - bevy_julia + # bevy_julia bevy_mandelbrot allcolors ]; From 6dd686cf1e7bff98e838cf2e529464a64d3a7163 Mon Sep 17 00:00:00 2001 From: Astro Date: Sat, 17 Sep 2022 21:13:40 +0200 Subject: [PATCH 3/8] flake.nix: let inputs.bevy-julia point to my fork --- flake.lock | 19 ++++++++++--------- flake.nix | 3 ++- 2 files changed, 12 insertions(+), 10 deletions(-) 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..d3cfc05b 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: From dd75a52d28654c5c5a5aa6de51930376e27b3494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sat, 17 Sep 2022 22:15:13 +0200 Subject: [PATCH 4/8] Move audio groups to audio module --- config/audio-server/default.nix | 10 ++++++++++ modules/c3d2.nix | 4 ---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/config/audio-server/default.nix b/config/audio-server/default.nix index 52ad7384..9bcb5131 100644 --- a/config/audio-server/default.nix +++ b/config/audio-server/default.nix @@ -70,5 +70,15 @@ RestartSec = 60; }; }; + + users = { + groups = { + pulse-access = { }; + }; + users.k-ot.extraGroups = [ + "pipewire" + "pulse-access" # required for system wide pulseaudio + ]; + }; }; } 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" ]; From 91526b880304747535bb6354337a0485be875c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sat, 17 Sep 2022 22:15:31 +0200 Subject: [PATCH 5/8] Update pipewire configuration --- config/audio-server/default.nix | 35 +++--- config/audio-server/generate.sh | 2 +- .../audio-server/pipewire-pulse.conf.in.json | 17 ++- config/audio-server/pipewire-pulse.conf.json | 110 +++++++++++++++--- 4 files changed, 133 insertions(+), 31 deletions(-) diff --git a/config/audio-server/default.nix b/config/audio-server/default.nix index 9bcb5131..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; 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" + } + } + } + ] } From 8dc5e6fad69bfc793e5e72d1d37712874f83ad4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sat, 17 Sep 2022 22:16:08 +0200 Subject: [PATCH 6/8] rebuild-local: don't check remote host when only building --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index d3cfc05b..6a09bbeb 100644 --- a/flake.nix +++ b/flake.nix @@ -345,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 "$@" ''; From f08946f64be4ebfc606ffc41454167bbb6e81f84 Mon Sep 17 00:00:00 2001 From: Astro Date: Sat, 17 Sep 2022 22:15:05 +0200 Subject: [PATCH 7/8] dacbert, rpi-netboot: reenable bevy_julia --- hosts/dacbert/default.nix | 2 +- hosts/rpi-netboot/default.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hosts/dacbert/default.nix b/hosts/dacbert/default.nix index fd1a777c..e013c409 100644 --- a/hosts/dacbert/default.nix +++ b/hosts/dacbert/default.nix @@ -96,7 +96,7 @@ pavucontrol glxinfo tracer-game - # bevy_julia + bevy_julia bevy_mandelbrot allcolors ]; diff --git a/hosts/rpi-netboot/default.nix b/hosts/rpi-netboot/default.nix index 9212e163..b2a2bd9c 100644 --- a/hosts/rpi-netboot/default.nix +++ b/hosts/rpi-netboot/default.nix @@ -68,7 +68,7 @@ glxinfo projectm tracer-game - # bevy_julia + bevy_julia bevy_mandelbrot allcolors ]; From ca3dd9729dcb454b494622247c0108578fa64fdb Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 18 Sep 2022 01:44:49 +0200 Subject: [PATCH 8/8] modules/microvm: add defaultGateway for flpk --- modules/microvm.nix | 1 + 1 file changed, 1 insertion(+) 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;